* Failing \doifemptyelse
@ 2022-06-23 19:16 Willi Egger via ntg-context
2022-06-23 19:54 ` Wolfgang Schuster via ntg-context
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Willi Egger via ntg-context @ 2022-06-23 19:16 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Willi Egger
Good evening gurus!
Why is the minimal example failing? i.e. executing always the else-branch?
\setuppapersize[A6][A6]
\setvariables
[Test]
[Number=]
\starttext
Value of variable Number before test: \getvariable{Test}{Number} \crlf
\doifemptyelse{\getvariable{Test}{Number}}
{\dorecurse
{5}
{TEST}
}
{Nothing defined \par
Contents of variable Number: \getvariable{Test}{Number}
}
\stoptex
I am using ConTeXt version 2022.05.11 11:36 LMTX fmt: 2022.6.15
Kind regards
Willi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Failing \doifemptyelse
2022-06-23 19:16 Failing \doifemptyelse Willi Egger via ntg-context
@ 2022-06-23 19:54 ` Wolfgang Schuster via ntg-context
2022-06-23 20:59 ` Hans Hagen via ntg-context
2022-06-23 21:00 ` Hans Hagen via ntg-context
2 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2022-06-23 19:54 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Wolfgang Schuster
Willi Egger via ntg-context schrieb am 23.06.2022 um 21:16:
> Good evening gurus!
>
> Why is the minimal example failing? i.e. executing always the else-branch?
\doifempty(else) doesn't expand the argument and any argument counts as
not empty. To satisfy the command you can expand the first argument
(\normalexpanded) or you use \doifnothing(else) which expands the argument.
\starttext
\startbuffer
\doifemptyelse{}{YES}{NO}
\doifemptyelse{\empty}{YES}{NO}
\normalexpanded{\doifemptyelse{}}{YES}{NO}
\normalexpanded{\doifemptyelse{\empty}}{YES}{NO}
\doifnothingelse{}{YES}{NO}
\doifnothingelse{\empty}{YES}{NO}
\stopbuffer
\typebuffer \getbuffer
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Failing \doifemptyelse
2022-06-23 19:16 Failing \doifemptyelse Willi Egger via ntg-context
2022-06-23 19:54 ` Wolfgang Schuster via ntg-context
@ 2022-06-23 20:59 ` Hans Hagen via ntg-context
2022-06-23 21:00 ` Hans Hagen via ntg-context
2 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2022-06-23 20:59 UTC (permalink / raw)
To: Willi Egger via ntg-context; +Cc: Hans Hagen
On 6/23/2022 9:16 PM, Willi Egger via ntg-context wrote:
> Good evening gurus!
>
> Why is the minimal example failing? i.e. executing always the else-branch?
>
> \setuppapersize[A6][A6]
>
> \setvariables
> [Test]
> [Number=]
>
>
> \starttext
> Value of variable Number before test: \getvariable{Test}{Number} \crlf
>
> \doifemptyelse{\getvariable{Test}{Number}}
> {\dorecurse
> {5}
> {TEST}
> }
> {Nothing defined \par
> Contents of variable Number: \getvariable{Test}{Number}
> }
>
> \stoptex
because that one doesn't expand the argument
\doifelsenothing
\doifelsesomething
\doifnothing
\doifsomething
can be used for your purpose
-----------------------------------------------------------------
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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Failing \doifemptyelse
2022-06-23 19:16 Failing \doifemptyelse Willi Egger via ntg-context
2022-06-23 19:54 ` Wolfgang Schuster via ntg-context
2022-06-23 20:59 ` Hans Hagen via ntg-context
@ 2022-06-23 21:00 ` Hans Hagen via ntg-context
2022-06-24 3:42 ` Wolfgang Schuster via ntg-context
2 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2022-06-23 21:00 UTC (permalink / raw)
To: Willi Egger via ntg-context; +Cc: Hans Hagen
On 6/23/2022 9:16 PM, Willi Egger via ntg-context wrote:
> Good evening gurus!
>
> Why is the minimal example failing? i.e. executing always the else-branch?
>
> \setuppapersize[A6][A6]
>
> \setvariables
> [Test]
> [Number=]
>
>
> \starttext
> Value of variable Number before test: \getvariable{Test}{Number} \crlf
>
> \doifemptyelse{\getvariable{Test}{Number}}
> {\dorecurse
> {5}
> {TEST}
> }
> {Nothing defined \par
> Contents of variable Number: \getvariable{Test}{Number}
> }
>
> \stoptex
there's also
\doifelsevariable {Test} {Number}
that can be used
-----------------------------------------------------------------
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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Failing \doifemptyelse
2022-06-23 21:00 ` Hans Hagen via ntg-context
@ 2022-06-24 3:42 ` Wolfgang Schuster via ntg-context
2022-06-24 11:59 ` Willi Egger via ntg-context
0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2022-06-24 3:42 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Wolfgang Schuster
Hans Hagen via ntg-context schrieb am 23.06.2022 um 23:00:
> On 6/23/2022 9:16 PM, Willi Egger via ntg-context wrote:
>> Good evening gurus!
>>
>> Why is the minimal example failing? i.e. executing always the
>> else-branch?
>>
>> \setuppapersize[A6][A6]
>>
>> \setvariables
>> [Test]
>> [Number=]
>>
>>
>> \starttext
>> Value of variable Number before test: \getvariable{Test}{Number}
>> \crlf
>>
>> \doifemptyelse{\getvariable{Test}{Number}}
>> {\dorecurse
>> {5}
>> {TEST}
>> }
>> {Nothing defined \par
>> Contents of variable Number: \getvariable{Test}{Number}
>> }
>>
>> \stoptex
> there's also
>
> \doifelsevariable {Test} {Number}
>
> that can be used
in this case
\doifelseemptyvariable{Test}{Number}{...}{...}
is the better choice
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Failing \doifemptyelse
2022-06-24 3:42 ` Wolfgang Schuster via ntg-context
@ 2022-06-24 11:59 ` Willi Egger via ntg-context
0 siblings, 0 replies; 6+ messages in thread
From: Willi Egger via ntg-context @ 2022-06-24 11:59 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Willi Egger
Hans, Wolfgang!
Thank you so much for your instructions! — This expansion thing is something I will probably never master ;-(
Thank you!
Kind regards
Willi
> On 24 Jun 2022, at 05:42, Wolfgang Schuster via ntg-context <ntg-context@ntg.nl> wrote:
>
> Hans Hagen via ntg-context schrieb am 23.06.2022 um 23:00:
>> On 6/23/2022 9:16 PM, Willi Egger via ntg-context wrote:
>>> Good evening gurus!
>>>
>>> Why is the minimal example failing? i.e. executing always the else-branch?
>>>
>>> \setuppapersize[A6][A6]
>>>
>>> \setvariables
>>> [Test]
>>> [Number=]
>>>
>>>
>>> \starttext
>>> Value of variable Number before test: \getvariable{Test}{Number} \crlf
>>>
>>> \doifemptyelse{\getvariable{Test}{Number}}
>>> {\dorecurse
>>> {5}
>>> {TEST}
>>> }
>>> {Nothing defined \par
>>> Contents of variable Number: \getvariable{Test}{Number}
>>> }
>>>
>>> \stoptex
>> there's also
>>
>> \doifelsevariable {Test} {Number}
>>
>> that can be used
>
> in this case
>
> \doifelseemptyvariable{Test}{Number}{...}{...}
>
> is the better choice
>
> Wolfgang
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-06-24 11:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 19:16 Failing \doifemptyelse Willi Egger via ntg-context
2022-06-23 19:54 ` Wolfgang Schuster via ntg-context
2022-06-23 20:59 ` Hans Hagen via ntg-context
2022-06-23 21:00 ` Hans Hagen via ntg-context
2022-06-24 3:42 ` Wolfgang Schuster via ntg-context
2022-06-24 11:59 ` Willi Egger via ntg-context
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).