1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-05 02:10:45 +00:00
TiddlyWiki5/rabbithole/core/modules/macros/include.js

37 lines
732 B
JavaScript
Raw Normal View History

/*\
2012-05-05 10:57:08 +00:00
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 = {
2012-05-05 10:57:08 +00:00
name: "^",
params: {
target: {byPos: 0, type: "tiddler"},
as: {byPos: 1, as: "text"}
}
};
exports.executeMacro = function() {
2012-05-05 10:57:08 +00:00
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;
};
})();