ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Passing and retrieveing a variable
@ 2011-01-05 19:22 Procházka Lukáš
  2011-01-05 20:11 ` Peter Münster
  2011-01-05 20:41 ` Wolfgang Schuster
  0 siblings, 2 replies; 10+ messages in thread
From: Procházka Lukáš @ 2011-01-05 19:22 UTC (permalink / raw)
  To: ConTeXt

Hello,

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:

---
\starttext
   Hello

   \doifmode{MyMode}{Being in MyMode}

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

   \startluacode
     if context.variables.MyVariable == "AAA" then
       context("MyVariable is defined.") -- Something like this
     end
   \stopluacode
\stoptext
---

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

How to handle this?

Best regards,

Lukas


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-09 21:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05 19:22 Passing and retrieveing a variable Procházka Lukáš
2011-01-05 20:11 ` Peter Münster
2011-01-07  8:32   ` Procházka Lukáš Ing. - Pontex s. r. o.
2011-01-07  8:48     ` luigi scarso
2011-01-07  9:15     ` Peter Münster
2011-01-07 21:58     ` Hans Hagen
2011-01-08 18:12       ` Procházka Lukáš
2011-01-09 21:03         ` Hans Hagen
2011-01-05 20:41 ` Wolfgang Schuster
2011-01-06  7:39   ` Procházka Lukáš Ing. - Pontex s. r. o.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).