1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Refactored story macro to use renderTiddler instead of renderText

This commit is contained in:
Jeremy Ruston 2012-01-14 17:24:25 +00:00
parent 7c4d5b76ef
commit b671ecdedd

View File

@ -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>");
}
}