* \replaceword with spaces
@ 2018-04-15 11:30 Pablo Rodriguez
2018-04-15 16:02 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Pablo Rodriguez @ 2018-04-15 11:30 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 11:30 \replaceword with spaces Pablo Rodriguez
@ 2018-04-15 16:02 ` Hans Hagen
2018-04-15 16:14 ` Pablo Rodriguez
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Hans Hagen @ 2018-04-15 16:02 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 4/15/2018 1:30 PM, Pablo Rodriguez wrote:
> 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
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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:02 ` Hans Hagen
@ 2018-04-15 16:14 ` Pablo Rodriguez
2018-04-15 16:39 ` Hans Hagen
2018-04-15 16:22 ` Floris van Manen
2018-04-15 17:14 ` luigi scarso
2 siblings, 1 reply; 10+ messages in thread
From: Pablo Rodriguez @ 2018-04-15 16:14 UTC (permalink / raw)
To: ntg-context
On 04/15/2018 06:02 PM, Hans Hagen wrote:
> On 4/15/2018 1:30 PM, Pablo Rodriguez 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
> 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
___________________________________________________________________________________
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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:02 ` Hans Hagen
2018-04-15 16:14 ` Pablo Rodriguez
@ 2018-04-15 16:22 ` Floris van Manen
2018-04-15 16:42 ` Hans Hagen
2018-04-15 17:14 ` luigi scarso
2 siblings, 1 reply; 10+ messages in thread
From: Floris van Manen @ 2018-04-15 16:22 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 156 bytes --]
> On 15 Apr 2018, at 18:02, Hans Hagen <j.hagen@xs4all.nl> wrote:
>
> (some upbeat music in the background so i could convince myself)
what music ?
.F
[-- Attachment #1.2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:14 ` Pablo Rodriguez
@ 2018-04-15 16:39 ` Hans Hagen
2018-04-15 19:12 ` Pablo Rodriguez
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2018-04-15 16:39 UTC (permalink / raw)
To: ntg-context
On 4/15/2018 6:14 PM, Pablo Rodriguez wrote:
> On 04/15/2018 06:02 PM, Hans Hagen wrote:
>> On 4/15/2018 1:30 PM, Pablo Rodriguez 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
>> 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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:22 ` Floris van Manen
@ 2018-04-15 16:42 ` Hans Hagen
2018-04-15 17:07 ` Floris van Manen
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2018-04-15 16:42 UTC (permalink / raw)
To: ntg-context
On 4/15/2018 6:22 PM, Floris van Manen wrote:
>> On 15 Apr 2018, at 18:02, Hans Hagen <j.hagen@xs4all.nl> 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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:42 ` Hans Hagen
@ 2018-04-15 17:07 ` Floris van Manen
2018-04-15 17:23 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Floris van Manen @ 2018-04-15 17:07 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 237 bytes --]
> On 15 Apr 2018, at 18:42, Hans Hagen <j.hagen@xs4all.nl> 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 ;-)
.F
[-- Attachment #1.2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:02 ` Hans Hagen
2018-04-15 16:14 ` Pablo Rodriguez
2018-04-15 16:22 ` Floris van Manen
@ 2018-04-15 17:14 ` luigi scarso
2 siblings, 0 replies; 10+ messages in thread
From: luigi scarso @ 2018-04-15 17:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 245 bytes --]
On Sun, Apr 15, 2018 at 6:02 PM, Hans Hagen <j.hagen@xs4all.nl> wrote:
> ... yet another obscure feature
>
It's a proven theorem that, by adding a suitable number of obscure features,
you can transform everything into black magic.
--
luigi
[-- Attachment #1.2: Type: text/html, Size: 667 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 17:07 ` Floris van Manen
@ 2018-04-15 17:23 ` Hans Hagen
0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2018-04-15 17:23 UTC (permalink / raw)
To: ntg-context
On 4/15/2018 7:07 PM, Floris van Manen wrote:
>
>> On 15 Apr 2018, at 18:42, Hans Hagen <j.hagen@xs4all.nl> 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
-----------------------------------------------------------------
___________________________________________________________________________________
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] 10+ messages in thread
* Re: \replaceword with spaces
2018-04-15 16:39 ` Hans Hagen
@ 2018-04-15 19:12 ` Pablo Rodriguez
0 siblings, 0 replies; 10+ messages in thread
From: Pablo Rodriguez @ 2018-04-15 19:12 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
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] 10+ messages in thread
end of thread, other threads:[~2018-04-15 19:12 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-15 11:30 \replaceword with spaces Pablo Rodriguez
2018-04-15 16:02 ` Hans Hagen
2018-04-15 16:14 ` Pablo Rodriguez
2018-04-15 16:39 ` Hans Hagen
2018-04-15 19:12 ` Pablo Rodriguez
2018-04-15 16:22 ` Floris van Manen
2018-04-15 16:42 ` Hans Hagen
2018-04-15 17:07 ` Floris van Manen
2018-04-15 17:23 ` Hans Hagen
2018-04-15 17:14 ` luigi scarso
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).