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
___________________________________________________________________________________