Closed DigitalTravelDuck closed 4 years ago
pandoc-mustache
only accepts pointers to the variables file from a YAML metadata block in the document. But you could customize the metadata block from the command line. Here's a verbose example:
document.md:
The richest American men live {{diff_le_richpoor_men}} years longer than the poorest men,
while the richest American women live {{diff_le_richpoor_women}} years longer than the poorest women.
metadata_one.yaml:
---
mustache: ./le_gaps.yaml
---
metadata_two.yaml:
---
mustache: ./animals.yaml
---
le_gaps.yaml:
diff_le_richpoor_men: "14.6"
diff_le_richpoor_women: "10.1"
animals.yaml:
diff_le_richpoor_men: "zebra"
diff_le_richpoor_women: "giraffe"
Then you can generate two different outputs with:
pandoc metadata_one.yaml document.md --filter pandoc-mustache
pandoc metadata_two.yaml document.md --filter pandoc-mustache
With a carefully constructed shell command, you could also embed the metadata block in metadata_one/metadata_two directly into the command to eliminate the need for those two extra files.
Is it possible to give the vars.yaml file as an argument with - - filter pandoc-mustache? or any other way to use one markdown file and 2 different vars file to generate 2 different pdf's out of it? would be great.