Fixed the view macro to reuse the link macro

print-window-tiddler
Jeremy Ruston 2012-01-15 13:37:50 +00:00
rodzic 1e05d673b1
commit 4681d14f39
2 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -357,6 +357,18 @@ WikiStore.prototype.renderTiddler = function(targetType,title,asTitle) {
return null; 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 Refresh a DOM node so that it reflects the current state of the store

Wyświetl plik

@ -23,12 +23,7 @@ exports.macro = {
if(v) { if(v) {
switch(params.format) { switch(params.format) {
case "link": case "link":
if(type === "text/html") { return store.renderMacro("link",type,tiddler,{target: v});
return "<a href='" + encoder(v) + "'" + store.classesForLink(v) + ">" + encoder(v) + "</a>";
} else {
return v;
}
break; // JSHint wants this even though it's not really necessary
case "wikified": case "wikified":
return store.renderTiddler(type,tiddler.fields.title); return store.renderTiddler(type,tiddler.fields.title);
case "date": case "date":