lionel-rigoux / pandemic

This project has moved to pandemics.gitlab.io
https://pandemics.gitlab.io
BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

How to add Pandoc variables? #3

Closed paulklemm closed 6 years ago

paulklemm commented 6 years ago

How do you add Pandoc variables, like for example when you want to publish to eisvogel but want to customize the colors or have a title page?

e.g. pandoc manuscript.md -o example.pdf --template eisvogel --variable titlepage=true

I would expect something like pandemic publish --to eisvogel --variable titlepage=true

lionel-rigoux commented 6 years ago

There are two possibilities here. The prefered one is to define a recipe.pdf.json file in your eisvogel recipe folder which will describe the options to pass to pandoc. Typically, your json file will contain something like (using eisvogel doc):

{
  "options":  [
        "-V titlepage=true",
        "-V titlepage-color='D8DE2C'"
  ]
}

Of course, you can create this file manually as ~/.pandemic/recipes/eisvogel/recipe.pdf.json, but then you'll lose the ability to update the recipe from the github repo. You can also fork eisvogel and put the recipe instruction there (and share your MPI-colored adaptation with everyone).

The other possibility would be to follow your syntax (ie passing all trailing options to pandoc) but I didn't release this tweak yet as it I fear it could trigger bad habits (using command line options is less reproducible that recipe.json instructions, and cannot be shared nor versioned).

The mindset of pandemic is to use json files to configure pandoc so all the hassle of tuning pandoc options for your template is taken in charge and your command line call stays minimal.

paulklemm commented 6 years ago

Sounds good to me. Maybe you could add this example to the Readme, would help a lot 👍

lionel-rigoux commented 6 years ago

Point taken! I will rewrite the README with more details.

lionel-rigoux commented 6 years ago

Solved by 363d960183afeca29892d34e39697f2c816dbbb6 (I hope)