1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +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:
jeremy@jermolene.com 2022-05-02 11:15:18 +01:00
parent fbd0357cae
commit a10106a4a6

View File

@ -172,23 +172,25 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
var parser;
if(this.transcludeVariable) {
var variableInfo = this.getVariableInfo(this.transcludeVariable).srcVariable;
parser = this.wiki.parseText(this.transcludeType,variableInfo.value || "",{parseAsInline: !this.parseTreeNode.isBlock});
if(parser && variableInfo.isFunctionDefinition) {
parser = {
tree: [
{
type: "parameters",
children: parser.tree,
attributes: {},
orderedAttributes: []
}
]
if(variableInfo) {
parser = this.wiki.parseText(this.transcludeType,variableInfo.value || "",{parseAsInline: !this.parseTreeNode.isBlock});
if(parser && variableInfo.isFunctionDefinition) {
parser = {
tree: [
{
type: "parameters",
children: parser.tree,
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 {
parser = this.wiki.parseTextReference(