TiddlyWiki Configuration (part2, with a transclusion use case)

Please, if you do not know TiddlyWiki, read "A Gentle Guide to TiddlyWiki" at TiddlyWiki.com .

Latest Updates


I've added a few new items to my standard TiddlyWiki configuration tasks:
  • Create Navigation Tiddler
  • Configure Settings
  • Customize Appearance (Palette)
  • Customize Appearance (Theme Tweaks)
  • Setup "Fancy" TiddlyWiki Title and Subtitle
Please find details in my project,  CJ's Configuring TiddlyWiki.

In the remainder of this blog post, I want to discuss how transclusion helps with the setup of "Fancy" TiddlyWiki Title and Subtitle.  By "Fancy", I mean using formatting with wikitext, as per this TiddlyWiki.com tiddler, and/or using HTML code.

A TiddlyWiki Transclusion Use Case


Some Background Info


 TiddlyWiki's Basic Title and Subtitle


We set the title and subtitle for a TiddlyWiki instance via the Control Panel, on the "Info" tab and "Basics" sub-tab.  (See the screenshot below.) 

(Click here for a larger image)

Whatever value gets entered in the "Title of this TiddlyWiki" field will show in the side bar's "Title Area".  Whatever value gets entered in the "Subtitle" field will show in the side bar's "Subtitle Area."

Quick Mention: EditText Widgets


The fields in which we edit Title and Subtitle values are called "EditText Widgets."

Although I can't explain how this technically works, I know this much: a value entered in an EditText widget is saved in the text area of whatever tiddler linked to that EditText Widget.  (For details about EditText Widgets, please see this tiddler at TiddlyWiki.com.)

As per the screenshot below:
  • the "Title of this TiddlyWiki" EditText Widget value is saved into a System Tiddler called "SiteTitle"
  • the "Subtitle" EditText Widget value is saved into a "System Tiddler" called "SiteSubtitle"
  • (For details about "System Tiddlers", please see this tiddler at TiddlyWiki.com. ) 


(Click here for a larger image)



The Magic of Transclusion References in EditText Widgets


Just going by the images above, the "Title" and "Subtitle" areas in the Sidebar present the content of the "SiteTitle" and "SiteSubtitle" system tiddlers.  This happens, like so many things in TiddlyWiki, via some internal transclusion mechanism.

Although the EditText widgets for SiteTitle and SiteSubtitle do not provide enough room for anything but very simple text, we could setup "Fancy" Title and Subtitle by editing the related system tiddlers.

I wouldn't recommend it.  To me, messing around directly with system tiddlers risks causing all kinds of headaches.

It seems so much safer (and orderly, if you are at all like me), to create our own tiddlers for Title and SubTitle, and to put tiddler transclusion references in the related EditField widgets.

  • Created a tiddler called "Fancy TiddlyWiki Title"
  • Set the value of "Title of this TiddlyWiki" EditText Widget to "{{Fancy TiddlyWiki Title}}", which gets saved into the "SiteTitle" system tiddler
  • Created a tiddler called "Fancy TiddlyWiki Subtitle"
  • Set the value of "Subtitle" EditText Widget to "{{Fancy TiddlyWiki Subtitle}}"

This turns into transclusion of a transclusion.  Double-Transclusion?Transclusionx2?  Meh.

At some point soon after opening the TiddlyWiki, the Title Area fills up with the content of the "SiteTitle" system tiddler (i.e. {{Fancy TiddlyWiki Title}}.)  Because {{Fancy TiddlyWiki Title}} is a transclusion reference, that gets replaced in the Title Ara with the content of the "Fancy TiddlyWiki Title" tiddler.

Same thing happens with the Subtitle Area.

Well, that explanation came out right clumsily.  So, let's show all of that in pictures:

"Fancy TiddlyWiki Title" Tiddler


(Click here for a larger image)

"Fancy TiddlWiki Subtitle" Tiddler


(Click here for a larger image)

Control Panel's Title and Subtitle Values


(Click here for a larger image)

The "Fancy" Result:  Sidebar Title and Subtitle Areas


(Click here for a larger image)


Nothing can match experiencing things with some hands-on exploration.  Please go to the CJ's Configuring TiddlyWiki TiddlyWiki instance and play.

Cheers !


No comments: