Hi, there are two macros I miss there (for the moment) in ConTeXt 1. \startprocesscommacommand/\stopprocesscommacommand equivalent to \startprocesscommalist/\stopprocesscommalist from cont-new.tex 2. A command to access the keys and labels of a assignment list at user level, e.g. \def\myassignmentlist[#1]% {\def\dosomethingwithkeyandvalue##1##2##3{... ##2 ... ##3}% ##1 = namespace (not used here) \dogetparameter\dosomethingwithkeyandvalue[...][#1]} \myassignmentlist[..,..=..,..=..] Wolfgang
Wolfgang Schuster wrote:
Hi,
there are two macros I miss there (for the moment) in ConTeXt
1. \startprocesscommacommand/\stopprocesscommacommand equivalent to \startprocesscommalist/\stopprocesscommalist from cont-new.tex
ok, i added that one and moved this code to syst modules
2. A command to access the keys and labels of a assignment list at user level, e.g.
\def\myassignmentlist[#1]% {\def\dosomethingwithkeyandvalue##1##2##3{... ##2 ... ##3}% ##1 = namespace (not used here) \dogetparameter\dosomethingwithkeyandvalue[...][#1]}
\myassignmentlist[..,..=..,..=..]
is this the best name? maybe \getmyparameters[a=1,b=]\handler (or \getmyparameters\handler [a=1,b=]) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 19.07.2009 um 13:09 schrieb Hans Hagen:
2. A command to access the keys and labels of a assignment list at user level, e.g. \def\myassignmentlist[#1]% {\def\dosomethingwithkeyandvalue##1##2##3{... ##2 ... ##3}% ##1 = namespace (not used here) \dogetparameter\dosomethingwithkeyandvalue[...][#1]} \myassignmentlist[..,..=..,..=..]
is this the best name? maybe
\getmyparameters[a=1,b=]\handler
(or \getmyparameters\handler [a=1,b=])
This was only a example where I needed a command name but I don't know if I really need such a function, I rewrote my macro now and \getparameter seems to be sufficient. Wolfgang
Am 19.07.2009 um 13:09 schrieb Hans Hagen:
2. A command to access the keys and labels of a assignment list at user level, e.g. \def\myassignmentlist[#1]% {\def\dosomethingwithkeyandvalue##1##2##3{... ##2 ... ##3}% ##1 = namespace (not used here) \dogetparameter\dosomethingwithkeyandvalue[...][#1]} \myassignmentlist[..,..=..,..=..]
is this the best name? maybe
\getmyparameters[a=1,b=]\handler
Looks good but in the form \processassignmentlist[a=1,b=2,...]\docommand and (as equivalent to \processcommacommand) \processassignmentcommand[\mylist]\docommand where \docommand is defined as \def\docommand#1#2{...} % #1 = key, #2 = value Wolfgang
Wolfgang Schuster wrote:
Am 19.07.2009 um 13:09 schrieb Hans Hagen:
2. A command to access the keys and labels of a assignment list at user level, e.g. \def\myassignmentlist[#1]% {\def\dosomethingwithkeyandvalue##1##2##3{... ##2 ... ##3}% ##1 = namespace (not used here) \dogetparameter\dosomethingwithkeyandvalue[...][#1]} \myassignmentlist[..,..=..,..=..]
is this the best name? maybe
\getmyparameters[a=1,b=]\handler
Looks good but in the form
\processassignmentlist[a=1,b=2,...]\docommand
and (as equivalent to \processcommacommand)
\processassignmentcommand[\mylist]\docommand
where \docommand is defined as
\def\docommand#1#2{...} % #1 = key, #2 = value
i added \def\processassignmentlist[#1]#2% #2 == \command{key}{value] {\def\doprocessassignmententry##1{#2}% {##2}{##3} % namespace is ignored \dogetparameters\doprocessassignmententry[][#1]} \def\processassignmentcommand[#1]% {\normalexpanded{\noexpand\processassignmentlist[][#1]}} test case: \def\showpair#1#2{key:#1, value:#2\par} \processassignmentlist[a=1,b=2]\showpair ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Wolfgang Schuster