Dear list, I have the following sample: \replaceword[some][via ][Vía] \replaceword[some][calle ][c/ ] \replaceword[some][ calle][ Calle] \starttext \startTEXpage[offset=2em] This is what I get: \setreplacements[some]% calle via del viaducto de la calle \resetreplacements This is what I need: c/ Vía del viaducto de la Calle \stopTEXpage \stoptext Is there any way to get spaces in the string to be replaced? Many thanks for your help, Pablo -- http://www.ousia.tk
Dear list,
I have the following sample:
\replaceword[some][via ][Vía] \replaceword[some][calle ][c/ ] \replaceword[some][ calle][ Calle] \starttext \startTEXpage[offset=2em] This is what I get:
\setreplacements[some]% calle via del viaducto de la calle
\resetreplacements This is what I need:
c/ Vía del viaducto de la Calle \stopTEXpage \stoptext
Is there any way to get spaces in the string to be replaced? not with a lot of effort on my end which i'm not willing to invest in something that is just a hack for bad input ... tex has no spaces so
On 4/15/2018 1:30 PM, Pablo Rodriguez wrote: then we need other magic anyway, i added a bogus lookup to the font handler that will remove characters so in a next beta you can do this (some upbeat music in the background so i could convince myself) \startluacode fonts.handlers.otf.addfeature { name = "crap", type = "chainsubstitution", prepend = true, lookups = { { type = "multiple", data = { ["v"] = { "V", "í", "a" }, }, }, { type = "multiple", data = { ["c"] = { "c", "/" }, }, }, { type = "substitution", data = { ["c"] = "C", }, }, }, data = { rules = { { comment = "'via' => 'Vía'", current = { { "v" }, { "i" }, { "a" } }, after = { { " " } }, lookups = { 1, 0, 0 }, }, { comment = "'calle ' => 'c/ '", current = { { "c" }, { "a" }, { "l" }, { "l" }, { "e" } }, after = { { " " } }, lookups = { 2, 0, 0, 0, 0 }, }, { comment = "' calle' => ' Calle'", before = { { " " } }, current = { { "c" } }, after = { { "a" }, { "l" }, { "l" }, { "e" } }, lookups = { 3 }, }, }, }, } \stopluacode \definefontfeature[default][default][crap=yes] \starttext \startTEXpage[offset=2em] \type{text:} \type{calle via del viaducto de la calle} \type{done:} calle via del viaducto via de la calle \type{okay:} c/ Vía del viaducto Vía de la Calle \stopTEXpage \stoptext one could make a constructor for this but would hide the weirdness of it ... yet another obscure feature 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 -----------------------------------------------------------------
On 04/15/2018 06:02 PM, Hans Hagen wrote:
[...] Is there any way to get spaces in the string to be replaced? not with a lot of effort on my end which i'm not willing to invest in something that is just a hack for bad input ... tex has no spaces so
On 4/15/2018 1:30 PM, Pablo Rodriguez wrote: then we need other magic
anyway, i added a bogus lookup to the font handler that will remove characters so in a next beta you can do this (some upbeat music in the background so i could convince myself) [...]> one could make a constructor for this but would hide the weirdness of it ... yet another obscure feature
Many thanks for the fix, Hans. Pablo -- http://www.ousia.tk
On 4/15/2018 6:14 PM, Pablo Rodriguez wrote:
On 04/15/2018 06:02 PM, Hans Hagen wrote:
[...] Is there any way to get spaces in the string to be replaced? not with a lot of effort on my end which i'm not willing to invest in something that is just a hack for bad input ... tex has no spaces so
On 4/15/2018 1:30 PM, Pablo Rodriguez wrote: then we need other magic
anyway, i added a bogus lookup to the font handler that will remove characters so in a next beta you can do this (some upbeat music in the background so i could convince myself) [...]> one could make a constructor for this but would hide the weirdness of it ... yet another obscure feature
Many thanks for the fix, Hans. it's not a fix .. it's an extension to the font extension mechanism
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 -----------------------------------------------------------------
On 04/15/2018 06:39 PM, Hans Hagen wrote:
On 4/15/2018 6:14 PM, Pablo Rodriguez wrote:
[...] Many thanks for the fix, Hans. it's not a fix .. it's an extension to the font extension mechanism
Hans it was my fault. Of course it is a new implementation. (I was thinking about the solution my problem.) Many thanks for the Endre Huszár reference and the code extension, Pablo -- http://www.ousia.tk
On 4/15/2018 6:22 PM, Floris van Manen wrote:
On 15 Apr 2018, at 18:02, Hans Hagen
wrote: (some upbeat music in the background so i could convince myself)
what music ?
In this case "The Time Capsule" from Endre eNerd (blu ray on my top floor work space with surround 5.1). 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 -----------------------------------------------------------------
On 4/15/2018 7:07 PM, Floris van Manen wrote:
On 15 Apr 2018, at 18:42, Hans Hagen
wrote: In this case "The Time Capsule" from Endre eNerd (blu ray on my top floor work space with surround 5.1).
much like TeX, drummers do know about timing ;-)
Indeed I love to watch good drummers (a good distraction). 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 -----------------------------------------------------------------
participants (4)
-
Floris van Manen
-
Hans Hagen
-
luigi scarso
-
Pablo Rodriguez