ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Joey McCollum via ntg-context <ntg-context@ntg.nl>
To: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Cc: Joey McCollum <jmccollum20140511@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions
Date: Sun, 10 Oct 2021 09:40:53 -0400	[thread overview]
Message-ID: <CAGxRUG-tR5KqkW71UEhCu6pNjB_8pG5_+7YywZ3fbJqo0b5_jQ@mail.gmail.com> (raw)
In-Reply-To: <2342fc45-5ac0-9504-d94f-5a0ee3a3f50f@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1968 bytes --]

Thanks for these replies! Adding \unexpanded or \protected before \def
didn't fix the problem, and surrounding the definition with \unprotect ...
\protect didn't work either. But surrounding it with \pushcatcodetable
\setcatcodetable\ctxcatcodes ... \popcatcodetable worked.

I've never seen these commands before, but I gather from the existing
documentation that the current catcode governs which characters are treated
as special when a buffer is being processed. So here, it looks like I'm
temporarily switching from some other catcode set (it looks like in
publ-ini.mkiv, \catcode\commentasciicode\othercatcode gets invoked
in \publ_set_publication, so perhaps that's what's happening?) to the
default ConTeXt catcodes and then back.

Thanks again!

Joey

On Sun, Oct 10, 2021 at 6:40 AM Wolfgang Schuster <
wolfgang.schuster.lists@gmail.com> wrote:

> Joey McCollum via ntg-context schrieb am 10.10.2021 um 05:42:
>
> The test using \removepunctuation that you provided does what it should be
> doing (it produces 6 instances of "test-test" with the intervening
> punctuation mark in each case removed), but it doesn't do what I'm trying
> to do in the MWE above. I'm trying to take certain punctuation marks that
> follow the \autopuncttest macro and place them before it instead. Looking
> at the typo-chr .lua and .mkiv files, I see that there are \pushpunctuation
> and \poppunctuation methods in addition to the \removepunctuation method.
> These might be useful for this purpose, but in any case, I still have to
> check if the trailing character is one of the characters in a specified
> set/string, and this is where the error is arising.
>
>
> Add \protected (or \unexpanded) to your command definition.
>
> \startbtxrenderingdefinitions[myspec]
> \protected\def\autopuncttest#1#2%
>   {\removeunwantedspaces%
>    \doifinstring{#2}{,.!?;:}{#2}%
>    \footnote{#1}%
>    \doifnotinstring{#2}{,.!?;:}{#2}}
> \stopbtxrenderingdefinitions
>
> Wolfgang
>
>

[-- Attachment #1.2: Type: text/html, Size: 2614 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

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

  reply	other threads:[~2021-10-10 13:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-09 15:40 Joey McCollum via ntg-context
2021-10-09 16:50 ` Hans Hagen via ntg-context
2021-10-10  3:42   ` Joey McCollum via ntg-context
2021-10-10 10:34     ` Hans Hagen via ntg-context
2021-10-10 10:40     ` Wolfgang Schuster via ntg-context
2021-10-10 13:40       ` Joey McCollum via ntg-context [this message]
2021-10-12  1:57         ` Joey McCollum 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=CAGxRUG-tR5KqkW71UEhCu6pNjB_8pG5_+7YywZ3fbJqo0b5_jQ@mail.gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=jmccollum20140511@gmail.com \
    --cc=wolfgang.schuster.lists@gmail.com \
    /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).