Refactored story macro to use renderTiddler instead of renderText

print-window-tiddler
Jeremy Ruston 2012-01-14 17:24:25 +00:00
rodzic 7c4d5b76ef
commit b671ecdedd
1 zmienionych plików z 6 dodań i 9 usunięć

Wyświetl plik

@ -17,21 +17,18 @@ exports.macro = {
template: {byName: true, type: "text", optional: true}
},
code: function(type,tiddler,store,params) {
var templateType = "text/x-tiddlywiki",
templateText = "<<view text wikified>>",
template = params.template ? store.getTiddler(params.template) : null,
tiddlers = store.getTiddlerText(params.story).split("\n"),
var tiddlers = store.getTiddlerText(params.story).split("\n"),
t,
output = [];
if(template) {
templateType = template.fields.type;
templateText = template.fields.text;
}
for(t=0; t<tiddlers.length; t++) {
var title = tiddlers[t].trim();
if(title !== "") {
output.push("<article>");
output.push(store.renderText(templateType,templateText,"text/html",title));
if(params.template) {
output.push(store.renderTiddler(type,params.template,title));
} else {
output.push(store.renderTiddler(type,title));
}
output.push("</article>");
}
}