This page is part of a static HTML representation of the TiddlyWiki at http://tiddlywiki.com/

Variables in WikiText

21st February 2015 at 10:18pm
WikiText

See also the introduction to the concept of variables.

To transclude the value of a variable, use the macro call syntax with no parameters. You can also use a $macrocall widget.

A macro snippet can contain $(name)$ as a placeholder for which the value of the variable of that name will be substituted.

A variable's value can be used as a filter parameter, or as a widget attribute. The latter supports macro parameters.

Example: defining a variable

<$set name=animal value=zebra>
<<animal>>
</$set>

Example: defining a macro

The \define pragma below defines a macro called tags-of-current-tiddler. The macro returns the value of the tiddler's tags field, and can be accessed from anywhere else in the same tiddler (or in any tiddler that imports it).

\define tags-of-current-tiddler() {{!!tags}}
The tags are: <<tags-of-current-tiddler>>

Example: using a variable as a filter parameter

This example uses the backlinks operator to list all tiddlers that link to this one.

<<list-links filter:"[<currentTiddler>backlinks[]]">>