I (re)discovered the built-in translink macro recently, and it looks like something I’d use all the time in various templates for tabs and other list-based goodies. Almost always, when I have a transclusion, it’s great to see the title of the transcluded tiddler, to have the link for it right there at the top, and to have an easy visual recognition of the extent/shape of the transclusion.
I see some improvements to this macro were initiated 18+ months ago, in this thread…
But in a couple further ways, it seems translink could still be improved (and is of limited use until then)…:
(1) Let title default to currentTiddler...
The translink macro currently requires the specification of a title (it’s not optional), which is odd. The logic of most other macros and widgets happily defaults to the currentTiddler, as in <<tag>>
and <$link/>
etc.
I do see that I could set a variable to build a workaround, or invoke translink in the long-form macro transclusion format, as in the following (which works at tw-com, with caveat noted below)…
<$list filter="[tag[$:/tags/Stylesheet]]" >
<$transclude $variable="translink" title=<<currentTiddler>> />
</$list>
… but I’d love for <<translink>>
short form to “just work” within a list, because that would be beautiful and elegant. I’ve often put elements together to achieve a similar effect (within tabbed TOC, detail accordions, lists), but it’s cumbersome…
I suspect I see why this default is awkward — namely because if you accidentally invoked it outside the context of a list or other transclusion, you’d end up with an instant russian-doll self-transclusion problem. (Remarkably enough, explicitly self-translinking does NOT crash tiddlywiki dot com, though! It seems to draw further nested iterations only on demand, as one scrolls down, which is very cool!)
At any rate, surely it would be possible to sandbox the self-reference somehow, so that title variable defaults to currentTiddler-ONLYIF-currentTiddler-doesn’t-match-storyTiddler? Or so that translink rendering is halted by a protective “recursive transclusion” alert when storyTiddler includes a “naked” invocation of <<translink>>
(or somehow self-references within a list widget, etc.)?
(2) Get translink display to harness cascade conditions
The translink macro doesn’t currently seem to harness the cascade conditions for displaying the transcluded tiddler (in terms of whether/how its view template elements appear). Again, I can and do have workarounds to get the effects I’m looking for, but shouldn’t tapping into the existing cascade be a convenient and powerful feature of translink?
Using the example above at tw-com — the things in the filter condition [tag[$:/tags/Stylesheet]]
should all ignore wikitext according to the cascade (so backticks show as backticks, etc. when you open these tiddlers in story river) — but you can see the translink content does NOT follow the that cascade condition for stylesheets.
Of course, there’s already a kind of translink-specific template applied to the body text (the styling that makes it look like the transcluded tiddler text is within a kind of blockquote), but surely we could nest the cascade-obedient rendering of a tiddler within a generic “here’s your recognizable translink” frame?
So…
What do you all think? Do you use translink? Would you use it more, if it did more powerful things out of the box without extra keystrokes?
(PS You can tell my academic semester is over when I show up here for more than a flyover!)