mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-08 23:03:50 +00:00
Added ability to suppress the wrapper HTML nodes required by the refresh circuitry
This commit is contained in:
parent
6066b5cf89
commit
b0fc3d4668
@ -20,9 +20,11 @@ var Tiddler = require("./Tiddler.js").Tiddler,
|
|||||||
|
|
||||||
Available options are:
|
Available options are:
|
||||||
shadowStore: An existing WikiStore to use for shadow tiddler storage. Pass null to prevent a default shadow store from being created
|
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) {
|
var WikiStore = function WikiStore(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
this.disableHtmlWrapperNodes = !!options.disableHtmlWrapperNodes;
|
||||||
this.tiddlers = {}; // Hashmap of tiddlers by title
|
this.tiddlers = {}; // Hashmap of tiddlers by title
|
||||||
this.parsers = {}; // Hashmap of parsers by accepted MIME type
|
this.parsers = {}; // Hashmap of parsers by accepted MIME type
|
||||||
this.macros = {}; // Hashmap of macros by macro name
|
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) {
|
WikiStore.prototype.renderTiddler = function(targetType,title,asTitle,options) {
|
||||||
options = 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),
|
tiddler = this.getTiddler(title),
|
||||||
renderer = this.compileTiddler(title,targetType),
|
renderer = this.compileTiddler(title,targetType),
|
||||||
renditions = this.getCacheForTiddler(title,"renditions",function() {
|
renditions = this.getCacheForTiddler(title,"renditions",function() {
|
||||||
|
@ -177,7 +177,7 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod
|
|||||||
renderStep.dependencies = node.dependencies;
|
renderStep.dependencies = node.dependencies;
|
||||||
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" && !this.store.disableHtmlWrapperNodes) {
|
||||||
pushString(output,utils.stitchElement(wrapperTag,{
|
pushString(output,utils.stitchElement(wrapperTag,{
|
||||||
"data-tw-macro": name,
|
"data-tw-macro": name,
|
||||||
"data-tw-render-step": renderStepIndex
|
"data-tw-render-step": renderStepIndex
|
||||||
@ -202,7 +202,7 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod
|
|||||||
value: renderStepIndex
|
value: renderStepIndex
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
if(type === "text/html") {
|
if(type === "text/html" && !this.store.disableHtmlWrapperNodes) {
|
||||||
pushString(output,"</" + wrapperTag + ">");
|
pushString(output,"</" + wrapperTag + ">");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user