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

 16th October 2024 at 8:06am

The key issue here is passing the value of !!phone into the macro. You might be tempted to use a parameter phonenum, like this:

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

...but unfortunately <<phonelink {{!!phone}}>> doesn't do what we want here – TiddlyWiki does not parse other transclusions inside <<variable transclusions>>. (It's valid syntax, but it will just pass the literal text {{!!phone}} to the macro.)

One option is to put the entire link within the macro, which allows you to use the $transclude widget to pass transcluded values as parameters:

\define phonelink(phonenum) [ext[Call $name$|tel:$phonenum$]]
<$transclude $variable="phonelink" name={{!!title}} phonenum={{!!phone}}/>

Another popular (and more flexible) option is to access the values needed as variables, rather than as parameters:

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

This problem is not limited to macros; it can come up occasionally with procedures as well. Setting a variable is often a useful workaround.

Go to question: Ex:TelephoneLink