kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Update the include macro to use filtering and serializing
rodzic
a753509cbf
commit
e3524942cc
|
@ -13,23 +13,24 @@ module-type: macro
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "^",
|
name: "^",
|
||||||
params: {
|
params: {
|
||||||
target: {byPos: 0, type: "tiddler"},
|
filter: {byPos: 0, type: "filter"},
|
||||||
as: {byPos: 1, as: "text"}
|
as: {byPos: 1, as: "text"}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.executeMacro = function() {
|
exports.executeMacro = function() {
|
||||||
var tiddler = this.hasParameter("target") ? this.wiki.getTiddler(this.params.target) : null,
|
var as = this.params.as || "text/plain";
|
||||||
as = this.params.as,
|
if(this.hasParameter("filter")) {
|
||||||
children = [];
|
var titles = this.wiki.filterTiddlers(this.params.filter),
|
||||||
if(tiddler) {
|
result = [];
|
||||||
as = as || tiddler.fields.as || "text/plain";
|
for(var t=0; t<titles.length; t++) {
|
||||||
children = this.wiki.parseText(as,tiddler.fields.text).tree;
|
result.push(this.wiki.serializeTiddler(this.params.filter,as));
|
||||||
for(var t=0; t<children.length; t++) {
|
|
||||||
children[t].execute(this.parents,this.tiddlerTitle);
|
|
||||||
}
|
}
|
||||||
|
return [$tw.Tree.Element("pre",{},[
|
||||||
|
$tw.Tree.Text(result.join("\n"))
|
||||||
|
])];
|
||||||
}
|
}
|
||||||
return children;
|
return [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue