On 10/10/2021 5:42 AM, Joey McCollum wrote:
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 \poppunctuationmethods 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.
maybe you're in protected mode % assumes \protect earlier \unprotect \def\autopuncttest#1#2{% \removeunwantedspaces% \doifinstring{#2}{,.!?;:}{#2}% \footnote{#1}% \doifnotinstring{#2}{,.!?;:}{#2}% } \protect % assumes \unprotect later or something \pushcatcodetable \setcatcodetable\ctxcatcodes \def\autopuncttest#1#2{% \removeunwantedspaces% \doifinstring{#2}{,.!?;:}{#2}% \footnote{#1}% \doifnotinstring{#2}{,.!?;:}{#2}% } \popcatcodetable
Joey
On Sat, Oct 9, 2021 at 12:50 PM Hans Hagen
mailto:j.hagen@xs4all.nl> wrote: On 10/9/2021 5:40 PM, Joey McCollum via ntg-context wrote: > Hi, > > I'm trying to define concise biblatex-style citation macros for a custom > bibliographic style specification with support for intelligent placement > of trailing punctuation, and I've encountered an unusual error. If I try > to define the macros within the btxrenderingdefinitions environment, > then the code for handling trailing punctuation with the > \doifinstring and \doifnotinstring macros fails in some cases. > Specifically, it correctly detects when the trailing punctuation is a > period, comma, or semicolon, but not when it is a colon, exclamation > point, or question mark. The following MWE reproduces the error: > > ``` \starttext
test,\removepunctuation -test test;\removepunctuation -test test:\removepunctuation -test test?\removepunctuation -test test!\removepunctuation -test test.\removepunctuation -test
\stoptext
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl http://www.pragma-ade.nl | www.pragma-pod.nl http://www.pragma-pod.nl -----------------------------------------------------------------
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------