1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-30 01:03:16 +00:00

Hack the list widget

Usually the list transcludes each tiddler through the sample template.
This hack makes it work differently, where each tiddler is used as a
template to render the same current tiddler. The attribute that
switches modes is called "hackTemplate" because this is a temporary
implementation of this capability for experimental purposes
This commit is contained in:
Jeremy Ruston 2013-08-21 20:50:08 +01:00
parent 67c1d2cf55
commit 8cbb98d44d

View File

@ -198,16 +198,22 @@ ListWidget.prototype.createListElementTransclusion = function(title) {
}
}
// Create the transclude widget
return {
var widget = {
type: "element",
tag: "$transclude",
isBlock: this.renderer.parseTreeNode.isBlock,
attributes: {
target: {type: "string", value: title},
template: {type: "string", value: template}
},
attributes: {},
children: templateTree
};
// Set the target if needed
if(!this.renderer.hasAttribute("hackTemplate")) {
widget.attributes.target = {type: "string", value: title};
widget.attributes.template = {type: "string", value: template};
} else {
widget.attributes.template = {type: "string", value: title};
widget.children = undefined;
}
return widget;
};
/*