diff --git a/js/WikiStore.js b/js/WikiStore.js index 5a0d54bbb..4d0703365 100755 --- a/js/WikiStore.js +++ b/js/WikiStore.js @@ -357,6 +357,18 @@ WikiStore.prototype.renderTiddler = function(targetType,title,asTitle) { return null; }; +/* +Executes a macro and returns the result +*/ +WikiStore.prototype.renderMacro = function(macroName,targetType,tiddler,params) { + var macro = this.macros[macroName]; + if(macro) { + return macro.handler(targetType,tiddler,this,params); + } else { + return null; + } +} + /* Refresh a DOM node so that it reflects the current state of the store diff --git a/js/macros/view.js b/js/macros/view.js index 5faa960a4..364eb6d6f 100644 --- a/js/macros/view.js +++ b/js/macros/view.js @@ -23,12 +23,7 @@ exports.macro = { if(v) { switch(params.format) { case "link": - if(type === "text/html") { - return "" + encoder(v) + ""; - } else { - return v; - } - break; // JSHint wants this even though it's not really necessary + return store.renderMacro("link",type,tiddler,{target: v}); case "wikified": return store.renderTiddler(type,tiddler.fields.title); case "date":