From 4681d14f392d073ecc7eac09d789ff44a4609a19 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sun, 15 Jan 2012 13:37:50 +0000 Subject: [PATCH] Fixed the view macro to reuse the link macro --- js/WikiStore.js | 12 ++++++++++++ js/macros/view.js | 7 +------ 2 files changed, 13 insertions(+), 6 deletions(-) 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":