diff --git a/src/language-html/embed/angular-attributes.js b/src/language-html/embed/angular-attributes.js
index b5f422ec1..7a48447a9 100644
--- a/src/language-html/embed/angular-attributes.js
+++ b/src/language-html/embed/angular-attributes.js
@@ -68,22 +68,23 @@ function printAngularAttribute(path, options) {
return printNgDirective;
}
- const value = getUnescapedAttributeValue(node);
-
/**
* i18n="longDescription"
* i18n-attr="longDescription"
*/
if (/^i18n(?:-.+)?$/u.test(attributeName)) {
- return () =>
- printExpand(
+ return () => {
+ const value = getUnescapedAttributeValue(node);
+ return printExpand(
fill(getTextValueParts(node, value.trim())),
!value.includes("@@"),
);
+ };
}
- if (angularInterpolationRegex.test(value)) {
- return (textToDoc) => printAngularInterpolation(value, textToDoc);
+ if (angularInterpolationRegex.test(node.value)) {
+ return (textToDoc) =>
+ printAngularInterpolation(getUnescapedAttributeValue(node), textToDoc);
}
}
diff --git a/src/language-html/embed/vue-attributes.js b/src/language-html/embed/vue-attributes.js
index 54b659338..de060b97a 100644
--- a/src/language-html/embed/vue-attributes.js
+++ b/src/language-html/embed/vue-attributes.js
@@ -30,11 +30,13 @@ function printVueAttribute(path, options) {
return printVueScriptGenericAttributeValue;
}
- const value = getUnescapedAttributeValue(node);
const parseWithTs = isVueSfcWithTypescriptScript(path, options);
if (isVueSlotAttribute(node) || isVueSfcBindingsAttribute(node, options)) {
- return (textToDoc) => printVueBindings(value, textToDoc, { parseWithTs });
+ return (textToDoc) =>
+ printVueBindings(getUnescapedAttributeValue(node), textToDoc, {
+ parseWithTs,
+ });
}
/**
@@ -45,7 +47,9 @@ function printVueAttribute(path, options) {
*/
if (attributeName.startsWith("@") || attributeName.startsWith("v-on:")) {
return (textToDoc) =>
- printVueVOnDirective(value, textToDoc, { parseWithTs });
+ printVueVOnDirective(getUnescapedAttributeValue(node), textToDoc, {
+ parseWithTs,
+ });
}
/**
@@ -59,14 +63,19 @@ function printVueAttribute(path, options) {
attributeName.startsWith("v-bind:")
) {
return (textToDoc) =>
- printVueVBindDirective(value, textToDoc, { parseWithTs });
+ printVueVBindDirective(getUnescapedAttributeValue(node), textToDoc, {
+ parseWithTs,
+ });
}
/**
* v-if="jsExpression"
*/
if (attributeName.startsWith("v-")) {
- return (textToDoc) => printExpression(value, textToDoc, { parseWithTs });
+ return (textToDoc) =>
+ printExpression(getUnescapedAttributeValue(node), textToDoc, {
+ parseWithTs,
+ });
}
}