This is a stripped-down version of a single section of Grok TiddlyWiki, optimized for fast loading and readability by search engines. Some features are missing.

For the full Grok TiddlyWiki experience, please visit the wiki version of this page.

Ex:TelephoneLink/answer

18th August 2021 at 9:20am

By now, having read all about Text Substitution, you should be aware that this won't work:

[ext[Call {{!!title}}|tel:{{!!phone}}]]

But you might be tempted to try using an HTML element, like this:

<a href="tel:{{!!phone}}">Call {{!!title}}</a>

It might be helpful to review exactly why this doesn't work, as it's something most TiddlyWiki beginners have found themselves trying to do at one point or another. It's actually the same thing we saw in Ex:QuotedMacroCall, back in The Finer Points of Macros. If you put any attribute value in "quotation marks", it is literal: TiddlyWiki won't do any further wikitext parsing on it. Instead of a literal value for an attribute, you can instead use a <<macro transclusion>>, a {{field transclusion}}, or a {{{filtered transclusion}}}.

If you want to include both a literal part and a field or macro transclusion, squashed together (the technical term for this is string concatenation), you need to use either a macro with text substitution or a filter. Here's the macro version:

\define phonelink() [ext[Call $(currentTiddler)$|$(phonenum)$]]
<$set name="phonenum" value={{!!phone}}>
    <<phonelink>>
</$set>

Or with an a element:

\define phonelink() tel:$(phonenum)$
<$set name="phonenum" value={{!!phone}}>
    <a href=<<phonelink>>>Call {{!!title}}</a>
</$set>

The filter version is left as the next exercise.

You can find a more detailed treatment of this issue in the Common Misunderstandings chapter: Constant strings cannot be combined with transclusions.

Go to question: Ex:TelephoneLink