ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
Subject: getvariable
Date: Wed, 5 Oct 2005 23:12:06 +0200	[thread overview]
Message-ID: <BA3E5B66-D93E-497A-A241-40DBF13A7EC6@uni-bonn.de> (raw)

I thought I had understood at least some aspects of macros, but it  
turns out I'm as lost as always. Here's my problem:
I'm writing a module which will have a \setupcommand. The value is  
given in a [key=pair] list, so I thought I could use \getvariable.  
What I have is

\def\setupcommand{\setvariables[namespace]} % setting up the namespace
\setvariables[namespace][key=value,otherkey=value] % initializing the  
keys

% And now I want to wrap my values up in a conditional statement:
\doifelse{\getvariable{namespace}{key}}{value}
    {do something}
    {do something else}

When I put the \doifelse statement into my source files, the test  
works; the key is assigned the value that is in the setupcommand. But  
this doesn't work at runtime: either \getvariable{namespace}{key}  
always has the value I assign in the line \setvariables[namespace] 
[key=value,otherkey=value], or if I comment out that line, the  
variable is empty. I can see why this is the case: the setupcommand  
is read AFTER the module, so at runtime, the variable is not assigned  
yet. So my approach seems fundamentally flawed. What could I do instead?

Thanks for your help

Thomas

             reply	other threads:[~2005-10-05 21:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05 21:12 Thomas A. Schmitz [this message]
2005-10-06  7:31 ` getvariable Hans Hagen
2005-10-06  8:53   ` getvariable Thomas A. Schmitz
2005-10-06 10:01     ` getvariable Peter Rolf
2005-10-06 11:06       ` getvariable Thomas A. Schmitz
2005-10-06 12:45         ` getvariable Peter Rolf
2005-10-06 15:08           ` getvariable Thomas A. Schmitz
2005-10-06 20:08             ` getvariable Peter Rolf
2005-10-06 21:11               ` getvariable Thomas A. Schmitz
2005-10-07 10:53                 ` getvariable Peter Rolf
2005-10-06 21:32               ` getvariable Hans Hagen
2005-10-06 21:28       ` getvariable Hans Hagen
2005-10-06 21:27     ` getvariable 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=BA3E5B66-D93E-497A-A241-40DBF13A7EC6@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --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).