convert single quotes to double quotes in calc

This commit is contained in:
Connor Skees 2020-08-17 04:48:11 -04:00
parent 7acaa94870
commit 9548eb6deb
2 changed files with 7 additions and 2 deletions

View File

@ -48,12 +48,12 @@ impl<'a> Parser<'a> {
} }
} }
q @ '\'' | q @ '"' => { q @ '\'' | q @ '"' => {
buf.push(q); buf.push('"');
match self.parse_quoted_string(q)?.node { match self.parse_quoted_string(q)?.node {
Value::String(ref s, ..) => buf.push_str(s), Value::String(ref s, ..) => buf.push_str(s),
_ => unreachable!(), _ => unreachable!(),
} }
buf.push(q); buf.push('"');
} }
c => buf.push(c), c => buf.push(c),
} }

View File

@ -59,6 +59,11 @@ test!(
"a {\n color: calc(\")\");\n}\n", "a {\n color: calc(\")\");\n}\n",
"a {\n color: calc(\")\");\n}\n" "a {\n color: calc(\")\");\n}\n"
); );
test!(
calc_quoted_string_single_quotes,
"a {\n color: calc('a');\n}\n",
"a {\n color: calc(\"a\");\n}\n"
);
test!( test!(
element_whitespace, element_whitespace,
"a {\n color: element( 1 );\n}\n", "a {\n color: element( 1 );\n}\n",