koka-lang / madoko

Madoko is a fast markdown processor for high quality academic and technical articles
Other
393 stars 42 forks source link

Enable overriding of in-document metadata variables by command-line metadata variables #6

Open maelvls opened 7 years ago

maelvls commented 7 years ago

Hi,

First, I want to thank you for your excellent work. Madoko is great!

For now, it is not possible to override an in-document metadata variable using a command-line argument. I think it would be a good thing if we could do so. Here two use-cases to outline this feature idea:

  1. I want to include a version number (git describe --tags) to my document. To do so, I use the argument -mversion:$(git describe --tags) so that the variable &version; becomes available in the document. But I would also like to be able to set Version: N/A in the header so that if I am processing the document without the -mversion argument, I get a default version number. Because the in-document metadata variables are "shadowing" the -mkey:value arguments, it doesn't work.

  2. When I'm writting/editing with madoko-local, I don't want to bother with the installation of the full texlive distribution. Instead, I prefer turning on Math Mode: mathjax. But when compiling the final distributed PDF (this is done by a continuous integration service), I'd like to get the latex-rendered, and thus I would like the 'math-mode' variable to be overridden in some way by Math Mode: static. I first though about using -mmath-mode:static. But command-line arguments are "shadowed" by in-document header metadata flags.

I went through some of the koka code and found out that the command-line -m arguments must be parsed first because they are needed for processing the document (e.g., -mmath-latex:cmd).

I would be pleased to submit a pull request, but I can't find the right place to start hacking (optionsMeta.kk?)

Thank you again for your awesome work!

Maël