Skip to content

Commit 14b9d58

Browse files
committed
Fix inline link-to with subexpression caption crash
1 parent 842844b commit 14b9d58

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

transforms/angle-brackets/transform.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ function transformToAngleBracket(env, fileInfo, config) {
303303
}
304304

305305
function transformLinkToTextParam(textParam) {
306-
if (textParam.type.includes('Literal')) {
306+
if (textParam.type === 'SubExpression') {
307+
return subExpressionToMustacheStatement(textParam);
308+
} else if (textParam.type.includes('Literal')) {
307309
return b.text(textParam.value);
308310
} else {
309311
return b.mustache(textParam.original);
@@ -466,12 +468,16 @@ function transformToAngleBracket(env, fileInfo, config) {
466468
);
467469
}
468470

471+
function subExpressionToMustacheStatement(subExpression) {
472+
return b.mustache(subExpression.path, subExpression.params, subExpression.hash);
473+
}
474+
469475
return {
470476
MustacheStatement(node) {
471477
// Don't change attribute statements
472478
const isValidMustache =
473479
node.loc.source !== '(synthetic)' && !shouldIgnoreMustacheStatement(node.path.original);
474-
const tagName = node.path.original;
480+
const tagName = node.path && node.path.original;
475481
const isNestedComponent = isNestedComponentTagName(tagName);
476482

477483
if (

0 commit comments

Comments
 (0)