ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] expansion and variables
@ 2024-07-17 20:40 Henning Hraban Ramm
  0 siblings, 0 replies; only message in thread
From: Henning Hraban Ramm @ 2024-07-17 20:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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



\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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-17 20:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-17 20:40 [NTG-context] expansion and variables Henning Hraban Ramm

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).