* structureuservariable as list @ 2023-02-24 21:32 Alex Leray via ntg-context 2023-02-24 22:37 ` Rik Kabel via ntg-context 0 siblings, 1 reply; 4+ messages in thread From: Alex Leray via ntg-context @ 2023-02-24 21:32 UTC (permalink / raw) To: Jan-Erik Hägglöf via ntg-context; +Cc: Alex Leray Hi, is it possible to pass a list in a variable? I'd like to pass a list of authors: \startchapter[title={Foo Bar}][authors={Alice, Bob}] % PSEUDOCODE % for author in \structureuservariable{authors} % do print(author + '\crlf') % done \stopchapter Thanks ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: structureuservariable as list 2023-02-24 21:32 structureuservariable as list Alex Leray via ntg-context @ 2023-02-24 22:37 ` Rik Kabel via ntg-context 2023-02-25 10:08 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 4+ messages in thread From: Rik Kabel via ntg-context @ 2023-02-24 22:37 UTC (permalink / raw) To: ntg-context; +Cc: Rik Kabel > Hi, > > is it possible to pass a list in a variable? I'd like to pass a list > of authors: > > > \startchapter[title={Foo Bar}][authors={Alice, Bob}] > > % PSEUDOCODE > % for author in \structureuservariable{authors} > % do print(author + '\crlf') > % done > > \stopchapter > > Search the wiki. Look for "Comma Separated Lists." There is a variant with an author list as an example. You may need additional brace levels around the list entries. -- Rik ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: structureuservariable as list 2023-02-24 22:37 ` Rik Kabel via ntg-context @ 2023-02-25 10:08 ` Hans Hagen via ntg-context 2023-02-25 14:29 ` Alex Leray via ntg-context 0 siblings, 1 reply; 4+ messages in thread From: Hans Hagen via ntg-context @ 2023-02-25 10:08 UTC (permalink / raw) To: Rik Kabel via ntg-context; +Cc: Hans Hagen On 2/24/2023 11:37 PM, Rik Kabel via ntg-context wrote: > >> Hi, >> >> is it possible to pass a list in a variable? I'd like to pass a list >> of authors: >> >> >> \startchapter[title={Foo Bar}][authors={Alice, Bob}] >> >> % PSEUDOCODE >> % for author in \structureuservariable{authors} >> % do print(author + '\crlf') >> % done >> >> \stopchapter >> >> > Search the wiki. Look for "Comma Separated Lists." There is a variant > with an author list as an example. > > You may need additional brace levels around the list entries. I'm not sure this is on the wiki ... \starttext \startchapter[title={Foo Bar}][authors={Alice, Bob},AUTHORS={Bob,Alice}] \doloopovermatch {[^, ]+} {\structureuservariable{authors}} { (#1)\crlf } \doloopovermatch {[^,]+} {\structureuservariable{authors}} { (#1)\crlf } \doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}} { (#1)\crlf } \doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}} { \doloopovermatch {.} {#1} { (##1) } \crlf } \stopchapter but feel free to add it. 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 / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: structureuservariable as list 2023-02-25 10:08 ` Hans Hagen via ntg-context @ 2023-02-25 14:29 ` Alex Leray via ntg-context 0 siblings, 0 replies; 4+ messages in thread From: Alex Leray via ntg-context @ 2023-02-25 14:29 UTC (permalink / raw) To: ntg-context; +Cc: Alex Leray Dear both, thanks for your answers. `doloopovermatch` didn't work for me but this below is achieving what I wanted. Have a good day, Alex %%% \def\dosomething#1{(#1)} \def\dosomethingtwo#1{* #1\crlf} \starttext \startchapter[title={Foo Bar}][ authors={Alice,Bob,Charline}, translators={foo,bar,baz} ] {\em authors} \\ \commalistsentence[\structureuservariable{authors}][{ \crlf },{ \crlf }] {\em translators} \\ \processcommacommand[\structureuservariable{translators}]\dosomethingtwo \doloopoverlist {\structureuservariable{translators}} { (#1) \\ } \stopchapter \stoptext %%% Le 25/02/23 à 11:08, Hans Hagen via ntg-context a écrit : > On 2/24/2023 11:37 PM, Rik Kabel via ntg-context wrote: >> >>> Hi, >>> >>> is it possible to pass a list in a variable? I'd like to pass a list >>> of authors: >>> >>> >>> \startchapter[title={Foo Bar}][authors={Alice, Bob}] >>> >>> % PSEUDOCODE >>> % for author in \structureuservariable{authors} >>> % do print(author + '\crlf') >>> % done >>> >>> \stopchapter >>> >>> >> Search the wiki. Look for "Comma Separated Lists." There is a variant >> with an author list as an example. >> >> You may need additional brace levels around the list entries. > I'm not sure this is on the wiki ... > > \starttext > > \startchapter[title={Foo Bar}][authors={Alice, Bob},AUTHORS={Bob,Alice}] > > \doloopovermatch {[^, ]+} {\structureuservariable{authors}} { > (#1)\crlf > } > \doloopovermatch {[^,]+} {\structureuservariable{authors}} { > (#1)\crlf > } > \doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}} { > (#1)\crlf > } > \doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}} { > \doloopovermatch {.} {#1} { > (##1) > } > \crlf > } > > \stopchapter > > but feel free to add it. > > 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 / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > ___________________________________________________________________________________ -- Alexandre Leray +32 487 947 030 Avez-vous pensé à (vous) offrir Médor ? https://medor.coop/ideescadeau ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-25 14:29 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-24 21:32 structureuservariable as list Alex Leray via ntg-context 2023-02-24 22:37 ` Rik Kabel via ntg-context 2023-02-25 10:08 ` Hans Hagen via ntg-context 2023-02-25 14:29 ` Alex Leray via ntg-context
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).