1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-02 10:13:16 +00:00

Fixed the view macro to reuse the link macro

This commit is contained in:
Jeremy Ruston 2012-01-15 13:37:50 +00:00
parent 1e05d673b1
commit 4681d14f39
2 changed files with 13 additions and 6 deletions

View File

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

View File

@ -23,12 +23,7 @@ exports.macro = {
if(v) {
switch(params.format) {
case "link":
if(type === "text/html") {
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
return store.renderMacro("link",type,tiddler,{target: v});
case "wikified":
return store.renderTiddler(type,tiddler.fields.title);
case "date":