[NTG-context] Re: removing whitespace

2024-02-13 Thread Wolfgang Schuster

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
___


[NTG-context] Re: removing whitespace

2024-02-13 Thread Michael Guravage
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 <
gurav...@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
>
> ___
>
___
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
___