[NTG-context] Passing and retrieveing a variable

Procházka Lukáš lpr at pontex.cz
Wed Jan 5 20:22:59 CET 2011


I'd need to pass a variable to Ctx and to retrieve it inside a compiled document - via Ctx itself and also by Lua. Something like modes; but modes allow just to check whether they are on or off. I'd need something like this:

Calling context.exe:

call context.exe test.mkiv --mode:MyMode --variable MyVariable=AAA

And test.mkiv:


   \doifmode{MyMode}{Being in MyMode}

   \ifvariableequal{MyVariable}{AAA}{MyVariable is \MyVariable} % Something like this

     if context.variables.MyVariable == "AAA" then
       context("MyVariable is defined.") -- Something like this

Simply said, I'd need to provide a conditional (or: dependent) compilation of the input file.

How to handle this?

Best regards,


More information about the ntg-context mailing list