fix naming of `regex_quoted_value`

pull/7716/head
Ivan Hofer 4 years ago committed by tanhauhau
parent 0c05510677
commit 14584bbbd3

@ -123,7 +123,7 @@ function processed_tag_to_code(
} }
const regex_whitespace = /\s+/; const regex_whitespace = /\s+/;
const regex_unquoted_value = /^['"](.*)['"]$/; const regex_quoted_value = /^['"](.*)['"]$/;
function parse_tag_attributes(str: string) { function parse_tag_attributes(str: string) {
// note: won't work with attribute values containing spaces. // note: won't work with attribute values containing spaces.
@ -133,7 +133,7 @@ function parse_tag_attributes(str: string) {
.reduce((attrs, attr) => { .reduce((attrs, attr) => {
const i = attr.indexOf('='); const i = attr.indexOf('=');
const [key, value] = i > 0 ? [attr.slice(0, i), attr.slice(i + 1)] : [attr]; const [key, value] = i > 0 ? [attr.slice(0, i), attr.slice(i + 1)] : [attr];
const [, unquoted] = (value && value.match(regex_unquoted_value)) || []; const [, unquoted] = (value && value.match(regex_quoted_value)) || [];
return { ...attrs, [key]: unquoted ?? value ?? true }; return { ...attrs, [key]: unquoted ?? value ?? true };
}, {}); }, {});

Loading…
Cancel
Save