lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
911 stars 72 forks source link

Template in yaml does not work, but does when in markdown #361

Closed svenboulanger closed 1 year ago

svenboulanger commented 1 year ago

I was experimenting with the template feature, notably tableTemplate.

This markdown file works:

---
tableTemplate: $$tableTitle$$ $$i$$$$titleDelim$$ $$t$$ This is a test
---

Table: Name {#tbl:table_1}

| A | B |
|---|---|
| 1 | 2 |

pandoc test.md -s --filter pandoc-crossref.exe -o test.docx

But if I try the same thing providing metadata through the yaml file, it doesn't work:

Table: Name {#tbl:table_1}

| A | B |
|---|---|
| 1 | 2 |
standalone: true
metadata:
  tableTemplate: $$tableTitle$$ $$i$$$$titleDelim$$ $$t$$ This is a test
filters:
  - pandoc-crossref.exe

Instead of Table 1: Name This is a test, the result changes to $$tableTitle$$ $$i$$$$titleDelim$$ $$t$$ This is a test.

Note that if I use other variables in the template, like tableTitle, it does work even from the yaml file.

lierdakil commented 1 year ago

Pandoc treats metadata from the defaults file as plaintext. This is a known issue, there are no plans to fix it AFAIK. Use crossrefYaml metadata option to work around that.

svenboulanger commented 1 year ago

Ok thanks, I missed that part in the documentation.