1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Added wrapper around macro invocations

This commit is contained in:
Jeremy Ruston 2012-01-24 18:10:51 +00:00
parent 527b750714
commit 889bdbc82a

View File

@ -178,10 +178,10 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod
renderStep.handler = eval(this.store.jsParser.createTree(macroCall).render()); renderStep.handler = eval(this.store.jsParser.createTree(macroCall).render());
var wrapperTag = macro.wrapperTag || "div"; var wrapperTag = macro.wrapperTag || "div";
if(type === "text/html") { if(type === "text/html") {
pushString(output,utils.stitchElement(wrapperTag,{ pushString(output,"<" + wrapperTag +
"data-tw-macro": name //, " data-tw-macro='" + name + "' data-tw-render-step='" + renderStepIndex + "' data-tw-render-tiddler='");
//"data-tw-render-step": renderStepIndex output.push({type: "PropertyAccess", name: "title", base: {type: "Variable", name: "tiddler"}});
})); pushString(output,"'>");
} }
output.push({ output.push({
type: "FunctionCall", type: "FunctionCall",
@ -319,7 +319,7 @@ WikiTextParseTree.prototype.toString = function(type) {
})); }));
var v = node.params[f].value; var v = node.params[f].value;
if(node.params[f].type === "string") { if(node.params[f].type === "string") {
v = utils.stringify(v); v = '"' + utils.stringify(v) + '"';
} else if(node.params[f].type === "eval") { } else if(node.params[f].type === "eval") {
v = "{{" + v + "}}"; v = "{{" + v + "}}";
} }
@ -365,7 +365,7 @@ WikiTextParseTree.prototype.toString = function(type) {
classNames: (typeof v === "object") ? ["label"] : ["splitLabel","splitLabelLeft"] classNames: (typeof v === "object") ? ["label"] : ["splitLabel","splitLabelLeft"]
})); }));
if(typeof v === "string") { if(typeof v === "string") {
v = utils.stringify(v); v = '"' + utils.stringify(v) + '"';
} else if(v instanceof Array) { } else if(v instanceof Array) {
v = v.join("; "); v = v.join("; ");
} }