\procedure wikipediaLink(articleName)
<a href=`https://en.wikipedia.org/wiki/$(articleName)$`>
Wikipedia: <<articleName>></a>
\end
You might notice that I put the </a>
on the same line, rather than one line below. This is because TiddlyWiki will include an unwanted trailing space in the link text, like Wikipedia: Aardvark , if there is a new line there. (That applies equally to the examples earlier in this section, too – I just didn't want to get into that right away!)
You can avoid this behavior using the pragma \whitespace trim
, which causes whitespace that's not between two text characters to be ignored. But if you have actual text to be rendered in the tiddler, rather than just procedure definitions, this will have undesired effects (for instance, you'll no longer be able to create new paragraphs by pressing Enter twice). Once we learn more about scopes in Chapter 5, we'll be placing many of our procedures in tiddlers that don't contain any text, and this pragma will become quite useful.