On 6/7/2021 6:17 PM, Hans van der Meer wrote:
The code below seems ok in \startsection[title=] but not when I program
the parameter collection with \def\setupparameters{\getparameters[prefix]}
In that case even [title={enclosed value}] crashes with error message:
Use of \doMacro doesn't match its definition.
Obviously I am missing something here. What?
\def\Macro{\dosingleargument\doMacro}
\def\doMacro[#1]#2{#1X#2}
The code below shows that it should be possible.
\startsection[title=\Macro{arg} no braces needed]\stopsection
\startsection[title={\Macro[arg1]{arg2} enclosed in braces}]\stopsection
\stoptext
just prevent expansion:
\protected\def\Macro{\dosingleargument\doMacro}
\def\doMacro[#1]#2{#1X#2}
and when you're in adventurous mode (which i know you are) try this:
\protected\tolerant\def\Macro[#1]#;#2%
{\ifparameter#1\or#1:\fi#2}
and when you for some reason do wan tto expand then, as in, do:
\edef\foo{\expand\Macro[arg1]{arg2}}
etc etc
Hans
-
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___