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:
parent
7c4d5b76ef
commit
b671ecdedd
@ -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>");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user