1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 19:39:57 +00:00
TiddlyWiki5/rabbithole/core/modules/macros/include.js
2012-05-05 11:57:08 +01:00

37 lines
732 B
JavaScript

/*\
title: $:/core/modules/macros/include.js
type: application/javascript
module-type: macro
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.info = {
name: "^",
params: {
target: {byPos: 0, type: "tiddler"},
as: {byPos: 1, as: "text"}
}
};
exports.executeMacro = function() {
var tiddler = this.hasParameter("target") ? this.wiki.getTiddler(this.params.target) : null,
as = this.params.as,
children = [];
if(tiddler) {
as = as || tiddler.fields.as || "text/plain";
children = this.wiki.parseText(as,tiddler.fields.text).tree;
for(var t=0; t<children.length; t++) {
children[t].execute(this.parents,this.tiddlerTitle);
}
}
return children;
};
})();