diff --git a/core/modules/macros/view/view.js b/core/modules/macros/view/view.js index 31b4e9282..b4e7362a9 100644 --- a/core/modules/macros/view/view.js +++ b/core/modules/macros/view/view.js @@ -25,14 +25,11 @@ exports.info = { exports.executeMacro = function() { var tiddler = this.wiki.getTiddler(this.tiddlerTitle), field = this.hasParameter("field") ? this.params.field : "title", - value, - children, - t, - childrenClone = [], - parents = this.parents; + value; + // Get the value to display if(tiddler) { value = tiddler.fields[field]; - } else { + } else { // Use a special value if the tiddler is missing switch(field) { case "text": value = ""; @@ -49,72 +46,16 @@ exports.executeMacro = function() { break; } } - switch(this.params.format) { - case "link": - if(value === undefined) { - return $tw.Tree.Text(""); - } else { - var link = $tw.Tree.Macro("link",{ - srcParams: {to: value}, - content: [$tw.Tree.Text(value)], - isBlock: this.isBlock, - wiki: this.wiki - }); - link.execute(parents,this.tiddlerTitle); - 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> macro")]; - } else { - children = this.wiki.parseTiddler(tiddler.fields.title).tree; - } - parents = parents.slice(0); - parents.push(tiddler.fields.title); - } else { - children = this.wiki.parseText("text/x-tiddlywiki",value).tree; - } - for(t=0; t> macro")]; + } else { + children = viewMacro.wiki.parseTiddler(tiddler.fields.title).tree; + } + parents = parents.slice(0); + parents.push(tiddler.fields.title); + } else { + children = viewMacro.wiki.parseText("text/x-tiddlywiki",value).tree; + } + // Clone and execute the parsed wikitext + for(t=0; t