Graham Douglas wrote:
> So, I was wondering if anyone has a minimal example they would be
> kind enough to share, or can give me a few pointers/guidelines so that I
> can start experimenting. In particular, I'm interested to call external
> libraries and inject the output from an external library into TeX for
> typesetting. For example, is it possible to load a library once, keep
> it loaded and access the library functions from different commands
> during the TeX run?

Here is a trivial example using LuaExpat:

require "lxp";
text = '<p>hello world</p>'
callbacks = { EndElement = false,
              StartElement = false,
              Default = function (p, s) tex.sprint(s) end }
p = lxp.new(callbacks)

Some xml output: \directlua{p:parse(text)}!.


Disclosure: for this test, I copied lxp.so into the local directory
because I am not sure exactly how context mkiv searches for Lua cpath

Best wishes,

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

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