On 4-6-2011 12:14, Peter Münster wrote:
On Fri, Jun 03 2011, Thomas A. Schmitz wrote:
Ah, expdoifelse is for "expanded doifelse," right? Any examples for such a lua helper? Sounds good, but I still haven't been able to understand how to mix xml and lua code.
\startluacode function my_externalfigure(file, t) local args_present for k, v in pairs(t) do if v == "" then t[k] = nil else args_present = true end end context.externalfigure({file}, args_present and t) end \stopluacode
\startxmlsetups xml:externalfigure \ctxlua{my_externalfigure("\xmlatt{#1}{resource}", {width = "\xmlatt{#1}{width}", height = "\xmlatt{#1}{height}"})} \stopxmlsetups
My first idea was "\expanded{\externalfigure[...][\doif...]}" but it does not work...
you can consider passing #1 and using lxml.att at the lua end or go even further and pop in your own finalizer ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------