mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-24 10:37:20 +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]);
|
||||
// Prepare the transclude widget
|
||||
var transcludeNode = {
|
||||
type: "transclude",
|
||||
type: "ubertransclude",
|
||||
attributes: {},
|
||||
isBlock: true
|
||||
};
|
||||
@ -55,7 +55,7 @@ exports.parse = function() {
|
||||
};
|
||||
}
|
||||
if(template) {
|
||||
transcludeNode.attributes.tiddler = {type: "string", value: template};
|
||||
transcludeNode.attributes["$tiddler"] = {type: "string", value: template};
|
||||
if(textRef) {
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
@ -63,12 +63,12 @@ exports.parse = function() {
|
||||
}
|
||||
} else {
|
||||
if(textRef) {
|
||||
transcludeNode.attributes.tiddler = {type: "string", value: targetTitle};
|
||||
transcludeNode.attributes["$tiddler"] = {type: "string", value: targetTitle};
|
||||
if(targetField) {
|
||||
transcludeNode.attributes.field = {type: "string", value: targetField};
|
||||
transcludeNode.attributes["$field"] = {type: "string", value: targetField};
|
||||
}
|
||||
if(targetIndex) {
|
||||
transcludeNode.attributes.index = {type: "string", value: targetIndex};
|
||||
transcludeNode.attributes["$index"] = {type: "string", value: targetIndex};
|
||||
}
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
|
@ -34,7 +34,7 @@ exports.parse = function() {
|
||||
textRef = $tw.utils.trim(this.match[1]);
|
||||
// Prepare the transclude widget
|
||||
var transcludeNode = {
|
||||
type: "transclude",
|
||||
type: "ubertransclude",
|
||||
attributes: {}
|
||||
};
|
||||
// Prepare the tiddler widget
|
||||
@ -53,7 +53,7 @@ exports.parse = function() {
|
||||
};
|
||||
}
|
||||
if(template) {
|
||||
transcludeNode.attributes.tiddler = {type: "string", value: template};
|
||||
transcludeNode.attributes["$tiddler"] = {type: "string", value: template};
|
||||
if(textRef) {
|
||||
return [tiddlerNode];
|
||||
} else {
|
||||
@ -61,12 +61,12 @@ exports.parse = function() {
|
||||
}
|
||||
} else {
|
||||
if(textRef) {
|
||||
transcludeNode.attributes.tiddler = {type: "string", value: targetTitle};
|
||||
transcludeNode.attributes["$tiddler"] = {type: "string", value: targetTitle};
|
||||
if(targetField) {
|
||||
transcludeNode.attributes.field = {type: "string", value: targetField};
|
||||
transcludeNode.attributes["$field"] = {type: "string", value: targetField};
|
||||
}
|
||||
if(targetIndex) {
|
||||
transcludeNode.attributes.index = {type: "string", value: targetIndex};
|
||||
transcludeNode.attributes["$index"] = {type: "string", value: targetIndex};
|
||||
}
|
||||
return [tiddlerNode];
|
||||
} 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
|
||||
*/
|
||||
UberTranscludeWidget.prototype.makeRecursionMarker = function() {
|
||||
var attributes = Object.create(null);
|
||||
$tw.utils.each(this.attributes,function(value,name) {
|
||||
attributes[name] = value;
|
||||
});
|
||||
var output = [];
|
||||
output.push("{");
|
||||
output.push(this.getVariable("currentTiddler",{defaultValue: ""}));
|
||||
output.push("|");
|
||||
output.push(this.transcludeTitle || "");
|
||||
output.push("|");
|
||||
output.push(this.transcludeField || "");
|
||||
output.push("|");
|
||||
output.push(this.transcludeIndex || "");
|
||||
output.push("|");
|
||||
output.push(this.transcludeSubTiddler || "");
|
||||
output.push(JSON.stringify(attributes));
|
||||
output.push("}");
|
||||
return output.join("");
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user