simple question about transclusion and fields

75 views
Skip to first unread message

springer

unread,
Dec 30, 2019, 1:31:07 PM12/30/19
to TiddlyWiki
Deal all,

I realize I'm not yet fluent enough to solve my nested childtabs problem.

So, I'll ask a much simpler question, and crawl up from there...

I'm using fields to hold scores in a multi-aspect grading rubric. 

I can pull info from a tiddler's accuracy field into that tiddler's regular view by using {{!!accuracy}} (and I'm using HarveyBalls to make it look great!)

But then if that whole tiddler gets rendered as a tab within another tiddler, the field reference (as I have it now) breaks, because it's trying to supply the field value for the enclosing tiddler.

What's the TextReference format to use, in the original tiddler, so that the proper bottom-level field values will appear, even in the nested contexts? (I have tried variations on adding || but with no luck so far.)

Mark S.

unread,
Dec 30, 2019, 2:23:17 PM12/30/19
to TiddlyWiki
This problem is referenced in the tabs macro documentation.

Basically, make a template like "tabtemplate" with contents:

<$tiddler tiddler=<<currentTab>>>
<$transclude mode="block" />
</$tiddler>

and then reference it in the macro call, similar to:

<<tabs "[tag[HelloThere]]" template:"tabtemplate">>

springer

unread,
Dec 30, 2019, 2:36:39 PM12/30/19
to TiddlyWiki
Mark,

I did see that the problem is mentioned there... 

I think I understand this much now: the problem is fixed NOT by changing how I refer to the field in the CHILD tiddler, but instead in the way the parent-tiddler (which contains the tab set) handles the tabs? 

Happily, I now see that the out-of-box toc macro is actually handling the fields well when they're low down in nested contexts. So this actually *is* a version of my prior problem, which is how to rewrite my tab-set template so that it becomes properly nestable.

Thanks.

springer

unread,
Dec 30, 2019, 3:16:04 PM12/30/19
to TiddlyWiki
OK, this gets me most of the way there, thanks!... The following string works as I need:

<<tabs "[tag[WritingThisTiddlerTitleManuallyHere]]" template:"tabtemplate">>

Whew... I wonder: Is there a string I can use where I wrote WritingThisTiddlerTitleManuallyHere so that I have a simple copy-paste string that works wherever I put it? 

Typing or pasting {{childtabs}} at the bottom of a tiddler was so simple, but it seems the approach your describing here needs me to type more, and customize each time. (I suppose someone with more chops could do a smart Tiddler Commander search-and-replace to save the time of fixing all the tiddlers that used my broken template, but this new approach is still a bit of a handful to type out on each new tiddler that serves as a tag...)

-Springer


On Monday, December 30, 2019 at 2:23:17 PM UTC-5, Mark S. wrote:

TonyM

unread,
Dec 31, 2019, 10:22:17 PM12/31/19
to TiddlyWiki
Springer

Learning to use tiddlers tagged $:/tags/ViewTemplate is the next step in your self education. They are displayed when viewing a tiddler and can overlay the current tiddler with code that applies to the currentTiddler, can access currentTiddler text and fields.

You can then have your customisable parameter stored in a tiddler field or elsewhere and refer to that instead. Be aware you need other tricks to edit something in the currentTiddler in the view template, tricks the edit tiddler process achieves for us.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages