[TW5] Multi-level transclusion

137 views
Skip to first unread message

William RENOU

unread,
Jul 31, 2016, 6:14:49 PM7/31/16
to TiddlyWiki
I was wondering if transcluding content accross several levels was possible ?
Here's what I'm trying to do :

RootTiddler (A)
+ L1SubTiddler (Aa)
  + L2SubTiddler (Aa1)
  + L2SubTiddler (Aa2)
+ L1SubTiddler (Ab)
  + L2SubTiddler (Ab1)
+ L1SubTiddler (Ac)

Both root-level tiddlers and level 1 subtitlers are displayed using viewTemplates. Level 2 tiddlers are transcluded in their Level 1 parent, transcluded again in the root Tiddler.
But for some reason, while directly viewing a L1 tiddler displays its L2 contents, opening the root Tiddler only displays the Level 1 contents.

Jed Carty

unread,
Jul 31, 2016, 6:32:25 PM7/31/16
to TiddlyWiki
What you want is almost certainly possible, but you need to give more information about what is going on. You describe sometihng like how the threaded comments are displayed in twederation here, but I can't give you anything specific without more information.

Eric Shulman

unread,
Jul 31, 2016, 6:34:17 PM7/31/16
to TiddlyWiki
Show some code, please.  Or, better still, post your document online somewhere.
Then perhaps we can see what you are *actually* doing... rather than just reading a description of what you *want* to do.

-e
Eric Shulman
TiddlyTools / ELS Design Studios
InsideTiddlyWiki: The Missing Manuals


William RENOU

unread,
Jul 31, 2016, 6:35:54 PM7/31/16
to TiddlyWiki
What more information do you need ?

William RENOU

unread,
Jul 31, 2016, 7:22:41 PM7/31/16
to TiddlyWiki
Here's my root tiddler viewTemplate :
<$list filter="[is[current]tag[rootTag]]">

  <$list filter="[tag[L1Tag]field:someField{!!title}]]">

    ! {{!!title}}
    <<<
    {{!!text}}
    <<<
  </$list>

</$list>

Here's my level 1 viewTemplate :
<$list filter="[is[current]tag[L1Tag]]">

  <$list filter="[tag[L2Tag]field:someField{!!someValue}]">

    !! {{!!title}}
    <<<
    {{!!text}}
    <<<
  </$list>

</$list>

There's a field reference from level 1 tiddlers to the root Tiddler (using the root tiddler's title). Sames goes for L2 to L1 : it's referencing an ID on the L1 tiddler.
My first idea was to remove the block quotes, but it hasn't solved the issue of content not showing.

Mark S.

unread,
Jul 31, 2016, 9:39:24 PM7/31/16
to TiddlyWiki
Well, I can see what the problem is, but I don't see what the solution is other than putting a template (e.g. {{||L1Template}}) into each L1 object.. Hopefully one of the gurus will have the magic.

At the Level 1 level, the template works because the Level 2 objects have actual content.

At the Root level, it doesn't work (well, it works, but doesn't do what you wanted it to do) because there's nothing actually in the Level 1 objects. You were hoping that it would bring in the rendered L1 objects, but instead it's bringing in the contents of the L1 object(s) -- which are empty.

If there is a workaround that would allow you to bring in the rendered contents of tiddler displayed via $:/tags/ViewTemplate it would be great to learn about it.

Good luck!
Mark

William RENOU

unread,
Aug 1, 2016, 6:37:54 AM8/1/16
to TiddlyWiki
I tried putting the viewTiddler code from L1 directly into the tiddler, and it works perfectly. But I'd need to put the same code in each and every tiddler of the same type.
Possible workaround : instead of calling L2 through L1 from Root, maybe calling both of them from Root might work, like a nested list ?

Mark S.

unread,
Aug 1, 2016, 9:57:30 AM8/1/16
to TiddlyWiki
The two solutions I know of:

1. Put a transclusion reference to the template in each L1 tiddler (e.g. {{||L1Template}}). That way you don't duplicate all the code.
2. Rewrite the Root code with additional sub-lists so that it displays the way you intended.
Reply all
Reply to author
Forward
0 new messages