What is the benefit of transclude widget with filter, beyond {{!xx}} syntax?

I learn from Add icon to default page layout and show in switcher · Jermolene/TiddlyWiki5@34643a4 · GitHub @jeremyruston that, this is better:

<$transclude tiddler={{{ [<currentTiddler>get[icon]] }}}/>

(transclude widget + Filtered Transclusion + variable as a filter parameter )

Than:

{{!!icon}}

in some ways, I guess is the readability?

With the transclude widget you can explicitly set the mode to block or inline for a field value, which AFAIK is not possible with the short notation

I see, in Transclusion question - #2 by jeremyruston

That was not intentional; I’d started with a more complex filter expression and then refactored it without noticing that it could be simplified further. In general, the core tries to use the most concise syntax, while balancing readability. As @telumire says, the main advantage of using the widget is the ability to control the parse mode.

As is common in many fields, what is best is context and audience dependant.

  • Simple and easy to read is the best if possible
    • Although avoiding the need for special knowledge to read it is unwise
  • But if you need to add ease of customisation, tweak ability, hackability and customisation then you may “spell it out”.
  • When code gets dependant on the presence of a blank line etc… it is difficult for people to see the presence of a blank line or its absence. For you it may be fine fore others it may be better to do it another way.

So writing code for myself I write the way I understand it, for others I write for a broader audience. I do this as a rule because I want my code usable buy others.

  • It is also easy to self document in tiddlywiki
1 Like