kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Fix transclusion recursion detection
We were inadvertantly doing the recursion check before we were checking if the transclusion target exists.print-window-tiddler
rodzic
b9bf1ff574
commit
4743d0a863
|
@ -42,14 +42,6 @@ TranscludeWidget.prototype.execute = function() {
|
||||||
this.transcludeField = this.getAttribute("field");
|
this.transcludeField = this.getAttribute("field");
|
||||||
this.transcludeIndex = this.getAttribute("index");
|
this.transcludeIndex = this.getAttribute("index");
|
||||||
this.transcludeMode = this.getAttribute("mode");
|
this.transcludeMode = this.getAttribute("mode");
|
||||||
// Check for recursion
|
|
||||||
var recursionMarker = this.makeRecursionMarker();
|
|
||||||
if(this.parentWidget && this.parentWidget.hasVariable("transclusion",recursionMarker)) {
|
|
||||||
this.makeChildWidgets([{type: "text", text: "Recursive transclusion error in transclude widget"}]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Set context variables for recursion detection
|
|
||||||
this.setVariable("transclusion",recursionMarker);
|
|
||||||
// Parse the text reference
|
// Parse the text reference
|
||||||
var parseAsInline = !this.parseTreeNode.isBlock;
|
var parseAsInline = !this.parseTreeNode.isBlock;
|
||||||
if(this.transcludeMode === "inline") {
|
if(this.transcludeMode === "inline") {
|
||||||
|
@ -63,6 +55,16 @@ TranscludeWidget.prototype.execute = function() {
|
||||||
this.transcludeIndex,
|
this.transcludeIndex,
|
||||||
{parseAsInline: parseAsInline}),
|
{parseAsInline: parseAsInline}),
|
||||||
parseTreeNodes = parser ? parser.tree : this.parseTreeNode.children;
|
parseTreeNodes = parser ? parser.tree : this.parseTreeNode.children;
|
||||||
|
// Set context variables for recursion detection
|
||||||
|
var recursionMarker = this.makeRecursionMarker();
|
||||||
|
this.setVariable("transclusion",recursionMarker);
|
||||||
|
// Check for recursion
|
||||||
|
if(parser) {
|
||||||
|
if(this.parentWidget && this.parentWidget.hasVariable("transclusion",recursionMarker)) {
|
||||||
|
parseTreeNodes = [{type: "text", text: "Recursive transclusion error in transclude widget"}];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Construct the child widgets
|
// Construct the child widgets
|
||||||
this.makeChildWidgets(parseTreeNodes);
|
this.makeChildWidgets(parseTreeNodes);
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue