Re: [NTG-context] String substitution using regular expressions and backreferences
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 blocks, too, wouldn't it? ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] String substitution using regular expressions and backreferences
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 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] String substitution using regular expressions and backreferences
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 document containing both sample inputs and sample outputs: \starttext {\bf Markdown Input} Our grandmother clock rang 11 p.m. and we fled. Our grandmother clock rang 11 p.m., so we fled. Our grandmother clock rang 11 p.m. We fled. \blank[big] {\bf \ConTeXt{} Output} Our grandmother clock rang 11 \cap{pm} and we fled. Our grandmother clock rang 11 \cap{pm}, so we fled. Our grandmother clock rang 11 \cap{pm}. We fled. \stoptext It would be most convenient to write: % Strip periods from p.m. \definereplacement[SubstPostmeridianLowercase][ match={[Pp].[Mm]. ([^:upper:])}, replace={\cap{pm} \1} ] % Preserve terminal period for p.m. (e.e. cummings notwithstanding) \definereplacement[SubstPostmeridianTerminal][ match={[Pp].[Mm]. ([:upper:])}, replace={\cap{pm}. \1} ] % Apply a macron for lowercase 'c' (McAnulty, McGenius, etc.) % Well, not quite a macron: https://tex.stackexchange.com/q/364024/2148 \definereplacement[SubstMac][ match={Mc([:upper:]\w)}, replace={M\macronbelow{c}\1} ] The \1 may be problematic. Other sigils include $1 and #1, which may also have issues. Thank you! ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Cron /var/www/aanhet.net/context/bin/cron/context-mirror
receiving incremental file list ./ ctan.lsr document-2.htm download-1.htm download-2.htm logo-ade.png logo-cts.png logo-pod.png rss.xml show-fil.pdf context/latest/ context/latest/cont-mpd.zip context/latest/cont-ppc.zip context/latest/cont-sci.zip context/latest/cont-tmf.zip context/latest/cont-tst.tar.xz general/manuals/ general/manuals/luametatex.pdf sent 98,844 bytes received 20,752,220 bytes 3,207,856.00 bytes/sec total size is 451,138,367 speedup is 21.64 Running archiver: New dir: /var/www/aanhet.net/context//htdocs/archives/context-2022-08-01.21 133382741 /var/www/aanhet.net/context//htdocs/archives/context-2022-08-01.21/latest 126745317 /var/www/aanhet.net/context//htdocs/archives/context-2022-08-01.21/current 18956262 /var/www/aanhet.net/context//htdocs/archives/context-2022-08-01.21/alpha 126707516 /var/www/aanhet.net/context//htdocs/archives/context-2022-08-01.21/beta 405795932 /var/www/aanhet.net/context//htdocs/archives/context-2022-08-01.21 405795932 total ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] font fallbacks
Am 01.08.22 um 20:43 schrieb denis.ma...@unibe.ch: Hi, I have used more than one fallback, but each fallback is for a different character range Thank you. I tried: \definefontfallback[seguiFB] [file:seguisym.ttf] % [0x0-0xF] [0x0007F-0xF] [check=yes,force=no] \definefontfallback[tildeFB] [file:seguisym.ttf] [0x0007E-0x0007E] [force=yes] \definetypeface [start] [tt] [mono] [modern] [default][fallbacks={tildeFB}] % ,seguiFB I can either replace the one character or fall back for all missing characters, but not both. Maybe it’s the mixture of force=yes/no. For the emoji fallback, I’d need to define all the necessary ranges... Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] font fallbacks
Hi, I have used more than one fallback, but each fallback is for a different character range Denis Von: ntg-context im Auftrag von Henning Hraban Ramm via ntg-context Gesendet: Montag, 1. August 2022 19:42:51 An: Henning Hraban Ramm via ntg-context Cc: Henning Hraban Ramm Betreff: Re: [NTG-context] font fallbacks Nobody? I couldn’t find an example of more than one fallback, so I guess that’s not supported? Hraban Am 30.07.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context: > Hi, > I thought I could use more than one fallback font, but as soon as I list > fallbacks, they stop working. > > In my example, I’d like to take all missing glyphs from Segoe UI > Symbols, and what’s still missing (emojis) from EmojiOneColor, > preferably without specifying the exact range. > > Additionally, I want to replace the tilde ~ of LM Modern: > > """ > \definefontfallback[seguiFB] >[file:seguisym.ttf] >[0x0-0xF] >[check=yes,force=no] > > \definefontfallback[emoneFB] >[name:EmojiOneColor] >[0x0-0xF] >[check=yes,force=no] > > % replace tilde in LM > \definefontfallback[tildeFB] >[file:seguisym.ttf] >[0x0007E-0x0007E] >[force=yes] > > > \starttypescript [start] >\definetypeface [start] [rm] [serif] [cambria] > [default][fallbacks={seguiFB,emoneFB}] >\definetypeface [start] [ss] [sans] [modern] > [default][fallbacks={seguiFB,emoneFB}] >\definetypeface [start] [tt] [mono] [modern] > [default][fallbacks={seguiFB,tildeFB,emoneFB}] >\definetypeface [start] [mm] [math] [modern] > [default][fallbacks={seguiFB,emoneFB}] > \stoptypescript > > > \setupbodyfont[start,rm,12pt] > > \starttext > > \Omega\ (Omega) and \aleph\ (Aleph) > > \startbuffer[example] > start missing characters: lmmono10-regular.otf > 7 U+00327 ̧ COMBINING CEDILLA > 7 U+00335 ̵ COMBINING SHORT STROKE OVERLAY >14 U+003B7 η GREEK SMALL LETTER ETA > 7 U+021A9 ↩ LEFTWARDS ARROW WITH HOOK > 350 U+02500 ─ BOX DRAWINGS LIGHT HORIZONTAL >98 U+02502 │ BOX DRAWINGS LIGHT VERTICAL >42 U+02514 └ BOX DRAWINGS LIGHT UP AND RIGHT > 133 U+0251C ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT > 154 U+02772 ❲ LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT > 154 U+02773 ❳ LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT >14 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE > stop missing characters > start missing characters: cambria.ttc > 9 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE > 9 U+0FFFD � REPLACEMENT CHARACTER > stop missing characters > start missing characters: cambriai.ttf > 266 U+0276C ❬ MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT > 266 U+0276D ❭ MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT > stop missing characters > \stopbuffer > > \typebuffer[example] > > \startlines > \getbuffer[example] > > {\ss\getbuffer[example]} > \stoplines > > \tex{abra}\arg{...} > \type{kadabra} \type{~~~} > > \stoptext > """ > > What’s wrong? > > Hraban > ___ > If your question is of interest to others as well, please add an entry > to the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] font fallbacks
Nobody? I couldn’t find an example of more than one fallback, so I guess that’s not supported? Hraban Am 30.07.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context: Hi, I thought I could use more than one fallback font, but as soon as I list fallbacks, they stop working. In my example, I’d like to take all missing glyphs from Segoe UI Symbols, and what’s still missing (emojis) from EmojiOneColor, preferably without specifying the exact range. Additionally, I want to replace the tilde ~ of LM Modern: """ \definefontfallback[seguiFB] [file:seguisym.ttf] [0x0-0xF] [check=yes,force=no] \definefontfallback[emoneFB] [name:EmojiOneColor] [0x0-0xF] [check=yes,force=no] % replace tilde in LM \definefontfallback[tildeFB] [file:seguisym.ttf] [0x0007E-0x0007E] [force=yes] \starttypescript [start] \definetypeface [start] [rm] [serif] [cambria] [default][fallbacks={seguiFB,emoneFB}] \definetypeface [start] [ss] [sans] [modern] [default][fallbacks={seguiFB,emoneFB}] \definetypeface [start] [tt] [mono] [modern] [default][fallbacks={seguiFB,tildeFB,emoneFB}] \definetypeface [start] [mm] [math] [modern] [default][fallbacks={seguiFB,emoneFB}] \stoptypescript \setupbodyfont[start,rm,12pt] \starttext \Omega\ (Omega) and \aleph\ (Aleph) \startbuffer[example] start missing characters: lmmono10-regular.otf 7 U+00327 ̧ COMBINING CEDILLA 7 U+00335 ̵ COMBINING SHORT STROKE OVERLAY 14 U+003B7 η GREEK SMALL LETTER ETA 7 U+021A9 ↩ LEFTWARDS ARROW WITH HOOK 350 U+02500 ─ BOX DRAWINGS LIGHT HORIZONTAL 98 U+02502 │ BOX DRAWINGS LIGHT VERTICAL 42 U+02514 └ BOX DRAWINGS LIGHT UP AND RIGHT 133 U+0251C ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT 154 U+02772 ❲ LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT 154 U+02773 ❳ LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT 14 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE stop missing characters start missing characters: cambria.ttc 9 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE 9 U+0FFFD � REPLACEMENT CHARACTER stop missing characters start missing characters: cambriai.ttf 266 U+0276C ❬ MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT 266 U+0276D ❭ MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT stop missing characters \stopbuffer \typebuffer[example] \startlines \getbuffer[example] {\ss\getbuffer[example]} \stoplines \tex{abra}\arg{...} \type{kadabra} \type{~~~} \stoptext """ What’s wrong? Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] Set up external figure for particular image type
On 8/1/2022 2:29 AM, Thangalin via ntg-context wrote: Got it working. Complete solution: |\setupexternalfigures[ location={local,global,default}, width=\textwidth ] \defineexternalfigure[svg][width=1cm] \defineexternalfigure[jpg][width=2cm] \defineexternalfigure[png][width=4cm] % Won't be applied because there's no process action. % Default (\textwidth) is used, as defined above. \defineexternalfigure[pdf][width=6cm] \starttexdefinition includegraphics #1 \splitfilename{#1} \processaction[\splitofftype][ jpg=>{\externalfigure[#1][jpg]}, png=>{\externalfigure[#1][png]}, svg=>{\externalfigure[#1][svg][conversion=mp]}, default=>{\externalfigure[#1]}, unknown=>{\externalfigure[#1]} ] \stoptexdefinition \starttext \includegraphics{kitten.jpg} \includegraphics{mill.png} \includegraphics{cow.pdf} \includegraphics{tiger.svg} \stoptext | I've added: \setfigureconversion[svg][mp] So that this works: \starttext \externalfigure[kitten.jpg][width=2cm] \externalfigure[mill.png] [width=4cm] \externalfigure[cow.pdf] [width=6cm] \externalfigure[tiger.svg] [width=1cm] \stoptext But after we release you need to wikify it. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___