Allow for macros and classes at both run level and block level

Involving a bit of a refactoring of the parameters to the
$tw.Tree.Macro constructor
This commit is contained in:
Jeremy Ruston
2012-05-28 15:51:52 +01:00
parent aa4d435a67
commit 49a3cb8ede
18 changed files with 89 additions and 50 deletions
-1
View File
@@ -14,7 +14,6 @@ Zooming chooser macro
exports.info = {
name: "chooser",
wrapperTag: "div",
params: {
},
events: ["touchstart","touchmove","touchend","mouseover","mousemove","mouseup","mouseout"]
+4 -5
View File
@@ -79,11 +79,10 @@ exports.getSliderChildren = function() {
if(this.hasParameter("content")) {
return this.wiki.parseText("text/x-tiddlywiki",this.params.content).tree;
} else if(this.hasParameter("target")) {
return [$tw.Tree.Macro(
"tiddler",
{target: this.params.target},
null,
this.wiki)];
return [$tw.Tree.Macro("tiddler",{
srcParams: {target: this.params.target},
wiki: this.wiki
})];
} else {
return [$tw.Tree.errorNode("No content specified for slider")];
}
+8 -8
View File
@@ -148,10 +148,10 @@ exports.executeMacro = function() {
var storyJson = JSON.parse(this.wiki.getTiddlerText(this.params.story)),
storyNode = $tw.Tree.Element("div",{},[]);
for(var t=0; t<storyJson.tiddlers.length; t++) {
var m = $tw.Tree.Macro("tiddler",
{target: storyJson.tiddlers[t].title,template: storyJson.tiddlers[t].template},
null,
this.wiki);
var m = $tw.Tree.Macro("tiddler",{
srcParams: {target: storyJson.tiddlers[t].title,template: storyJson.tiddlers[t].template},
wiki: this.wiki
});
m.execute(this.parents,this.tiddlerTitle);
storyNode.children.push($tw.Tree.Element("div",{},[m]));
}
@@ -199,10 +199,10 @@ exports.refreshInDom = function(changes) {
if(tiddlerNode === null) {
// If not, render the tiddler
var m = $tw.Tree.Element("div",{},[
$tw.Tree.Macro("tiddler",
{target: story.tiddlers[t].title,template: story.tiddlers[t].template},
null,
this.wiki)
$tw.Tree.Macro("tiddler",{
srcParams: {target: story.tiddlers[t].title,template: story.tiddlers[t].template},
wiki: this.wiki
})
]);
m.execute(this.parents,this.tiddlerTitle);
m.renderInDom(this.children[0].domNode,this.children[0].domNode.childNodes[t]);
+5 -4
View File
@@ -54,10 +54,11 @@ exports.executeMacro = function() {
if(value === undefined) {
return [];
} else {
var link = $tw.Tree.Macro("link",
{to: value},
[$tw.Tree.Text(value)],
this.wiki);
var link = $tw.Tree.Macro("link",{
srcParams: {to: value},
content: [$tw.Tree.Text(value)],
wiki: this.wiki
});
link.execute(parents,this.tiddlerTitle);
return [link];
}
-1
View File
@@ -14,7 +14,6 @@ Zooming navigator macro
exports.info = {
name: "zoomer",
wrapperTag: "div",
params: {
},
events: ["touchstart","touchmove","touchend"]