* [NTG-context] removing whitespace
@ 2024-02-13 2:38 Michael Guravage
2024-02-13 13:01 ` [NTG-context] " Michael Guravage
0 siblings, 1 reply; 3+ messages in thread
From: Michael Guravage @ 2024-02-13 2:38 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 439 bytes --]
In the example below I pass the macro a string with a space, but the space
should not appear in the url.
I've tried using \ctxlua to invoke string substitution, but without
success. What is the proper way to remove this space, and to perform string
manipulation more generally?
\setupinteraction[state=start]
\def\squeeze#1%
{\goto{#1}[url(tel:#1)]}
\starttext
Call \squeeze{01234 56789}
\stoptext
--
With kind regards,
Michael
[-- Attachment #1.2: Type: text/html, Size: 757 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: removing whitespace
2024-02-13 2:38 [NTG-context] removing whitespace Michael Guravage
@ 2024-02-13 13:01 ` Michael Guravage
2024-02-13 15:48 ` Wolfgang Schuster
0 siblings, 1 reply; 3+ messages in thread
From: Michael Guravage @ 2024-02-13 13:01 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1463 bytes --]
While reading the documentation I spotted something similar from which I
derived this solution:
\setupinteraction[state=start]
\def\squeeze#1%
{
\goto{#1} [url(tel:\ctxlua{context(string.gsub("#1", " ", ""))})]
}
\starttext
Call \squeeze{01234 56789}
\stoptext
With kind regards,
Michael
On Tue, Feb 13, 2024 at 2:54 AM Michael Guravage <
guravage@literatesolutions.com> wrote:
> In the example below I pass the macro a string with a space, but the space
> should not appear in the url.
>
> I've tried using \ctxlua to invoke string substitution, but without
> success. What is the proper way to remove this space, and to perform string
> manipulation more generally?
>
> \setupinteraction[state=start]
>
> \def\squeeze#1%
> {\goto{#1}[url(tel:#1)]}
>
> \starttext
> Call \squeeze{01234 56789}
> \stoptext
>
> --
> With kind regards,
>
> Michael
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 2752 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: removing whitespace
2024-02-13 13:01 ` [NTG-context] " Michael Guravage
@ 2024-02-13 15:48 ` Wolfgang Schuster
0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2024-02-13 15:48 UTC (permalink / raw)
To: mailing list for ConTeXt users, Michael Guravage
Michael Guravage schrieb am 13.02.2024 um 14:01:
> While reading the documentation I spotted something similar from which I
> derived this solution:
>
> \setupinteraction[state=start]
> \def\squeeze#1%
> {
> \goto{#1} [url(tel:\ctxlua{context(string.gsub("#1", " ", ""))})]
> }
ConTeXt has a Lua function to remove spaces.
\starttext
\cldcontext{string.nospaces("01234 56789")}
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-13 15:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 2:38 [NTG-context] removing whitespace Michael Guravage
2024-02-13 13:01 ` [NTG-context] " Michael Guravage
2024-02-13 15:48 ` Wolfgang Schuster
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).