[NTG-context] Problem with \writebetweenlist
Hans Hagen
pragma at wxs.nl
Sun Feb 26 17:28:47 CET 2012
On 25-2-2012 17:52, Wolfgang Schuster wrote:
>
> Am 25.02.2012 um 12:02 schrieb Jaroslav Hajtmar:
>
>> Thanx Wolfgang
>> for reply, but it does not work still.
>
> I was in a hurry and had no time to test it but the following is tested and works.
>
> \def\strc_lists_write_between[#tag][#settings]#command% we can overload location
> {\begingroup
> \edef\currentlist{#tag}%
> \doifelse{\namedlistparameter{#tag}\c!state}\v!start
> {\strc_lists_inject_yes[#settings,\c!type=\s!command][command={#command}]}
> {\endgroup}}
>
> \def\strc_lists_write_to_yes[#settings]#first#second%
> {\strc_lists_inject_yes[\c!location=\v!here,#settings,\c!type=\s!simple][first={#first},second={#second}]}
>
> @Hans The “\s!” prefix for first, second and command can’t be used because otherwise the keys end up as “\\s!first ” in Lua table index.
ok, but another one needed fixing as well, so now we have
\unexpanded\def\writebetweenlist{\dodoubleempty \strc_lists_write_between}
\unexpanded\def\writedatatolist {\dotripleargument\strc_lists_write_data_to}
\unexpanded\def\writetolist {\dodoubleempty \strc_lists_write_to}
\def\strc_lists_write_between[#tag]%
{\begingroup
\edef\currentlist{#tag}%
\doifelse{\namedlistparameter{#tag}\c!state}\v!start
\strc_lists_write_between_yes
\strc_lists_write_between_nop}
\def\strc_lists_write_between_yes[#settings]#command%
{\strc_lists_inject_yes[#settings,\c!type=\s!command][command={#command}]}
\def\strc_lists_write_between_nop[#settings]#command%
{\endgroup}
\def\strc_lists_write_data_to[#tag]%
{\begingroup
\edef\currentlist{#tag}%
\doifelse{\namedlistparameter{#tag}\c!state}\v!start
\strc_lists_write_data_to_yes
\strc_lists_write_data_to_nop}
\def\strc_lists_write_data_to_yes[#settings][#userdata]%
{\ifthirdargument % no need to have an extra step ... used seldom
\strc_lists_inject_yes[#settings,\c!type=\s!userdata][#userdata]%
\else
\strc_lists_inject_yes[\c!type=\s!userdata][#settings]%
\fi}
\def\strc_lists_write_data_to_nop[#settings][#userdata]%
{\endgroup}
\def\strc_lists_write_to[#tag]%
{\begingroup
\edef\currentlist{#tag}%
\doifelse{\namedlistparameter{#tag}\c!state}\v!start
\strc_lists_write_to_yes
\strc_lists_write_to_nop}
\def\strc_lists_write_to_yes[#settings]#first#second% no \s!first
because we don't expand user settings
{\strc_lists_inject_yes[\c!location=\v!here,#settings,\c!type=\s!simple][first={#first},second={#second}]}
\def\strc_lists_write_to_nop[#settings]#first#second%
{\endgroup}
-----------------------------------------------------------------
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
-----------------------------------------------------------------
More information about the ntg-context
mailing list