ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Rik Kabel via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: structureuservariable as list
Date: Sat, 25 Feb 2023 11:08:43 +0100	[thread overview]
Message-ID: <4470da87-9710-68ae-110d-a89123b18c2d@xs4all.nl> (raw)
In-Reply-To: <4be6a161-dad4-fa53-72ec-3cd1418d9abf@rik.users.panix.com>

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	other threads:[~2023-02-25 10:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 21:32 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 [this message]
2023-02-25 14:29     ` Alex Leray via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4470da87-9710-68ae-110d-a89123b18c2d@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).