ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] \doifemptyelse issue?
@ 2023-11-13 12:10 Bruce Horrocks
  2023-11-13 16:21 ` [NTG-context] " Pablo Rodriguez via ntg-context
  2023-11-14 10:40 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Bruce Horrocks @ 2023-11-13 12:10 UTC (permalink / raw)
  To: ntg-context mailing list

The following MWE gives "false false" instead of "false true". I'm sure this used to work (18 months or more ago!) as I found it when re-processing an old document.

---start---
\setdataset [DS] [a=aaaa]
\setdataset [DS] [a=]

\starttext

:\datasetvariable{DS}{1}{a}: \crlf
:\datasetvariable{DS}{2}{a}: \crlf

\doifemptyelse{\datasetvariable{DS}{1}{a}}{true}{false}

\doifemptyelse{\datasetvariable{DS}{2}{a}}{true}{false}
  
\stoptext
---end---

ConTeXt  ver: 2023.09.26 18:19 LMTX

There is a work-around using \doiftext instead as that seems to work okay with recalled dataset values but I thought I'd raise it.

—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
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] 4+ messages in thread

* [NTG-context] Re: \doifemptyelse issue?
  2023-11-13 12:10 [NTG-context] \doifemptyelse issue? Bruce Horrocks
@ 2023-11-13 16:21 ` Pablo Rodriguez via ntg-context
  2023-11-14 10:40 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2023-11-13 16:21 UTC (permalink / raw)
  To: ntg-context; +Cc: Pablo Rodriguez

On 11/13/23 13:10, Bruce Horrocks wrote:
> The following MWE gives "false false" instead of "false true". I'm
> sure this used to work (18 months or more ago!) as I found it when
> re-processing an old document.> [...]
> There is a work-around using \doiftext instead as that seems to work
> okay with recalled dataset values but I thought I'd raise it.
Hi Bruce,

some time ago Wolfgang explained
(https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/message/7OO5P34S56RGR5G3K7LXS6DTZWAJGUDZ/):

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

I don’t know whether is what is preveiting your test here, but
\doifnothingelse seems to work fine with your sample.

Just in case it might help,

Pablo
___________________________________________________________________________________
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] 4+ messages in thread

* [NTG-context] Re: \doifemptyelse issue?
  2023-11-13 12:10 [NTG-context] \doifemptyelse issue? Bruce Horrocks
  2023-11-13 16:21 ` [NTG-context] " Pablo Rodriguez via ntg-context
@ 2023-11-14 10:40 ` Hans Hagen
  2023-11-14 18:02   ` Bruce Horrocks
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2023-11-14 10:40 UTC (permalink / raw)
  To: Bruce Horrocks, mailing list for ConTeXt users

On 11/13/2023 1:10 PM, Bruce Horrocks wrote:
> The following MWE gives "false false" instead of "false true". I'm sure this used to work (18 months or more ago!) as I found it when re-processing an old document.

because it's not empty (it's a command that you pass)

> ---start---
> \setdataset [DS] [a=aaaa]
> \setdataset [DS] [a=]
> 
> \starttext
> 
> :\datasetvariable{DS}{1}{a}: \crlf
> :\datasetvariable{DS}{2}{a}: \crlf
> 
> \doifemptyelse{\datasetvariable{DS}{1}{a}}{true}{false}
> 
> \doifemptyelse{\datasetvariable{DS}{2}{a}}{true}{false}
>    
> \stoptext
> ---end---
> 
> ConTeXt  ver: 2023.09.26 18:19 LMTX
> 
> There is a work-around using \doiftext instead as that seems to work okay with recalled dataset values but I thought I'd raise it.
for that we have:

\doifsomethingelse

Hans

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: \doifemptyelse issue?
  2023-11-14 10:40 ` Hans Hagen
@ 2023-11-14 18:02   ` Bruce Horrocks
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Horrocks @ 2023-11-14 18:02 UTC (permalink / raw)
  To: ntg-context mailing list



> On 14 Nov 2023, at 10:40, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
> On 11/13/2023 1:10 PM, Bruce Horrocks wrote:
>> The following MWE gives "false false" instead of "false true". I'm sure this used to work (18 months or more ago!) as I found it when re-processing an old document.
> 
> because it's not empty (it's a command that you pass)
> 
>> ---start---
>> \setdataset [DS] [a=aaaa]
>> \setdataset [DS] [a=]
>> \starttext
>> :\datasetvariable{DS}{1}{a}: \crlf
>> :\datasetvariable{DS}{2}{a}: \crlf
>> \doifemptyelse{\datasetvariable{DS}{1}{a}}{true}{false}
>> \doifemptyelse{\datasetvariable{DS}{2}{a}}{true}{false}
>>   \stoptext
>> ---end---
>> ConTeXt  ver: 2023.09.26 18:19 LMTX
>> There is a work-around using \doiftext instead as that seems to work okay with recalled dataset values but I thought I'd raise it.
> for that we have:
> 
> \doifsomethingelse
> 

Thank-you for this. I've realised now that this isn't actually my problem (and that why it worked in the past was probably becuase that part of the 'if' was never taken!).

I'll start another thread.

—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2023-11-14 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 12:10 [NTG-context] \doifemptyelse issue? Bruce Horrocks
2023-11-13 16:21 ` [NTG-context] " Pablo Rodriguez via ntg-context
2023-11-14 10:40 ` Hans Hagen
2023-11-14 18:02   ` Bruce Horrocks

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