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:
parent
fbd0357cae
commit
a10106a4a6
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user