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

restricted classic transclusion to type text/x-tiddlywiki

This commit is contained in:
buggyj 2014-09-02 08:02:21 +02:00
parent 7b8de4670c
commit e8b85a450d

View File

@ -76,12 +76,23 @@ TranscludeWidget.prototype.execute = function() {
this.transcludeTitle = gettiddlername(this.rawTitle);
this.section = getsectionname(this.rawTitle);
this.slice = getslicename(this.rawTitle);
// Check for recursion
// 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;
}
// Check for correct type
var existingTiddler = this.wiki.getTiddler(this.transcludeTitle);
// Check if we're dealing with a classic tiddler
if(existingTiddler && existingTiddler.hasField("type") && existingTiddler.fields.type !== "text/x-tiddlywiki") {
this.makeChildWidgets([{type: "text", text: "Tiddler not of type 'text/x-tiddlywiki'"}]);
return;
}
if(existingTiddler && !existingTiddler.hasField("type")) {
this.makeChildWidgets([{type: "text", text: "Tiddler not of type 'text/x-tiddlywiki'"}]);
return;
}
// Set context variables for recursion detection
this.setVariable("transclusion",recursionMarker);
// Parse