Re: [NTG-context] xml syntax for \externalfigure

2011-06-04 Thread Thomas A. Schmitz
On Jun 4, 2011, at 12:14 AM, Peter Münster wrote: > \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.externalf

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Hans Hagen
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_external

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Peter Münster
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

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Thomas A. Schmitz
On Jun 3, 2011, at 10:50 PM, Hans Hagen wrote: > On 3-6-2011 10:19, Thomas A. Schmitz wrote: >> >> Hmm, almost... Gives the dreaded "Missing number, treated as zero" error. >> But your "fit" gave me an idea: this works: >> >> [height=\xmlattdef{#1}{height}{fit}] >> >> but only if I have a rea

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Thomas A. Schmitz
On Jun 3, 2011, at 10:19 PM, Thomas A. Schmitz wrote: > Hmm, almost... Gives the dreaded "Missing number, treated as zero" error. But > your "fit" gave me an idea: this works: > > [height=\xmlattdef{#1}{height}{fit}] > > but only if I have a real dimension as in height="5cm". What if I want to

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Hans Hagen
On 3-6-2011 10:19, Thomas A. Schmitz wrote: On Jun 3, 2011, at 9:57 PM, Aditya Mahajan wrote: (untested) \exeternalfigure[...][height=\doifemptyelse{\xmlatt{#1}{height}}{fit}{\xmlatt{#1}{height}}] Aditya Hmm, almost... Gives the dreaded "Missing number, treated as zero" error. But your "f

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Thomas A. Schmitz
On Jun 3, 2011, at 9:57 PM, Aditya Mahajan wrote: > (untested) > > \exeternalfigure[...][height=\doifemptyelse{\xmlatt{#1}{height}}{fit}{\xmlatt{#1}{height}}] > > Aditya Hmm, almost... Gives the dreaded "Missing number, treated as zero" error. But your "fit" gave me an idea: this works: [hei

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Aditya Mahajan
On Fri, 3 Jun 2011, Thomas A. Schmitz wrote: Hi all, I'm pulling my hair - thought this was easy, but turns out to be more difficult. The \externalfigure command can take a width and/or a height parameter, and context will be happy to take either one into account. I'm trying to translate tha

[NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Thomas A. Schmitz
Hi all, I'm pulling my hair - thought this was easy, but turns out to be more difficult. The \externalfigure command can take a width and/or a height parameter, and context will be happy to take either one into account. I'm trying to translate that into xml syntax. Here's a minimal example that