kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Refactored story macro to use renderTiddler instead of renderText
rodzic
7c4d5b76ef
commit
b671ecdedd
|
@ -17,21 +17,18 @@ exports.macro = {
|
||||||
template: {byName: true, type: "text", optional: true}
|
template: {byName: true, type: "text", optional: true}
|
||||||
},
|
},
|
||||||
code: function(type,tiddler,store,params) {
|
code: function(type,tiddler,store,params) {
|
||||||
var templateType = "text/x-tiddlywiki",
|
var tiddlers = store.getTiddlerText(params.story).split("\n"),
|
||||||
templateText = "<<view text wikified>>",
|
|
||||||
template = params.template ? store.getTiddler(params.template) : null,
|
|
||||||
tiddlers = store.getTiddlerText(params.story).split("\n"),
|
|
||||||
t,
|
t,
|
||||||
output = [];
|
output = [];
|
||||||
if(template) {
|
|
||||||
templateType = template.fields.type;
|
|
||||||
templateText = template.fields.text;
|
|
||||||
}
|
|
||||||
for(t=0; t<tiddlers.length; t++) {
|
for(t=0; t<tiddlers.length; t++) {
|
||||||
var title = tiddlers[t].trim();
|
var title = tiddlers[t].trim();
|
||||||
if(title !== "") {
|
if(title !== "") {
|
||||||
output.push("<article>");
|
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>");
|
output.push("</article>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue