ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* setup parameter problem
@ 2021-06-07 16:17 Hans van der Meer
  2021-06-07 17:15 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Hans van der Meer @ 2021-06-07 16:17 UTC (permalink / raw)
  To: NTG ConTeXt


[-- Attachment #1.1: Type: text/plain, Size: 611 bytes --]

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


dr. Hans van der Meer



[-- Attachment #1.2: Type: text/html, Size: 3091 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: setup parameter problem
  2021-06-07 16:17 setup parameter problem Hans van der Meer
@ 2021-06-07 17:15 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2021-06-07 17:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans van der Meer

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-07 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 16:17 setup parameter problem Hans van der Meer
2021-06-07 17:15 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).