msprev / panzer

pandoc + styles
BSD 3-Clause "New" or "Revised" License
159 stars 15 forks source link

[enhancement] Allow metadata field value to be used in styles #49

Closed josineto closed 5 years ago

josineto commented 5 years ago

It would be nice if one could use values from metadata fields in styles definition. For instance, in a document:

---
metadata: work3.yaml
style: MyStyle
---
# My document

And in styles.yaml:

MyStyle:
  all:
    commandline:
      metadata-file: "`$metadata$`" # I suggest $ as it's syntax from Pandoc templates

In this case, panzer would put in command line --metadata-file=work3.yaml (I know this case would also need #48 to completely work).

Is it possible? (In the past I've already faced other situations where this would elegantly solve problems, but unfortunately I can't remember whose situations were those...)

msprev commented 5 years ago

I think I'd need to see a more compelling use case. At the moment, this can be accomplished (along with other simple kinds of abstraction sometimes requested) by writing a small wrapper script around panzer that does the substitution.