mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-18 07:44:51 +00:00
Use the ubertransclude widget for the wikitext transclusion syntax
This commit is contained in:
parent
05b582a202
commit
cd0617f033
@ -34,7 +34,7 @@ exports.parse = function() {
|
|||||||
textRef = $tw.utils.trim(this.match[1]);
|
textRef = $tw.utils.trim(this.match[1]);
|
||||||
// Prepare the transclude widget
|
// Prepare the transclude widget
|
||||||
var transcludeNode = {
|
var transcludeNode = {
|
||||||
type: "transclude",
|
type: "ubertransclude",
|
||||||
attributes: {},
|
attributes: {},
|
||||||
isBlock: true
|
isBlock: true
|
||||||
};
|
};
|
||||||
@ -55,7 +55,7 @@ exports.parse = function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if(template) {
|
if(template) {
|
||||||
transcludeNode.attributes.tiddler = {type: "string", value: template};
|
transcludeNode.attributes["$tiddler"] = {type: "string", value: template};
|
||||||
if(textRef) {
|
if(textRef) {
|
||||||
return [tiddlerNode];
|
return [tiddlerNode];
|
||||||
} else {
|
} else {
|
||||||
@ -63,12 +63,12 @@ exports.parse = function() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(textRef) {
|
if(textRef) {
|
||||||
transcludeNode.attributes.tiddler = {type: "string", value: targetTitle};
|
transcludeNode.attributes["$tiddler"] = {type: "string", value: targetTitle};
|
||||||
if(targetField) {
|
if(targetField) {
|
||||||
transcludeNode.attributes.field = {type: "string", value: targetField};
|
transcludeNode.attributes["$field"] = {type: "string", value: targetField};
|
||||||
}
|
}
|
||||||
if(targetIndex) {
|
if(targetIndex) {
|
||||||
transcludeNode.attributes.index = {type: "string", value: targetIndex};
|
transcludeNode.attributes["$index"] = {type: "string", value: targetIndex};
|
||||||
}
|
}
|
||||||
return [tiddlerNode];
|
return [tiddlerNode];
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,7 +34,7 @@ exports.parse = function() {
|
|||||||
textRef = $tw.utils.trim(this.match[1]);
|
textRef = $tw.utils.trim(this.match[1]);
|
||||||
// Prepare the transclude widget
|
// Prepare the transclude widget
|
||||||
var transcludeNode = {
|
var transcludeNode = {
|
||||||
type: "transclude",
|
type: "ubertransclude",
|
||||||
attributes: {}
|
attributes: {}
|
||||||
};
|
};
|
||||||
// Prepare the tiddler widget
|
// Prepare the tiddler widget
|
||||||
@ -53,7 +53,7 @@ exports.parse = function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if(template) {
|
if(template) {
|
||||||
transcludeNode.attributes.tiddler = {type: "string", value: template};
|
transcludeNode.attributes["$tiddler"] = {type: "string", value: template};
|
||||||
if(textRef) {
|
if(textRef) {
|
||||||
return [tiddlerNode];
|
return [tiddlerNode];
|
||||||
} else {
|
} else {
|
||||||
@ -61,12 +61,12 @@ exports.parse = function() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(textRef) {
|
if(textRef) {
|
||||||
transcludeNode.attributes.tiddler = {type: "string", value: targetTitle};
|
transcludeNode.attributes["$tiddler"] = {type: "string", value: targetTitle};
|
||||||
if(targetField) {
|
if(targetField) {
|
||||||
transcludeNode.attributes.field = {type: "string", value: targetField};
|
transcludeNode.attributes["$field"] = {type: "string", value: targetField};
|
||||||
}
|
}
|
||||||
if(targetIndex) {
|
if(targetIndex) {
|
||||||
transcludeNode.attributes.index = {type: "string", value: targetIndex};
|
transcludeNode.attributes["$index"] = {type: "string", value: targetIndex};
|
||||||
}
|
}
|
||||||
return [tiddlerNode];
|
return [tiddlerNode];
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,17 +134,15 @@ UberTranscludeWidget.prototype.getTransclusionSlotValue = function(name,defaultP
|
|||||||
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
|
Compose a string comprising the title, field and/or index to identify this transclusion for recursion detection
|
||||||
*/
|
*/
|
||||||
UberTranscludeWidget.prototype.makeRecursionMarker = function() {
|
UberTranscludeWidget.prototype.makeRecursionMarker = function() {
|
||||||
|
var attributes = Object.create(null);
|
||||||
|
$tw.utils.each(this.attributes,function(value,name) {
|
||||||
|
attributes[name] = value;
|
||||||
|
});
|
||||||
var output = [];
|
var output = [];
|
||||||
output.push("{");
|
output.push("{");
|
||||||
output.push(this.getVariable("currentTiddler",{defaultValue: ""}));
|
output.push(this.getVariable("currentTiddler",{defaultValue: ""}));
|
||||||
output.push("|");
|
output.push("|");
|
||||||
output.push(this.transcludeTitle || "");
|
output.push(JSON.stringify(attributes));
|
||||||
output.push("|");
|
|
||||||
output.push(this.transcludeField || "");
|
|
||||||
output.push("|");
|
|
||||||
output.push(this.transcludeIndex || "");
|
|
||||||
output.push("|");
|
|
||||||
output.push(this.transcludeSubTiddler || "");
|
|
||||||
output.push("}");
|
output.push("}");
|
||||||
return output.join("");
|
return output.join("");
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user