TiddlyWiki now has cascades to control rendering different parts of a tiddler and this is quite powerful.
See $:/ControlPanel → Info → Advanced → Cascades
Question
How to use this mechanism for custom transclusion?
For example, assume I want to replace the below code with cascades
<$tiddler tiddler=someTiddler>
<$transclude tiddler="myTemplate" mode="block"/>
</$tiddler>
In the proposed solution I like to have below features
- if
someTiddler
has the fieldhide-body
set to yes, use$:/core/ui/ViewTemplate/body/blank
instead ofmyTemplate
- if
someTiddler
has the fieldcode-body
set to yes, use$:/core/ui/ViewTemplate/body/code
instead ofmyTemplate
- if
someTiddler
has the fieldtemplate-body
set tosomeTemplate
usessomeTemplate
instead ofmyTemplate
(e.g. user sets a custom template throughtemplate-body
field)
…