ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions
@ 2021-10-09 15:40 Joey McCollum via ntg-context
  2021-10-09 16:50 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Joey McCollum via ntg-context @ 2021-10-09 15:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Joey McCollum


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

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:

```

\startbtxrenderingdefinitions[myspec]

\def\autopuncttest#1#2{%

\removeunwantedspaces%

\doifinstring{#2}{,.!?;:}{#2}%

\footnote{#1}%

\doifnotinstring{#2}{,.!?;:}{#2}%

}

\stopbtxrenderingdefinitions


\usebtxdefinitions[myspec]


\starttext

This works \autopuncttest{Footnote 1}, as does this \autopuncttest{Footnote
2}; and so does this \autopuncttest{Footnote 3}.\blank

But this one fails if defined in the bib spec \autopuncttest{Footnote
4}!\blank

And why does this one fail in the bib spec too \autopuncttest{Footnote
5}?\blank

\stoptext
```

Everything works as expected if the macro definition is outside of the
btxrenderingdefinitions
environment. But within the environment, do certain punctuation marks need
to be escaped in the second argument of \doifinstring? Or is this a bug?

Joey

[-- Attachment #1.2: Type: text/html, Size: 2482 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
___________________________________________________________________________________

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

end of thread, other threads:[~2021-10-12  1:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09 15:40 Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions 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
2021-10-12  1:57         ` Joey McCollum 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).