Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-29 Thread Joey McCollum via ntg-context
After some debugging, the example code I offered above seems to work, with minor adjustments: \begingroup \let\loc\loctextloc \currentbtxloctext \btxcomma \endgroup Thanks again for all the help! Joey On Mon, Nov 29, 2021 at 12:11 PM Joey McCollum wrote: > Okay. So using this example as a te

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-29 Thread Joey McCollum via ntg-context
Okay. So using this example as a template, I'd like to do the following: - define a general-purpose \loc macro that can be invoked in the main text (i.e., outside of citations) in the usual way; this one would correspond to \WhateverB above and would not remove punctuation preceding th

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-28 Thread Hans Hagen via ntg-context
On 11/28/2021 2:39 AM, Joey McCollum wrote: I was afraid that might be the problem. I've described some of the intended purpose of this code near the end of the "Checking for a macro > ... Maybe play with: \starttext \def\WhateverA{\removeunwantedspaces\removepunctuation\space ¶ 1.23} \def\W

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Joey McCollum via ntg-context
I was afraid that might be the problem. I've described some of the intended purpose of this code near the end of the "Checking for a macro in a string without expanding it" thread on the mailing list, but I will get into more detail here. I'm working on a ConTeXt implementation of citation style la

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Hans Hagen via ntg-context
On 11/27/2021 6:13 PM, Joey McCollum wrote: All right, I think I've solved the expansion problem I described before: to ensure that the first input is expanded when it is passed to Lua, I have to pass it as [==[#1]==], not "#1". But the updated MWE below still does not seem to work, as the \DoI

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Joey McCollum via ntg-context
All right, I think I've solved the expansion problem I described before: to ensure that the first input is expanded when it is passed to Lua, I have to pass it as [==[#1]==], not "#1". But the updated MWE below still does not seem to work, as the \DoIfPrefixElse macro is printing "NOP" instead of "

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-26 Thread Joey McCollum via ntg-context
Thanks! Invoking string.find(str,"^"..pre) is certainly much easier. This sort of thing would be a nice general-purpose helper function. Denis Maier and I should have a "wish list" of desired helpers and features (mostly related to bibliographies/publication support) ready for you (and Alan) someti

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-26 Thread Hans Hagen via ntg-context
On 11/26/2021 7:42 AM, Joey McCollum via ntg-context wrote: I wasn't aware of a general-purpose "doifstartswith" macro in ConTeXt (the \doifnextcharelse macro only works one character at a time, and the \doifinstring macros may capture substrings that are not prefixes), and I'd like to develop

[NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-25 Thread Joey McCollum via ntg-context
I wasn't aware of a general-purpose "doifstartswith" macro in ConTeXt (the \doifnextcharelse macro only works one character at a time, and the \doifinstring macros may capture substrings that are not prefixes), and I'd like to develop one for something I'm working on. I've been trying to do this in