New Features in TiddlyWiki 5.3.0: Substitution for Widget Attributes

Example 4: Use of backtick substitution

Instead of filter transclusion you can use the backtick to substitute variables, literals, parameters, etc.

  1. Open: https://tiddlywiki.com
  2. Create a new tiddler with below example
<$let color="aqua red blue orange purple Teal yellow magenta green" 
          nTids={{{ [enlist<color>count[]] }}} >

<$list filter="[tag[Learning]first<nTids>]" counter=n>
<span style=`color: ${ [enlist<color>nth<n>] }$`>
<$text text=<<currentTiddler>> /><br>
</span>

</$list>
</$let>

Note to: <span style=`color: ${ [enlist<color>nth<n>] }$`> and the substitution of filter using bcktick.

image

4 Likes

Example 5: Display due date in red, if due date of current tiddler is today

Due: <span style=`color: ${ [<now "YYYY0MM0DD">match{!!due}then[red]else[purple]]   }$ `>
<$view field="due" format="date" template="0MM/0DD" />
<span>

In a tiddler with due date of today 2023.06.15 produces

4 Likes

@Mohammad - thanks for providing various examples. Very good to see!

${ [...] }$

– what is this construct called, if I want to read up on it, in the docs?

Thanks!

Hi Mat,

It is a filter expression inside a widget attribute. In doc, it has been described like: Text substitution with the first result of evaluating the filter expression. See doc in review state here: TiddlyWiki — a non-linear personal web notebook

3 Likes

See the Substituted Attribute Values introduced in TiddlyWiki 5.3.0.

2 Likes