diff --git a/core/modules/startup/render.js b/core/modules/startup/render.js index fc93bcdb3..7ec6ec444 100644 --- a/core/modules/startup/render.js +++ b/core/modules/startup/render.js @@ -21,7 +21,7 @@ exports.synchronous = true; // Default story and history lists var PAGE_TITLE_TITLE = "$:/core/wiki/title"; var PAGE_STYLESHEET_TITLE = "$:/core/ui/PageStylesheet"; -var PAGE_TEMPLATE_TITLE = "$:/core/ui/PageTemplate"; +var PAGE_TEMPLATE_TITLE = "$:/core/ui/RootTemplate"; // Time (in ms) that we defer refreshing changes to draft tiddlers var DRAFT_TIDDLER_TIMEOUT_TITLE = "$:/config/Drafts/TypingTimeout"; @@ -52,7 +52,7 @@ exports.startup = function() { })); // Display the $:/core/ui/PageTemplate tiddler to kick off the display $tw.perf.report("mainRender",function() { - $tw.pageWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TEMPLATE_TITLE,{document: document, parentWidget: $tw.rootWidget}); + $tw.pageWidgetNode = $tw.wiki.makeTranscludeWidget(PAGE_TEMPLATE_TITLE,{document: document, parentWidget: $tw.rootWidget, recursionMarker: "no"}); $tw.pageContainer = document.createElement("div"); $tw.utils.addClass($tw.pageContainer,"tc-page-container-wrapper"); document.body.insertBefore($tw.pageContainer,document.body.firstChild); diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 7af61fc8e..1af7f9c42 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -43,6 +43,7 @@ TranscludeWidget.prototype.execute = function() { this.transcludeField = this.getAttribute("field"); this.transcludeIndex = this.getAttribute("index"); this.transcludeMode = this.getAttribute("mode"); + this.recursionMarker = this.getAttribute("recursionMarker","yes"); // Parse the text reference var parseAsInline = !this.parseTreeNode.isBlock; if(this.transcludeMode === "inline") { @@ -61,7 +62,9 @@ TranscludeWidget.prototype.execute = function() { parseTreeNodes = parser ? parser.tree : this.parseTreeNode.children; // Set context variables for recursion detection var recursionMarker = this.makeRecursionMarker(); - this.setVariable("transclusion",recursionMarker); + if(this.recursionMarker === "yes") { + this.setVariable("transclusion",recursionMarker); + } // Check for recursion if(parser) { if(this.parentWidget && this.parentWidget.hasVariable("transclusion",recursionMarker)) { diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 9fb5166b0..b7718cac2 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -1004,6 +1004,7 @@ title: target tiddler title options: as for wiki.makeWidget() plus: options.field: optional field to transclude (defaults to "text") options.mode: transclusion mode "inline" or "block" +options.recursionMarker : optional flag to set a recursion marker, defaults to "yes" options.children: optional array of children for the transclude widget options.importVariables: optional importvariables filter string for macros to be included options.importPageMacros: optional boolean; if true, equivalent to passing "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]" to options.importVariables @@ -1027,10 +1028,17 @@ exports.makeTranscludeWidget = function(title,options) { parseTreeTransclude = { type: "transclude", attributes: { + recursionMarker: { + name: "recursionMarker", + type: "string", + value: options.recursionMarker || "yes" + }, tiddler: { name: "tiddler", type: "string", - value: title}}, + value: title + } + }, isBlock: !options.parseAsInline}; if(options.importVariables || options.importPageMacros) { if(options.importVariables) { diff --git a/core/ui/RootTemplate.tid b/core/ui/RootTemplate.tid new file mode 100644 index 000000000..a0af69a70 --- /dev/null +++ b/core/ui/RootTemplate.tid @@ -0,0 +1,3 @@ +title: $:/core/ui/RootTemplate + +<$transclude tiddler={{{ [{$:/layout}has[text]] ~[[$:/core/ui/PageTemplate]] }}} mode="inline"/> \ No newline at end of file