1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-01 01:33:16 +00:00

Add "transclude" format for the view macro

Uses the value of the field as the title of a tiddler to transclude
This commit is contained in:
Jeremy Ruston 2012-08-23 12:31:16 +01:00
parent c73dee51e8
commit 1d6eba3071

View File

@ -64,6 +64,18 @@ exports.executeMacro = function() {
return link;
}
break;
case "transclude":
if(tiddler && this.params.field && (this.params.field in tiddler.fields)) {
children = this.wiki.parseTiddler(tiddler.fields[this.params.field]).tree;
for(t=0; t<children.length; t++) {
childrenClone.push(children[t].clone());
}
for(t=0; t<childrenClone.length; t++) {
childrenClone[t].execute(parents,this.tiddlerTitle);
}
return $tw.Tree.Element(this.isBlock ? "div" : "span",{},childrenClone);
}
break;
case "wikified":
if(tiddler && this.params.field === "text") {
if(parents.indexOf(tiddler.fields.title) !== -1) {