Teeny-Weeny TiddlyWiki tilde tiddler title tip

Folks,

Just thought I would share this “Teeny-Weeny TiddlyWiki tilde title tip”.

Do I win the alliteration award?

In real world dictionaries, the ~ can be used to represent the word one is providing a definition for.

I have used a macro defined as such
\define ~() {{!!title}}

Especially in tiddlers where the title is also text I want to use in the body (surprisingly common). I actually had other parameters, but any way I would just use <<~>> when and where I wanted. Then if I wished I could change the definition as needed.

This one now made me think since “~” is a valid macro or variable name;

<$list filter="if something true filter" variable=~>
   Your conditional content here in <<currentTiddler>>!
</$list>

Is nicer than using nul?

<$list filter="if something true filter" variable=nul>
   Your conditional content here in <<currentTiddler>>!
</$list>

But at any time, you could alter what <<~>> returns eg;

  • \define ~() <h2>__<$link/>__</h2>
  • \define ~() <$text text={{{ [all[current]get[caption]else{!!title}] }}}/>
  • \define ~() <$button tooltip={{!!description}} class="tc-btn-invisible tc-tiddlylink">{{!!title}}</$button>
  • \define ~() <$text text={{{ [all[current]lowercase[]] }}}/>

Or numerous other versions of the title, without revisiting the body of the text.

I think the idea is OK but I’m not so happy with the “symbol” the tilde sign ~ you’ve chosen as a “shortcut”

Since the tilde ~ sign is already used by the core wikitext definition I think it’s not the best idea to overwrite it as shown in the example below. It will create combinations that can be very confusing for new users.

<$list filter="if something true filter" variable="~">
  Some wikitext that uses the tilde like ~TiddlyWiki
</$list>
2 Likes