diff --git a/core/modules/macros/list/list.js b/core/modules/macros/list/list.js index 98b83248d..70ed219f3 100644 --- a/core/modules/macros/list/list.js +++ b/core/modules/macros/list/list.js @@ -20,9 +20,7 @@ exports.info = { filter: {byName: true, type: "filter"}, history: {byName: true, type: "tiddler"}, template: {byName: true, type: "tiddler"}, - templateText: {byName: true, type: "text"}, editTemplate: {byName: true, type: "tiddler"}, - editTemplateText: {byName: true, type: "text"}, emptyMessage: {byName: true, type: "text"}, listviewTiddler: {byName: true, type: "tiddler"}, listview: {byName: true, type: "text"}, @@ -145,28 +143,32 @@ Create the tiddler macro needed to represent a given tiddler exports.createListElementMacro = function(title) { // Check if the tiddler is a draft var tiddler = this.wiki.getTiddler(title), - draft = tiddler ? tiddler.hasField("draft.of") : false; + isDraft = tiddler ? tiddler.hasField("draft.of") : false; // Figure out the template to use var template = this.params.template, - templateText = this.params.templateText; - if(draft && this.hasParameter("editTemplate")) { + templateTree = undefined; + if(isDraft && this.hasParameter("editTemplate")) { template = this.params.editTemplate; } - if(draft && this.hasParameter("editTemplateText")) { - template = this.params.editTemplateText; - } - // Check for no template specified - if(!template && !templateText) { - templateText = "<>"; + // Check for not having a template + if(!template) { + if(this.content.length > 0) { + // Use our content as the template + templateTree = this.content; + } else { + // Use default content + var defaultTemplate = "<>"; + templateTree = this.wiki.parseText("text/vnd.tiddlywiki",defaultTemplate).tree; + } } // Create the tiddler macro return $tw.Tree.Macro("tiddler",{ srcParams: { target: title, - template: template, - templateText: templateText + template: template }, - wiki: this.wiki + wiki: this.wiki, + content: templateTree }); }; diff --git a/core/modules/macros/tiddler.js b/core/modules/macros/tiddler.js index 60b5b4904..71e68167c 100644 --- a/core/modules/macros/tiddler.js +++ b/core/modules/macros/tiddler.js @@ -58,7 +58,6 @@ exports.info = { target: {byName: "default", type: "tiddler"}, targetVia: {byName: true, type: "tiddler"}, template: {byName: true, type: "tiddler"}, - templateText: {byName: true, type: "text"}, "with": {byName: true, type: "text", dependentAll: true} } }; @@ -98,8 +97,8 @@ exports.executeMacro = function() { renderTitle = this.tiddlerTitle; } // Get the render tree for the template - if(this.hasParameter("templateText")) { - renderTemplateTree = this.wiki.parseText("text/vnd.tiddlywiki",this.params.templateText).tree; + if(this.content.length > 0) { + renderTemplateTree = this.content; } else { if(this.hasParameter("template")) { renderTemplateTitle = this.params.template; diff --git a/core/modules/parsers/wikitextparser/rules/transclude.js b/core/modules/parsers/wikitextparser/rules/transclude.js index 035e12c85..38ac8e9ef 100644 --- a/core/modules/parsers/wikitextparser/rules/transclude.js +++ b/core/modules/parsers/wikitextparser/rules/transclude.js @@ -34,7 +34,7 @@ exports.parse = function(match,isBlock) { match = regExp.exec(this.source); if(match && match.index === this.pos) { this.pos = match.index + match[0].length; - var macro, params = {}; + var macro, params = {}, parseTree; // Check if it is a single tiddler if(match[1]) { macro = "tiddler"; @@ -48,11 +48,12 @@ exports.parse = function(match,isBlock) { params.template = match[3]; } if(match[4]) { - params.templateText = match[4]; + parseTree = this.wiki.parseText("text/vnd.tiddlywiki",match[4]).tree; } return [$tw.Tree.Macro(macro,{ srcParams: params, - wiki: this.wiki + wiki: this.wiki, + content: parseTree })]; } return [];