From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>,
Benjamin Buchmuller <benjamin.buchmuller@gmail.com>
Subject: Re: How to check if buffer or block has content
Date: Tue, 3 Aug 2021 14:26:42 +0200 [thread overview]
Message-ID: <3860f380-8e5c-487d-78f6-b9f1c5249c7c@xs4all.nl> (raw)
In-Reply-To: <EB5A0710-CC5A-4B2C-9A69-9B995A1D6C02@gmail.com>
On 8/2/2021 8:54 PM, Benjamin Buchmuller via ntg-context wrote:
> That's great, I wikified a Note for testing if a buffer exists or has content (using the \getbuffer[…] approach for the moment).
>
> If I was asked, I'd opt for \doifelseemptybuffer (doifemptyelse?) since one could think of similar commands that test for empty "objects".
>
> Is there an option for testing blocks? (I actually use blocks quite frequently …)
>
> I just realized they are probably handled very differently during the typesetting. Basically I would just need to test if during the first run any of \beginBLOCK … \endBLOCK was invoked (but if one gets a test for some content in-between that's even better)
indeed, multiple axis ... so then we need three arguments instead of one
for the test
\defineblock[testa]
\defineblock[testb]
\starttext
\begintesta
oeps
\endtesta
\doifelseblocksempty {testa}{}{} {YES} {NOP} % {name}{tag}{criterium}
\doifelseblocksempty {testb}{}{} {YES} {NOP} % {name}{tag}{criterium}
\stoptext
but you have to wikify it
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 / 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
___________________________________________________________________________________
next prev parent reply other threads:[~2021-08-03 12:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1176.1627917453.1143.ntg-context@ntg.nl>
2021-08-02 18:54 ` Benjamin Buchmuller via ntg-context
2021-08-03 12:26 ` Hans Hagen via ntg-context [this message]
2021-08-03 15:02 ` Hans Hagen via ntg-context
2021-08-03 17:51 ` Benjamin Buchmuller via ntg-context
2021-08-02 14:19 Benjamin Buchmuller via ntg-context
2021-08-02 14:43 ` Aditya Mahajan via ntg-context
2021-08-02 15:17 ` Hans Hagen via ntg-context
2021-08-02 16:21 ` Hans van der Meer via ntg-context
2021-08-02 16:28 ` Wolfgang Schuster via ntg-context
2021-08-02 16:31 ` Wolfgang Schuster via ntg-context
2021-08-03 7:35 ` Hans Hagen via ntg-context
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=3860f380-8e5c-487d-78f6-b9f1c5249c7c@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=benjamin.buchmuller@gmail.com \
--cc=j.hagen@xs4all.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).