MANUAL: clarify template vs metadata variables (#4501)

This commit is contained in:
Mauro Bieg 2018-03-27 18:14:50 +02:00 committed by John MacFarlane
parent 6d35090538
commit c24ecf9cd9

View file

@ -525,13 +525,15 @@ Reader options
`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*] `-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
: Set the metadata field *KEY* to the value *VAL*. A value specified : Set the metadata field *KEY* to the value *VAL*. A value specified
on the command line overrides a value specified in the document. on the command line overrides a value specified in the document
using [YAML metadata blocks][Extension:`yaml_metadata_block`].
Values will be parsed as YAML boolean or string values. If no value is Values will be parsed as YAML boolean or string values. If no value is
specified, the value will be treated as Boolean true. Like specified, the value will be treated as Boolean true. Like
`--variable`, `--metadata` causes template variables to be set. `--variable`, `--metadata` causes template variables to be set.
But unlike `--variable`, `--metadata` affects the metadata of the But unlike `--variable`, `--metadata` affects the metadata of the
underlying document (which is accessible from filters and may be underlying document (which is accessible from filters and may be
printed in some output formats). printed in some output formats) and metadata values will be escaped
when inserted into the template.
`-p`, `--preserve-tabs` `-p`, `--preserve-tabs`
@ -1266,23 +1268,22 @@ directory (see `--data-dir`, above). *Exceptions:*
- For `pdf` output, customize the `default.latex` template - For `pdf` output, customize the `default.latex` template
(or the `default.context` template, if you use `-t context`, (or the `default.context` template, if you use `-t context`,
or the `default.ms` template, if you use `-t ms`, or the or the `default.ms` template, if you use `-t ms`, or the
`default.html5` template, if you use `-t html5`). `default.html` template, if you use `-t html`).
- `docx` has no template (however, you can use - `docx` has no template (however, you can use
`--reference-doc` to customize the output). `--reference-doc` to customize the output).
Templates contain *variables*, which allow for the inclusion of Templates contain *variables*, which allow for the inclusion of
arbitrary information at any point in the file. Variables may be set arbitrary information at any point in the file. They may be set at the
within the document using [YAML metadata blocks][Extension: command line using the `-V/--variable` option. If a variable is not set,
`yaml_metadata_block`]. They may also be set at the pandoc will look for the key in the document's metadata which can be set
command line using the `-V/--variable` option: variables set in this using either [YAML metadata blocks][Extension:`yaml_metadata_block`]
way override metadata fields with the same name. or with the `--metadata` option.
Variables set by pandoc Variables set by pandoc
----------------------- -----------------------
Some variables are set automatically by pandoc. These vary somewhat Some variables are set automatically by pandoc. These vary somewhat
depending on the output format, but include metadata fields as well depending on the output format, but include the following:
as the following:
`sourcefile`, `outputfile` `sourcefile`, `outputfile`
: source and destination filenames, as given on the command line. : source and destination filenames, as given on the command line.