This is a stripped-down version of a single section of Grok TiddlyWiki, optimized for fast loading and readability by search engines. Some features are missing.

For the full Grok TiddlyWiki experience, please visit the wiki version of this page.

Ex:MethodsOfTransclusion/answer

3rd January 2022 at 11:04am

This one's fun because TiddlyWiki gives you so many different ways to skin this cat. Here's perhaps the most obvious one:

<$set name=currentTiddler value=JaneDoe>

  {{!!text}}

</$set>

You may have noticed that you had to put the blank lines before and after {{!!text}} or the formatting ended up all funny. Back in the section on dynamic lists, we noted that there are cases where whitespace does matter with widgets and HTML. This is one of them, and it's due to a distinction in TiddlyWiki and HTML between block mode and inline mode. We'll talk more about these modes later – for now, just remember that if everything gets all squashed up in one line, you're probably stuck in inline mode, and you can get out of it by putting a blank line before and after the thing that's getting squashed.

Here are several more possibilities:

<$list filter="[[JaneDoe]]">

  {{!!text}}

</$list>
\define janedoe(janesName)
  {{$janesName$}}
\end

<<janedoe JaneDoe>>
<$list filter="[[JaneDoe]get[text]]">

  <<currentTiddler>>

</$list>

Another way would be to create another tiddler, call it JaneDoeStandin, put {{JaneDoe}} in that tiddler, and then transclude {{JaneDoeStandin}}.

{{JaneDoe!!text}} is technically not writing {{JaneDoe}}, though this solution seems a bit cheap!

Similarly but a little bit more cleverly, {{JaneDoe||JaneDoe}} (transclude the tiddler JaneDoe with the current tiddler as JaneDoe) means the same thing as {{JaneDoe}}. ({{||JaneDoe}} won't work, though, because that makes the current tiddler JaneTransclusion, and the ContactInformationTemplate transcluded within JaneDoe depends on the current tiddler being JaneDoe.)

Here are two other ways that use widgets we haven't seen yet:

<$let currentTiddler=JaneDoe>

  {{!!text}}

</$let>
<$transclude tiddler=JaneDoe mode=block />

If you get bored, see how many other options you can come up with! I'm not at the end of my own ideas by any means.

Go to question: Ex:MethodsOfTransclusion