-------- Forwarded Message --------
Subject: Re: [NTG-context] expansion and variables
Date: Wed, 17 Jul 2024 23:10:23 +0200
From: Hans Hagen <j.ha...@xs4all.nl>
To: Henning Hraban Ramm <te...@fiee.net>

On 7/17/2024 10:40 PM, Henning Hraban Ramm wrote:
Something’s wrong with my code.
I’ll try to keep a status to output a certain marker only the first time after a change. With the code below I get it never.

I guess it’s an expansion problem again, but I didn’t find the right places for \expanded – if I use it in front of every \getvariable, I get the output every time.

Please help…
Hraban

\setevariable


\setvariable{Thing}{Status}{1}
\setvariable{Thing}{PreviousStatus}{0}

\define[1]\startThing{
   \setvariable{Thing}{PreviousStatus}{\getvariable{Thing}{Status}}
   \setvariable{Thing}{Status}{#1}
   <<< %

\doifnot{\getvariable{Thing}{Status}}{\getvariable{Thing}{PreviousStatus}}{%
     \bold{\getvariable{Thing}{Status}}%
   }%
}

\def\stopThing{>>>\par}

\starttext

\startThing{A} a \stopThing
\startThing{B} b \stopThing
\startThing{A} c \stopThing
\startThing{C} d \stopThing
\startThing{C} e \stopThing
\startThing{A} f \stopThing
\startThing{A} g \stopThing
\startThing{A} h \stopThing

\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

--

-----------------------------------------------------------------
                                          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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to