Literal filter operands are text constant operand values surrounded by square brackets ([
and ]
). In your code, has[links]
, split[|]
, nth[1]
, and nth[2]
all use literal filter operands (“links”, “|”, “1”, and “2”, respectively). Note also that in your code, none of these literal filter operands contains any square brackets.
If we imagine that, in some other use-case, you wanted to split an item that contains an open square bracket ([
), then you might be inclined to write something like split[[]
… but that won’t work because, as the documentation says, “Literal filter operands cannot contain square brackets”. To avoid this limitation, you can first define a variable: <$let squarebracket="[">
, and then use split<squarebracket>
within the filter syntax.
In addition, there isn’t actually a need to use variable="link"
in your $list
widget. Instead, you could write just:
<$list filter="[enlist{!!links}]">
<$let text={{{ [<currentTiddler>split[|]nth[1]] }}} href={{{ [<currentTiddler>split[|]nth[2]else<text>] }}}>
However, for code readability, it can be helpful to use variable="link"
to make it clear exactly what is being referred to.
However, suppose that within the body of the $list
widget you wanted to refer to the containing tiddler’s title. Then, using variable="link"
is important, as it preserves the existing value of <<currentTiddler>>
, while using <<link>>
to refer to each enlisted item being processed by the $list
widget.