mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-24 02:27:19 +00:00
Beginnings of the include macro
This commit is contained in:
parent
5333658624
commit
13fd3ec66f
@ -1,5 +1,5 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/macros/serialize.js
|
title: $:/core/modules/macros/include.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: macro
|
module-type: macro
|
||||||
|
|
||||||
@ -11,12 +11,25 @@ module-type: macro
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "serialize",
|
name: "^",
|
||||||
params: {}
|
params: {
|
||||||
|
target: {byPos: 0, type: "tiddler"},
|
||||||
|
as: {byPos: 1, as: "text"}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.executeMacro = function() {
|
exports.executeMacro = function() {
|
||||||
return [];
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user