From 13fd3ec66f1f91f408f230bbe57290a62a5b6bfe Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 5 May 2012 11:57:08 +0100 Subject: [PATCH] Beginnings of the include macro --- rabbithole/core/modules/macros/include.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rabbithole/core/modules/macros/include.js b/rabbithole/core/modules/macros/include.js index 4633d5e78..dd55f3e61 100644 --- a/rabbithole/core/modules/macros/include.js +++ b/rabbithole/core/modules/macros/include.js @@ -1,5 +1,5 @@ /*\ -title: $:/core/modules/macros/serialize.js +title: $:/core/modules/macros/include.js type: application/javascript module-type: macro @@ -11,12 +11,25 @@ module-type: macro "use strict"; exports.info = { - name: "serialize", - params: {} + name: "^", + params: { + target: {byPos: 0, type: "tiddler"}, + as: {byPos: 1, as: "text"} + } }; 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