ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* parsing multi-valued parameters
@ 2021-02-12  7:26 Werner Hennrich
  2021-02-12  7:37 ` Henning Hraban Ramm
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Werner Hennrich @ 2021-02-12  7:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello everyone,

please can you give me pointers on how to easiest parse multi-valued
\dummyparameter{...} like in

\something[...,weather={sunshine, rain, hail},...]

so that I can test for e.g.  rain, sunshine, wind, hail, mist, fog,
storm etc, each if it is present or not?

...so I can keep my number of parameters down and my parameter list as
simple as possible.

I have no idea what to search for in the docs or (better) in the test
cases / samples.
Would be great if you could just let me know where to look or what to
sarch for

Thank you very much!
Werner


___________________________________________________________________________________
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] 6+ messages in thread

* Re: parsing multi-valued parameters
  2021-02-12  7:26 parsing multi-valued parameters Werner Hennrich
@ 2021-02-12  7:37 ` Henning Hraban Ramm
  2021-02-12  8:01 ` Hans Hagen
  2021-02-12 11:53 ` Wolfgang Schuster
  2 siblings, 0 replies; 6+ messages in thread
From: Henning Hraban Ramm @ 2021-02-12  7:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 12.02.2021 um 08:26 schrieb Werner Hennrich <wehe@gmx.at>:
> 
> Hello everyone,
> 
> please can you give me pointers on how to easiest parse multi-valued
> \dummyparameter{...} like in
> 
> \something[...,weather={sunshine, rain, hail},...]
> 
> so that I can test for e.g.  rain, sunshine, wind, hail, mist, fog,
> storm etc, each if it is present or not?
> 
> ...so I can keep my number of parameters down and my parameter list as
> simple as possible.
> 
> I have no idea what to search for in the docs or (better) in the test
> cases / samples.
> Would be great if you could just let me know where to look or what to
> sarch for

Can’t do that myself, but here are some pointers:
https://wiki.contextgarden.net/Inside_ConTeXt

e.g. "Commands with optional arguments" and "Processing lists"

Hraban
___________________________________________________________________________________
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] 6+ messages in thread

* Re: parsing multi-valued parameters
  2021-02-12  7:26 parsing multi-valued parameters Werner Hennrich
  2021-02-12  7:37 ` Henning Hraban Ramm
@ 2021-02-12  8:01 ` Hans Hagen
  2021-02-12  8:11   ` Werner Hennrich
  2021-02-12 11:53 ` Wolfgang Schuster
  2 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2021-02-12  8:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Werner Hennrich

On 2/12/2021 8:26 AM, Werner Hennrich wrote:
> Hello everyone,
> 
> please can you give me pointers on how to easiest parse multi-valued
> \dummyparameter{...} like in
> 
> \something[...,weather={sunshine, rain, hail},...]
> 
> so that I can test for e.g.  rain, sunshine, wind, hail, mist, fog,
> storm etc, each if it is present or not?
> 
> ...so I can keep my number of parameters down and my parameter list as
> simple as possible.
> 
> I have no idea what to search for in the docs or (better) in the test
> cases / samples.
> Would be great if you could just let me know where to look or what to
> sarch for
\setvariables[mynamespace][a=1,b=2,c={3,4,5}]

\doifelseinset{4}{\getvariable{mynamespace}{c}}{FOUR}{OEPS}

\setvariables[mynamespace][d={one,two,three,four}]

\doifelseinset{4}{\getvariable{mynamespace}{c}}{FOUR}{OEPS}

\doifelseinset{two}{\getvariable{mynamespace}{d}}{y}{n}

of course when you need millions of (similar) checks you might go for 
another approach but this is still doable (0.02 sec per 10K on my 
machien so less on yours)

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] 6+ messages in thread

* Re: parsing multi-valued parameters
  2021-02-12  8:01 ` Hans Hagen
@ 2021-02-12  8:11   ` Werner Hennrich
  0 siblings, 0 replies; 6+ messages in thread
From: Werner Hennrich @ 2021-02-12  8:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

ahhhh, so easy - thank you Hans!
cheers, Werner

