|
1 | 1 | # include-meta
|
2 | 2 |
|
3 |
| -This filter adds the meta-data from one or more external YAML files to |
| 3 | +This filter adds the meta-data from one or more external YAML files to |
4 | 4 | the metadata of the document.
|
5 | 5 |
|
6 |
| -This allows defining frequently needed sets of meta-data in external files |
7 |
| -and reusing them. |
| 6 | +This allows defining frequently needed sets of meta-data in external |
| 7 | +files and reusing them. |
8 | 8 |
|
9 |
| -In contrast to the `--metadata-file` option of Pandoc, this filter allows specifying the set(s) of meta-data in the actual document header, which is |
10 |
| -more transparent than e.g. hiding them in a make script. |
| 9 | +In contrast to the `--metadata-file` option of Pandoc, this filter |
| 10 | +allows specifying the set(s) of meta-data in the actual document |
| 11 | +header, which is more transparent than e.g. hiding them in a make |
| 12 | +script. |
11 | 13 |
|
12 | 14 | ## Specifying a YAML File to be included
|
13 | 15 |
|
14 |
| -Simply add the `include-meta` directive to the document header, like so: |
| 16 | +Simply add the `include-meta` directive to the document header, like |
| 17 | +so: |
15 | 18 |
|
16 | 19 | ---
|
17 |
| - title: My document |
18 |
| - author: Joe Doe |
19 |
| - include-meta: defaults.yaml |
| 20 | + title: My document author: Joe Doe include-meta: defaults.yaml |
20 | 21 | ...
|
21 | 22 |
|
22 | 23 | Multiple files can be specified by using a list:
|
23 | 24 |
|
24 | 25 | ---
|
25 |
| - title: My document |
26 |
| - author: Joe Doe |
27 |
| - include-meta: |
| 26 | + title: My document author: Joe Doe include-meta: |
28 | 27 | - defaults.yaml
|
29 | 28 | - moredefaults.yaml
|
30 | 29 | ...
|
31 | 30 |
|
32 | 31 | ## Priority Rules
|
33 | 32 |
|
34 |
| -The metadata from the external YAML files will be processed in the order of (1) the statements in the document's YAML header block and (2) the position of the file in the list. |
| 33 | +The metadata from the external YAML files will be processed in the |
| 34 | +order of (1) the statements in the document's YAML header block and |
| 35 | +(2) the position of the file in the list. |
35 | 36 |
|
36 | 37 | ---
|
37 |
| - title: My document |
38 |
| - author: Joe Doe |
39 |
| - include-meta: |
| 38 | + title: My document author: Joe Doe include-meta: |
40 | 39 | - first.yaml
|
41 |
| - - second.yaml |
42 |
| - include-meta: third.yaml |
43 |
| - include-meta: |
| 40 | + - second.yaml include-meta: third.yaml include-meta: |
44 | 41 | - fourth.yaml
|
45 |
| - - fifth.yaml |
46 |
| - header-includes: |
| 42 | + - fifth.yaml header-includes: |
47 | 43 | - \setbeamertemplate{footline}[page number]
|
48 | 44 | ...
|
49 | 45 |
|
50 |
| -The **metadata in the YAML header of the document** is processed **at the very end** (i.e. with the highest priority). |
| 46 | +The **metadata in the YAML header of the document** is processed **at |
| 47 | +the very end** (i.e. with the highest priority). |
51 | 48 |
|
52 |
| -The metadata from all referenced YAML files and the YAML header in the document **is combined as follows:** |
| 49 | +The metadata from all referenced YAML files and the YAML header in the |
| 50 | +document **is combined as follows:** |
53 | 51 |
|
54 | 52 | - duplicates are ignored,
|
55 |
| -- `title` and `date` are replaced by the value in the source with the highest priority (the document or the last YAML file in the list), |
56 |
| -- `author`, `header-includes` and `bibliography` values are joined into a combined list, and |
57 |
| -- values from all other properties are taken from the source with the highest priority (e.g. set according to the YAML in the document). |
| 53 | +- `title` and `date` are replaced by the value in the source with the |
| 54 | + highest priority (the document or the last YAML file in the list), |
| 55 | +- `author`, `header-includes` and `bibliography` values are joined |
| 56 | + into a combined list, and |
| 57 | +- values from all other properties are taken from the source with the |
| 58 | + highest priority (e.g. set according to the YAML in the document). |
58 | 59 |
|
59 |
| -For instance, if you specify one author in the the first YAML and another one in the second, the final meta-data will be a list of both. The order of the list will represent the order of the processing (see above). |
| 60 | +For instance, if you specify one author in the the first YAML and |
| 61 | +another one in the second, the final meta-data will be a list of |
| 62 | +both. The order of the list will represent the order of the |
| 63 | +processing (see above). |
60 | 64 |
|
61 |
| -**Note:** The merging rules and code are based on a [Github Issue discussion](https://github.com/jgm/pandoc/issues/3115#issuecomment-294506221). |
| 65 | +**Note:** The merging rules and code are based on a [Github Issue |
| 66 | + discussion] |
| 67 | + (https://github.com/jgm/pandoc/issues/3115#issuecomment-294506221). |
62 | 68 |
|
63 |
| -The exact relationship between metadata from the document and the sum of the external YAML files is still evolving. I might add a mechanism for specifying the priority of e.g. the document settings. |
| 69 | +The exact relationship between metadata from the document and the sum |
| 70 | +of the external YAML files is still evolving. I might add a mechanism |
| 71 | +for specifying the priority of e.g. the document settings. |
64 | 72 |
|
65 | 73 |
|
66 | 74 | ## Work in Progress
|
67 | 75 |
|
68 |
| -This filter is work in progress. |
| 76 | +This filter is work in progress. Known limitations are as follows: |
| 77 | + |
| 78 | +1. The joining of properties like `author`, `header-includes` and `bibliography` works only for the first two levels of YAML data structures. This should suffice for most cases but could cause problems if the merge mode "extendlist" is applied to additional properties. |
| 79 | + |
| 80 | +2. At the moment, only relative or absolute paths can be used, but not such including environment variables, like `$MY_CONFIG/defaults.yaml`. |
| 81 | + |
| 82 | +3. The combination of boolean values that default as true for RevealJS will require that the last statement uses `0` instead of `false`. For more information, [see here](https://pandoc.org/MANUAL.html#variables-for-html-slides). |
| 83 | + |
69 | 84 |
|
0 commit comments