mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-01 13:00:49 +00:00
e2a0955ced
Used to be called "code". And associated documentation changes
41 lines
831 B
JavaScript
41 lines
831 B
JavaScript
/*\
|
|
title: js/macros/story.js
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true */
|
|
"use strict";
|
|
|
|
var utils = require("../Utils.js");
|
|
|
|
exports.macro = {
|
|
name: "story",
|
|
types: ["text/html","text/plain"],
|
|
params: {
|
|
story: {byName: "default", type: "text", optional: false},
|
|
template: {byName: true, type: "text", optional: true}
|
|
},
|
|
handler: function(type,tiddler,store,params) {
|
|
var tiddlers = store.getTiddlerText(params.story).split("\n"),
|
|
t,
|
|
output = [];
|
|
for(t=0; t<tiddlers.length; t++) {
|
|
var title = tiddlers[t].trim();
|
|
if(title !== "") {
|
|
output.push("<article>");
|
|
if(params.template) {
|
|
output.push(store.renderTiddler(type,params.template,title));
|
|
} else {
|
|
output.push(store.renderTiddler(type,title));
|
|
}
|
|
output.push("</article>");
|
|
}
|
|
}
|
|
return output.join("\n");
|
|
}
|
|
};
|
|
|
|
})();
|
|
|