Transclude via template *field* - does it work in short form?

92 views
Skip to first unread message

Mat

unread,
Jul 5, 2019, 7:10:04 AM7/5/19
to TiddlyWiki
Does this example from the doc "Transclusion in WikiText" really work?

{{MyTiddler||MyTemplate!!myField}} generates the following pair of widgets:

<$tiddler tiddler="MyTiddler">
<$transclude tiddler="MyTemplate" field="myField"/>
</$tiddler>

First, it should be "myfield" and not "myField" but what I'm questioning is if it at all works to specify a field for the template in the short double braces form?

The explicit expression works but the braces one doesn't AFAICT, or?

<:-)

PMario

unread,
Jul 5, 2019, 8:48:04 AM7/5/19
to TiddlyWiki
 Hi,

It doesn't. ... and I think it doesn't make sense either.

-


Mat

unread,
Jul 5, 2019, 11:41:50 AM7/5/19
to TiddlyWiki
Thanks. I made a PR.

<:-)

TonyM

unread,
Jul 5, 2019, 7:43:56 PM7/5/19
to TiddlyWiki
Just an aside

I use the transclusions of field content a lot but of note I often have replaceable values so that I write reusable code. Ie the tiddler name or field name varies.

Now this is an ongoing frustration for me because allmost every method or syntax documented has literals for tiddlername filenames etc.. And it is not always straitforward to add replaceable values.

Regards
Tony

Mat

unread,
Jul 5, 2019, 7:51:40 PM7/5/19
to TiddlyWiki
allmost every method or syntax documented has literals for tiddlername filenames etc.. And it is not always straitforward to add replaceable values.

...so are you saying the examples should be in the form

{{$(tiddler)$!!$(field)$}}

or what are you suggesting?

<:-)

TonyM

unread,
Jul 5, 2019, 11:24:23 PM7/5/19
to tiddl...@googlegroups.com
That we also provide such examples.

The one you show must be in a macro I believe, others work outside macros, in widgets and others do not.

If for no other reason we have an example to copy to clipboard,

Regards
Tony

Mat

unread,
Jul 6, 2019, 8:27:57 AM7/6/19
to TiddlyWiki
TonyM wrote:
That we also provide such examples.
...
If for no other reason we have an example to copy to clipboard,

That would have to be a lot of extra examples if you want them directly useful. One with $direct$, another with $(indirect)$ a third with both, etc.

I'm not saying it's undoable or even a bad idea but we can't expect it for tiddlywiki.com (or who would do all the pr's?). IMO the only reasonable way to get a comprehensive, or at least a large, collection of such examples is TWederation that would allow for gradually accumulated and collectively contributed such examples. It is a huge difference between making a PR to github and to merely, say, tag a tiddler in your own connected wiki to allow it to be publicly accessible. (Because that is how sharing could be done.)

...any year now ;-)

<:-)

TonyM

unread,
Jul 7, 2019, 3:54:16 AM7/7/19
to TiddlyWiki
Mat,

I am not suggesting we document every permutation of replaceable parameters but that most examples include at least one especially when the appropriate ones are limited. I also think a full macrocall version for macros also makes sense because it can contain all the key=value pairs for parameters so we can copy it, paste it and alter the parameters as needed. The macrocall version works well with most replaceable parameters.

When there are different forms of a widget they could be spelt out in an example.

The gap we need to address is examples with only literals do not demonstrate the best approach to coding.

When a designer creates a macro to capture the parameters to supply one or more widgets they open the design to allow the passing of parameters of most variables etc...

Personally I am happy to raise the Push requests or documentation changes because it saves me time in the end.

Using the double curly braces raised in this thread only the $(var)$ and $var$ are workable and they only operate in macros. Also using {{||template}} is easy because it assumes currentTiddler so a good design pattern is to write most macros to operate on current Tiddler. If we can give users these hints in the doco I think we reduce the barriers to adoption.

Personally I find most of the examples illustrative but I never use them because they contain named tiddlers and are unusable in any way except specific cases, Not in global macros or the view template.

regards
Tony

Reply all
Reply to author
Forward
0 new messages