2012-05-05 10:24:45 +00:00
|
|
|
/*\
|
2012-05-05 10:57:08 +00:00
|
|
|
title: $:/core/modules/macros/include.js
|
2012-05-05 10:24:45 +00:00
|
|
|
type: application/javascript
|
|
|
|
module-type: macro
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
exports.info = {
|
2012-05-08 14:11:53 +00:00
|
|
|
name: "include",
|
2012-05-05 10:57:08 +00:00
|
|
|
params: {
|
2012-05-05 12:15:59 +00:00
|
|
|
filter: {byPos: 0, type: "filter"},
|
2012-05-08 14:11:53 +00:00
|
|
|
as: {byPos: 1, as: "text"},
|
|
|
|
shadow: {byPos: 2, as: "text"}
|
2012-05-05 10:57:08 +00:00
|
|
|
}
|
2012-05-05 10:24:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.executeMacro = function() {
|
2012-05-08 14:11:53 +00:00
|
|
|
var as = this.params.as || "text/plain",
|
|
|
|
wiki = this.hasParameter("shadow") ? this.wiki.shadows : this.wiki;
|
2012-05-05 12:15:59 +00:00
|
|
|
if(this.hasParameter("filter")) {
|
2012-05-08 14:11:53 +00:00
|
|
|
var titles = wiki.filterTiddlers(this.params.filter),
|
2012-05-05 12:15:59 +00:00
|
|
|
result = [];
|
|
|
|
for(var t=0; t<titles.length; t++) {
|
2012-05-05 13:16:34 +00:00
|
|
|
result.push(this.wiki.serializeTiddler(titles[t],as));
|
2012-05-05 10:57:08 +00:00
|
|
|
}
|
2012-05-05 12:15:59 +00:00
|
|
|
return [$tw.Tree.Element("pre",{},[
|
|
|
|
$tw.Tree.Text(result.join("\n"))
|
|
|
|
])];
|
2012-05-05 10:57:08 +00:00
|
|
|
}
|
2012-05-05 12:15:59 +00:00
|
|
|
return [];
|
2012-05-05 10:24:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
})();
|