1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-02 08:50:46 +00:00

Added ability to suppress the wrapper HTML nodes required by the refresh circuitry

This commit is contained in:
Jeremy Ruston 2012-01-30 18:26:05 +00:00
parent 6066b5cf89
commit b0fc3d4668
2 changed files with 5 additions and 3 deletions

View File

@ -20,9 +20,11 @@ var Tiddler = require("./Tiddler.js").Tiddler,
Available options are:
shadowStore: An existing WikiStore to use for shadow tiddler storage. Pass null to prevent a default shadow store from being created
disableHtmlWrapperNodes: If true will suppress the generation of the wrapper nodes used by the refresh and diagnostic machinery
*/
var WikiStore = function WikiStore(options) {
options = options || {};
this.disableHtmlWrapperNodes = !!options.disableHtmlWrapperNodes;
this.tiddlers = {}; // Hashmap of tiddlers by title
this.parsers = {}; // Hashmap of parsers by accepted MIME type
this.macros = {}; // Hashmap of macros by macro name
@ -342,7 +344,7 @@ store.renderTiddler("text/html",templateTitle,tiddlerTitle)
*/
WikiStore.prototype.renderTiddler = function(targetType,title,asTitle,options) {
options = options || {};
var stitcher = ((targetType === "text/html") && !options.noWrap) ? utils.stitchElement : function(a,b,c) {return c.content;},
var stitcher = ((targetType === "text/html") && !options.noWrap && !this.disableHtmlWrapperNodes) ? utils.stitchElement : function(a,b,c) {return c.content;},
tiddler = this.getTiddler(title),
renderer = this.compileTiddler(title,targetType),
renditions = this.getCacheForTiddler(title,"renditions",function() {

View File

@ -177,7 +177,7 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod
renderStep.dependencies = node.dependencies;
renderStep.handler = eval(this.store.jsParser.createTree(macroCall).render());
var wrapperTag = macro.wrapperTag || "div";
if(type === "text/html") {
if(type === "text/html" && !this.store.disableHtmlWrapperNodes) {
pushString(output,utils.stitchElement(wrapperTag,{
"data-tw-macro": name,
"data-tw-render-step": renderStepIndex
@ -202,7 +202,7 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod
value: renderStepIndex
}]
});
if(type === "text/html") {
if(type === "text/html" && !this.store.disableHtmlWrapperNodes) {
pushString(output,"</" + wrapperTag + ">");
}
};