From ddfa6732a6d85fcccab5d1e6b08b46578d253da0 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 30 Jan 2012 20:04:47 +0000 Subject: [PATCH] Rename render function of macros --- js/WikiStore.js | 10 +++++----- js/WikiTextParseTree.js | 2 +- js/macros/echo.js | 2 +- js/macros/image.js | 2 +- js/macros/info.js | 2 +- js/macros/link.js | 2 +- js/macros/list.js | 2 +- js/macros/slider.js | 2 +- js/macros/story.js | 2 +- js/macros/tiddler.js | 2 +- js/macros/version.js | 2 +- js/macros/view.js | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js/WikiStore.js b/js/WikiStore.js index d0f22ea96..951ade993 100755 --- a/js/WikiStore.js +++ b/js/WikiStore.js @@ -373,13 +373,17 @@ WikiStore.prototype.renderTiddler = function(targetType,title,asTitle,options) { return null; }; +WikiStore.prototype.installMacro = function(macro) { + this.macros[macro.name] = macro; +}; + /* Executes a macro and returns the result */ WikiStore.prototype.renderMacro = function(macroName,targetType,tiddler,params,content) { var macro = this.macros[macroName]; if(macro) { - return macro.handler(targetType,tiddler,this,params,content); + return macro.render(targetType,tiddler,this,params,content); } else { return null; } @@ -443,10 +447,6 @@ WikiStore.prototype.refreshDomNode = function(node,changes,renderer,tiddler) { } }; -WikiStore.prototype.installMacro = function(macro) { - this.macros[macro.name] = macro; -}; - exports.WikiStore = WikiStore; })(); diff --git a/js/WikiTextParseTree.js b/js/WikiTextParseTree.js index e99ac07f3..bde919039 100644 --- a/js/WikiTextParseTree.js +++ b/js/WikiTextParseTree.js @@ -123,7 +123,7 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod type: "StringLiteral", value: name}, type: "PropertyAccess"}, - name: "handler", + name: "render", type: "PropertyAccess"}, "arguments": [ { type: "StringLiteral", diff --git a/js/macros/echo.js b/js/macros/echo.js index 31a71569c..8417d2110 100644 --- a/js/macros/echo.js +++ b/js/macros/echo.js @@ -15,7 +15,7 @@ exports.macro = { params: { text: {byPos: 0, type: "text", optional: false} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { if(type === "text/html") { return utils.htmlEncode(params.text); } else { diff --git a/js/macros/image.js b/js/macros/image.js index 6968c51de..ffba2f742 100644 --- a/js/macros/image.js +++ b/js/macros/image.js @@ -17,7 +17,7 @@ exports.macro = { text: {byName: true, type: "text", optional: true}, alignment: {byName: true, type: "text", optional: true} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { if(type === "text/html") { if(store.tiddlerExists(params.src)) { if(params.text) { diff --git a/js/macros/info.js b/js/macros/info.js index 37d1b056d..33adc0451 100644 --- a/js/macros/info.js +++ b/js/macros/info.js @@ -15,7 +15,7 @@ exports.macro = { params: { info: {byName: "default", type: "text", optional: false} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;}, info = params.info || "parsetree"; if(tiddler) { diff --git a/js/macros/link.js b/js/macros/link.js index 4dc1892a0..13cfc76c9 100644 --- a/js/macros/link.js +++ b/js/macros/link.js @@ -16,7 +16,7 @@ exports.macro = { params: { target: {byName: "default", type: "tiddler", optional: false} }, - handler: function(type,tiddler,store,params,content) { + render: function(type,tiddler,store,params,content) { if(type === "text/html") { return utils.stitchElement("a",{ href: params.target diff --git a/js/macros/list.js b/js/macros/list.js index aff019ab8..a2eab8b6d 100644 --- a/js/macros/list.js +++ b/js/macros/list.js @@ -41,7 +41,7 @@ exports.macro = { template: {byName: true, type: "tiddler", optional: true}, emptyMessage: {byName: true, type: "text", optional: true} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { var templateType = "text/x-tiddlywiki", templateText = "<>", template = params.template ? store.getTiddler(params.template) : null, diff --git a/js/macros/slider.js b/js/macros/slider.js index 4fac2edc8..38793e5aa 100644 --- a/js/macros/slider.js +++ b/js/macros/slider.js @@ -18,7 +18,7 @@ exports.macro = { label: {byPos: 2, type: "text", optional: false}, tooltip: {byPos: 3, type: "text", optional: true} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { if(type === "text/html") { return utils.stitchSlider(type, params.label, diff --git a/js/macros/story.js b/js/macros/story.js index d5d3f9b31..7ad029af4 100644 --- a/js/macros/story.js +++ b/js/macros/story.js @@ -16,7 +16,7 @@ exports.macro = { story: {byName: "default", type: "tiddler", optional: false}, template: {byName: true, type: "tiddler", optional: true} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { var tiddlers = store.getTiddlerText(params.story).split("\n"), t, output = []; diff --git a/js/macros/tiddler.js b/js/macros/tiddler.js index 4ebdf304a..d7fbb57c5 100644 --- a/js/macros/tiddler.js +++ b/js/macros/tiddler.js @@ -53,7 +53,7 @@ exports.macro = { template: {byName: true, type: "tiddler", optional: true}, "with": {byName: true, type: "text", optional: true, dependentAll: true} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { var renderTitle = params.template, renderAs = params.target; // Slightly bewildering logic to sort out the optional parameters diff --git a/js/macros/version.js b/js/macros/version.js index 2398798d0..4c655e163 100644 --- a/js/macros/version.js +++ b/js/macros/version.js @@ -14,7 +14,7 @@ exports.macro = { types: ["text/html","text/plain"], params: { }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { return "5.0.0"; } }; diff --git a/js/macros/view.js b/js/macros/view.js index 3c8cceaba..d54c761c2 100644 --- a/js/macros/view.js +++ b/js/macros/view.js @@ -17,7 +17,7 @@ exports.macro = { format: {byPos: 1, type: "text", optional: true}, template: {byPos: 2, type: "text", optional: true} }, - handler: function(type,tiddler,store,params) { + render: function(type,tiddler,store,params) { var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;}; if(!tiddler) { return "{{** Missing tiddler **}}";