ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Fredrik Sjunnesson" <Fredrik.Sjunnesson@acobiaflux.se>
Subject: Append to a commalist
Date: Thu, 12 Oct 2006 13:38:22 +0200	[thread overview]
Message-ID: <EA7A899A33DA84438358BD72438B4A1B371249@ms1.acobiaflux.ad> (raw)

Hello,

Is there a smart way to create a commalist?

I want to get the equivalent of

\setparameter[namespace][listname={item1,item2,item3}]

but be able to append one item at the time, like

\append{namepace}{listname}{item1}
\append{namepace}{listname}{item2}
\append{namepace}{listname}{item3}

I have tired this:

\def\append#1#2#3{
  \fullexpandoneargafter\doifemptyelse{\getvariable{#1}{#2}}
  {\edef\tmp{#3}}
  {\edef\tmp{\getvariable{#1}{#2},#3}}
  \setvariables[#1][#2={\tmp}]}

but it only works for one list. Apparently \tmp is not expanded so when
an item is appended to one list all other lists are affected. I have
tried \expanded but got the message stack full.

Any help would be greatly appreciated.

/Fredrik
 


--------------------------------
Teknisk projektledare
Ph.D. Complex Systems
AcobiaFLUX AB
fredrik.sjunnesson@acobiaflux.se
Tel: +46 (0) 31 722 48 11
Fax: +46 (0) 31 722 48 01
Mob: +46 (0) 733 27 92 41
www.acobiaflux.se 

             reply	other threads:[~2006-10-12 11:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-12 11:38 Fredrik Sjunnesson [this message]
2006-10-12 13:49 ` Hans Hagen
2006-10-12 15:31   ` Aditya Mahajan
2006-10-12 17:15     ` Hans Hagen
2006-10-12 21:15 Fredrik Sjunnesson
2006-10-12 22:03 ` Hans Hagen

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=EA7A899A33DA84438358BD72438B4A1B371249@ms1.acobiaflux.ad \
    --to=fredrik.sjunnesson@acobiaflux.se \
    --cc=ntg-context@ntg.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).