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

 25th September 2024 at 6:18pm

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

<$let currentTiddler="JaneDoe">

  {{!!text}}

</$let>

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:

<$set name="currentTiddler" value="JaneDoe">

  {{!!text}}

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

  {{!!text}}

</$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's an option that uses a widget we haven't discussed yet:

<$tiddler tiddler="JaneDoe">
  <$transclude />
</$tiddler>

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