@jeremyruston I have looked at your demo and it works as expected and similar to my code tiddler method.
I have long argued for something similar and found my own solution through the transclusion variable. I was inclined to call it the “code tiddler” because it was where my wikitext code was present.
Concider three tiddlers
transcluding
* Here {{||transcluded}}
* There {{transcluded}}
* [[transcluded]]
transcluded
\define pipe() |
<<transclusion>>
{{{ [<transclusion>split<pipe>nth[2]] }}}
[[deeper]] {{deeper}}
deeper
{{{ [<transclusion>split<pipe>nth[2]] }}}
The {{{ [<transclusion>split<pipe>nth[2]] }}}
will return the tiddler in which it is encoded. What I called the code tiddler.
@twMat I understand where you are coming from and in many ways currentTiddler could be replaced with title, even string. But you can of course;
<$list filter='tiddler +[split[]]' variable=string>
String: <<string>>
</$list>
- The default use of widgets and macros is on the tiddler title, so its not surprising we used currentTiddler as the default variable name.
- It has the side effect that people tend to write macros and transclusions that operate on the currentTiddler which is a useful side effect.
- Although I acknowledge new users may find thinking in “strings”, or non-tiddler titles, a little harder.
- However In the “code Tiddler” or “thisTiddler” example it is explicitly a title of a tiddler, so unlike currentTiddler it perhaps deserves tiddler in its name.
- However @twMat your guidance remains true for future developments and I imagine a little more documentation could help eg in https://tiddlywiki.com/#currentTiddler%20Variable
The default variable for a list and other widgets is often currentTiddler, so it is convenient to write macros that act on the currentTiddler. In other cases it may be more appropriate to use a different variable name, to better reflect the meaning of the variable or to ensure the currentTiddler variable remains untouched.
<$list filter="Mon Tue Wed Thur Fri Sat Sun" variable=day-of-week>
<<day-of-week>> in "<<currentTiddler>>"<br>
</$list>
@jeremyruston since I have had the equivalent of thisTiddler for some time I can share some of the uses for this in addition to;
- An example here is you can write single tiddler buttons that use content in its own fields, however if cloned continue to work.
- I think there is value thinking where this variable would be used and the resulting code structures people will use, because we may be able to provide some helpful shortcuts to making use of this value.
Here is some useful examples, I already use, but also just tested with thisTiddler;
{{{ [{<thisTiddler>] ||$:/core/ui/Buttons/edit }}} Link to edit the tiddler in which this "filtered transclusion" exists.
Conditional: {{{ [{$:/config/design-mode}match[yes]then<thisTiddler>] ||$:/core/ui/Buttons/edit }}}
- The second example is conditional on the design-mode
- I have modified $:/core/ui/Buttons/edit on some occasions such that the tooltip indicates the actual tiddler name it will edit.
- When in design mode, in some of my development wikis, the links to tiddlers deep within viewTemplates, multi-level transclusions all come alive with an edit icon.