On 5/31/2017 4:51 PM, Pablo Rodriguez wrote:
On 05/31/2017 11:03 AM, MF wrote:
if tex.modes['specialmode'] then
     context('I’m special.')
end
Best greetings,
Massi

Hi, this should be easy:

How can I access ConTeXt’s modes in Lua? Is it any different with
language modes (*en)?

This is the way to detect system modes, but I don’t know how to do it
for \mainlanguage (**en).

     \mainlanguage[es]
     \starttext
     \en\startlua
     if tex.systemmodes['en'] then
         context('Language is English.')
     else
         context('Language is not English.')
     end
     context('\\par')
     if tex.modes['es'] then
         context('Main language is Spanish.')
     else
         context('Main language is not Spanish.')
     end
     \stoplua
     \stoptext

Just in case it help,
tex.modes['*en']
tex.modes['**en']

tex.systemmodes['en']
tex.systemmodes['*en']

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to