Am 12.02.21 um 09:01 schrieb Hans Hagen:
> On 2/12/2021 8:26 AM, Werner Hennrich wrote:
>> Hello everyone,
>>
>> please can you give me pointers on how to easiest parse multi-valued
>> \dummyparameter{...} like in
>>
>> \something[...,weather={sunshine, rain, hail},...]
>>
>> so that I can test for e.g.  rain, sunshine, wind, hail, mist, fog,
>> storm etc, each if it is present or not?
>>
>> ...so I can keep my number of parameters down and my parameter list as
>> simple as possible.
>>
>> I have no idea what to search for in the docs or (better) in the test
>> cases / samples.
>> Would be great if you could just let me know where to look or what to
>> sarch for
> \setvariables[mynamespace][a=1,b=2,c={3,4,5}]
>
> \doifelseinset{4}{\getvariable{mynamespace}{c}}{FOUR}{OEPS}
>
> \setvariables[mynamespace][d={one,two,three,four}]
>
> \doifelseinset{4}{\getvariable{mynamespace}{c}}{FOUR}{OEPS}
>
> \doifelseinset{two}{\getvariable{mynamespace}{d}}{y}{n}
>
> of course when you need millions of (similar) checks you might go for
> another approach but this is still doable (0.02 sec per 10K on my
> machien so less on yours)
>
> 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] 6+ messages in thread

* Re: parsing multi-valued parameters
  2021-02-12  7:26 parsing multi-valued parameters Werner Hennrich
  2021-02-12  7:37 ` Henning Hraban Ramm
  2021-02-12  8:01 ` Hans Hagen
@ 2021-02-12 11:53 ` Wolfgang Schuster
  2021-02-13 18:44   ` Werner Hennrich
  2 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2021-02-12 11:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Werner Hennrich schrieb am 12.02.2021 um 08:26:
> Hello everyone,
> 
> please can you give me pointers on how to easiest parse multi-valued
> \dummyparameter{...} like in
> 
> \something[...,weather={sunshine, rain, hail},...]
> 
> so that I can test for e.g.  rain, sunshine, wind, hail, mist, fog,
> storm etc, each if it is present or not?
> 
> ...so I can keep my number of parameters down and my parameter list as
> simple as possible.
> 
> I have no idea what to search for in the docs or (better) in the test
> cases / samples.
> Would be great if you could just let me know where to look or what to
> sarch for


\starttext

\def\something[#1]%
   {\getdummyparameters[weather=,#1]%
    \processallactionsinset
      [\dummyparameter{weather}]
      [sunshine=>Sunshine\endgraf,
           rain=>Rain\endgraf,
           hail=>Hail\endgraf]}

\something[weather=sunshine]

\blank

\something[weather={sunshine,rain}]

\stoptext

Wolfgang
___________________________________________________________________________________
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] 6+ messages in thread

* Re: parsing multi-valued parameters
  2021-02-12 11:53 ` Wolfgang Schuster
@ 2021-02-13 18:44   ` Werner Hennrich
  0 siblings, 0 replies; 6+ messages in thread
From: Werner Hennrich @ 2021-02-13 18:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

quite nifty, I'll add that to my bag... thank you Wolfgang!

cheers, Werner


Am 12.02.21 um 12:53 schrieb Wolfgang Schuster:
> Werner Hennrich schrieb am 12.02.2021 um 08:26:
>> Hello everyone,
>>
>> please can you give me pointers on how to easiest parse multi-valued
>> \dummyparameter{...} like in
>>
>> \something[...,weather={sunshine, rain, hail},...]
>>
>> so that I can test for e.g.  rain, sunshine, wind, hail, mist, fog,
>> storm etc, each if it is present or not?
>>
>> ...so I can keep my number of parameters down and my parameter list as
>> simple as possible.
>>
>> I have no idea what to search for in the docs or (better) in the test
>> cases / samples.
>> Would be great if you could just let me know where to look or what to
>> sarch for
>
>
> \starttext
>
> \def\something[#1]%
>   {\getdummyparameters[weather=,#1]%
>    \processallactionsinset
>      [\dummyparameter{weather}]
>      [sunshine=>Sunshine\endgraf,
>           rain=>Rain\endgraf,
>           hail=>Hail\endgraf]}
>
> \something[weather=sunshine]
>
> \blank
>
> \something[weather={sunshine,rain}]
>
> \stoptext
>
> Wolfgang


___________________________________________________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2021-02-13 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12  7:26 parsing multi-valued parameters Werner Hennrich
2021-02-12  7:37 ` Henning Hraban Ramm
2021-02-12  8:01 ` Hans Hagen
2021-02-12  8:11   ` Werner Hennrich
2021-02-12 11:53 ` Wolfgang Schuster
2021-02-13 18:44   ` Werner Hennrich

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).