1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-23 07:26:54 +00:00

Rename render function of macros

This commit is contained in:
Jeremy Ruston 2012-01-30 20:04:47 +00:00
parent 350ad5bf3b
commit ddfa6732a6
12 changed files with 16 additions and 16 deletions

View File

@ -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;
})();

View File

@ -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",

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {

View File

@ -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

View File

@ -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 = "<<view title link>>",
template = params.template ? store.getTiddler(params.template) : null,

View File

@ -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,

View File

@ -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 = [];

View File

@ -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

View File

@ -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";
}
};

View File

@ -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 **}}";