On 03/05/2013 11:11 AM, Hans Hagen wrote:
\startluacode
local lookuptable = { }
function xml.functions.lookup(t)
     local mytype  = xml.text(t, "c")
     local myvalue = lookuptable[mytype]
     if not myvalue then
         myvalue = xml.first(t, "d")
         lookuptable[mytype] = myvalue
         context("registered: ")
     else
         context("reused: ")
     end
     -- each found node gets an id
     lxml.flush(lxml.id(myvalue))
     context(" or ")
     -- in tex mode a to-tex serializer is the default
     xml.cprint(myvalue)
end
\stopluacode

One place to look for tricks is in x-mathml.mkiv / lua (I know, I should
finish that manual).

Hans

Beautiful! Thanks a lot, that's just what I needed. And yes, in the medium-to-long run, finishing the manual will save you from being pestered with my questions... :-)

Thomas
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to