mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-06 22:04:19 +00:00
Fix crash when transcluding an undefined variable
Thanks @pmario See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1114692359
This commit is contained in:
parent
fbd0357cae
commit
a10106a4a6
@ -172,23 +172,25 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
|
|||||||
var parser;
|
var parser;
|
||||||
if(this.transcludeVariable) {
|
if(this.transcludeVariable) {
|
||||||
var variableInfo = this.getVariableInfo(this.transcludeVariable).srcVariable;
|
var variableInfo = this.getVariableInfo(this.transcludeVariable).srcVariable;
|
||||||
parser = this.wiki.parseText(this.transcludeType,variableInfo.value || "",{parseAsInline: !this.parseTreeNode.isBlock});
|
if(variableInfo) {
|
||||||
if(parser && variableInfo.isFunctionDefinition) {
|
parser = this.wiki.parseText(this.transcludeType,variableInfo.value || "",{parseAsInline: !this.parseTreeNode.isBlock});
|
||||||
parser = {
|
if(parser && variableInfo.isFunctionDefinition) {
|
||||||
tree: [
|
parser = {
|
||||||
{
|
tree: [
|
||||||
type: "parameters",
|
{
|
||||||
children: parser.tree,
|
type: "parameters",
|
||||||
attributes: {},
|
children: parser.tree,
|
||||||
orderedAttributes: []
|
attributes: {},
|
||||||
}
|
orderedAttributes: []
|
||||||
]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
$tw.utils.each(variableInfo.variableParams,function(param,index) {
|
||||||
|
var attr = {name: param.name, type: "string", value: param["default"]};
|
||||||
|
parser.tree[0].attributes[param.name] = attr;
|
||||||
|
parser.tree[0].orderedAttributes.push(attr);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
$tw.utils.each(variableInfo.variableParams,function(param,index) {
|
|
||||||
var attr = {name: param.name, type: "string", value: param["default"]};
|
|
||||||
parser.tree[0].attributes[param.name] = attr;
|
|
||||||
parser.tree[0].orderedAttributes.push(attr);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parser = this.wiki.parseTextReference(
|
parser = this.wiki.parseTextReference(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user