Closed schnittchen closed 10 years ago
Hi @schnittchen the reason that you cannot specify a template within a transcluded attribute is that the transcluded text is not wikified; you just get back the raw text of the specified tiddler. That means that templates have no meaning - one uses a template by wikifying it and rendering it with the current tiddler variable set to the target tiddler.
Can you describe your use case in a little more detail?
So roughly, transcluding a tiddler at different places in the parse tree (tag position in wikitext vs. tag attribute value position) has different meaning? Is this somehow related to content type handling?
I have built something here that relies on recursion, and thus needs to be done with tiddler rendering (since I do not yet want to got the javascript route for my problem). Essentially I am getting back a list of tiddlers, and I want to use it as a filter argument to a list widget. Is there another way to achive that without using javascript macros or modules?
So roughly, transcluding a tiddler at different places in the parse tree (tag position in wikitext vs. tag attribute value position) has different meaning? Is this somehow related to content type handling?
It's not related to content type handling. The limitations stem from performance concerns. Transclusion is relatively slow (it involves parsing the target tiddler). That's OK when you transclude a tiddler, since we can cache the parse tree for the tiddler. If we wikified transcluded attributes (ie parsed and rendered them) we wouldn't be able to cache the parse trees. That's why the standard behaviour is that transcluded attributes are not wikified. I do want to add an extended. syntax for specifying that the attribute be wikified.
I have built something here that relies on recursion, and thus needs to be done with tiddler rendering (since I do not yet want to got the javascript route for my problem). Essentially I am getting back a list of tiddlers, and I want to use it as a filter argument to a list widget. Is there another way to achive that without using javascript macros or modules?
Not exactly. Can you give a concrete example of what you're trying to achieve?
I am trying to model an ancestry chain... say a tiddler has a "type" attribute (which references a tiddler), and that type has an ancestor and so on. Eventually, I need to $list-iterate over this ancestry chain.
I understand the performance decision. My next attempt will involve some javascript :)
say a tiddler has a "type" attribute
You'd need to use a field name other than "type", which is reserved for the content type of the tiddler.
Anyhow, it sounds like you might want to explore writing a filter operator. They are mostly pretty straightforward array manipulation functions:
https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/filters
Cool, thanks for the advice! I'm closing this issue now.
@Jermolene, has such a filter been written that would traverse a field reference recursively, expecting tiddler titles or tiddlylinks and stopping the recursion when...
field
or field-value
are undefined
, null
or ""
title
is already in the traverse-tree, so as to avoid a pesky infinite loop...returning a list of tiddlers, perhaps excluding the current tiddler?
@tobibeer there's nothing like that at the moment. There's automatic protection against recursive transclusion, but there's no protection for recursive macros getting into an infinite loop.
This is specific to the {{||template}} kind of transclusion and looks like a bug to me:
I have a simple Tiddler named [[ListTiddler]] which contains plain text (actually, links to other tiddlers using [[..]]), and in Wikitext I can render it liks {{||ListTiddler}}. Since ListTiddler's content is static, I could have rendered it as {{ListTiddler}} as well...
NOW I expected to be able to do this:
and achive the same (I want to do more complicated things with the ListTiddler later on), but nothing is rendered here. Changing to
value={{ListTiddler}}
makes it work (but is not sufficient for the magic I want to achive later on).