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
___________________________________________________________________________________

Reply via email to