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...

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

maillist : [email protected] / 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