Re: [NTG-context] String substitution using regular expressions and backreferences

2022-08-26 Thread Hans Hagen via ntg-context
On 8/25/2022 9:44 PM, Thangalin via ntg-context wrote: I've attempted to apply Wolfgang's subtle suggestion of using Lua to parse the input document using a regular expression via lpeg.replacer. The replacement itself works fine; however, in doing so the XML document structure is converted to

Re: [NTG-context] String substitution using regular expressions and backreferences

2022-08-25 Thread Thangalin via ntg-context
I've attempted to apply Wolfgang's subtle suggestion of using Lua to parse the input document using a regular expression via lpeg.replacer. The replacement itself works fine; however, in doing so the XML document structure is converted to text, which means that it is no longer possible to "flush"

Re: [NTG-context] String substitution using regular expressions and backreferences

2022-08-01 Thread Thangalin via ntg-context
Good point, Wolfgang. The Markdown is translated to XHTML then typeset as XML using the setups listed here: https://github.com/DaveJarvis/keenwrite-themes/tree/main/xhtml Having an XML string replacement solution would be great. I suppose that would help prevent substitutions within pre and code

Re: [NTG-context] String substitution using regular expressions and backreferences

2022-08-01 Thread Wolfgang Schuster via ntg-context
Thangalin via ntg-context schrieb am 01.08.2022 um 21:58: Hi list, I'm looking to perform text replacements. Please don't omit important information, on TeX SE you mentioned you input is XML which means a lot more can be done than your simple TeX based example demonstrates. Wolfgang

[NTG-context] String substitution using regular expressions and backreferences

2022-08-01 Thread Thangalin via ntg-context
Hi list, I'm looking to perform text replacements. \definereplacement[SubstPostmeridian][ match={[Pp].[Mm].]}, replace={\cap{pm}} ] The \replaceword command doesn't handle periods well. The translate module doesn't seem flexible enough to cover edge cases. Consider the following example