Hello all,
I’m having trouble understanding why a simple macro I wrote doesn’t work properly:
\define todoLink(url, name:"Link")
<a href="$url$" class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">$name$</a>
\end
If I use <<todoLink http://foo.org bar>>
to call my shiny new macro, the first parameter seems to be completely ignored:
<a href="bar" class="tc-tiddlylink-external" target="_blank" rel="noopener noreferrer">Link</a>
On the other hand, if I use the <$macrocall>
syntax, like <$macrocall $name="todoLink" url="http://foo.org" name="bar"/>
, I get the expected behavior.
Ultimately, I’ll be using this macro in tiddlers with a url
field, so I _think I’ll have to use the <$macrocall>
syntax. But I feel like this behavior will bite me in the future. Why does first method of calling the macro produce incorrect output, and why does the second work?
I can make the first method work by putting the URL in quotes, but I would like to avoid that in general because it’s more typing :): <<todoLink "http://foo.org" bar>>
. Why are the quotes required? I thought macro expansion substituted text without treating the macro inputs as WikiText?
My browser is Opera 78.0.4093.184 on Windows 10, and my TiddlyWiki version is 5.1.21. Thanks for any help!