1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-07 04:24:22 +00:00

Restored operation of sliders in info macro

Accidentally clobbered in the last refactoring
This commit is contained in:
Jeremy Ruston 2012-02-02 18:15:59 +00:00
parent 58ab36ef51
commit 15cfed83f4
2 changed files with 22 additions and 8 deletions

View File

@ -15,6 +15,14 @@ exports.macro = {
params: { params: {
info: {byName: "default", type: "text", optional: false} info: {byName: "default", type: "text", optional: false}
}, },
events: {
click: function(event,node,tiddler,store,params) {
var el = node.firstChild.firstChild.nextSibling;
el.style.display = el.style.display === "block" ? "none" : "block";
event.preventDefault();
return false;
}
},
render: function(type,tiddler,store,params) { render: function(type,tiddler,store,params) {
var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;}, var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;},
info = params.info || "parsetree"; info = params.info || "parsetree";
@ -22,18 +30,23 @@ exports.macro = {
var parseTree = store.parseTiddler(tiddler.title); var parseTree = store.parseTiddler(tiddler.title);
switch(info) { switch(info) {
case "parsetree": case "parsetree":
return utils.stitchSlider(type,"Parse tree","The parse tree for this tiddler",parseTree.toString(type)); return utils.stitchSlider(type,
"Parse tree",
"The parse tree for this tiddler",
parseTree.toString(type));
//break; //break;
case "compiled": case "compiled":
return utils.stitchSlider(type,"Render functions","The render functions for this tiddler",parseTree.compile(type).toString(type)); return utils.stitchSlider(type,
"Render functions",
"The render functions for this tiddler",
parseTree.compile(type).toString(type));
//break; //break;
case "dependencies": case "dependencies":
if(parseTree.dependencies === null) { return utils.stitchSlider(type,
return encoder("Dependencies: *"); "Dependencies",
} else { "The dependencies for this tiddler",
return encoder("Dependencies: " + parseTree.dependencies.join(", ")); (parseTree.dependencies === null) ? "*" : encoder(parseTree.dependencies.join(", ")));
} //break;
break;
} }
} }
} }

View File

@ -8,4 +8,5 @@ modifier: JeremyRuston
{{body{ {{body{
<<view text wikified>>}}} <<view text wikified>>}}}
<<info parsetree>> <<info parsetree>>
<<info dependencies>>
<<info compiled>> <<info compiled>>