interpolated strings are literal

This commit is contained in:
ConnorSkees 2020-04-20 11:34:49 -04:00
parent 4ca6e304a5
commit 8f27525536
3 changed files with 13 additions and 1 deletions

View File

@ -707,7 +707,10 @@ pub(crate) fn parse_quoted_string<I: Iterator<Item = Token>>(
if toks.peek().unwrap().kind == '{' {
toks.next();
let interpolation = parse_interpolation(toks, scope, super_selector)?;
s.push_str(&interpolation.node.to_css_string(interpolation.span)?);
s.push_str(&match interpolation.node {
Value::Ident(s, ..) => s,
v => v.to_css_string(interpolation.span)?,
});
continue;
} else {
s.push('#');

View File

@ -43,3 +43,8 @@ test!(
"a {\n color: #{\"a\" 'b'};\n}\n",
"a {\n color: a b;\n}\n"
);
test!(
interpolated_string_literally_inserted,
"a {\n color: \"#{\"\\a\"}\";\n}\n",
"a {\n color: \"\\a\";\n}\n"
);

View File

@ -150,3 +150,7 @@ test!(
allows_escaped_quote_at_start_of_ident,
"a {\n color: \\\"c\\\";\n}\n"
);
test!(
quoted_escaped_newline_unchanged,
"a {\n color: \"\\a\";\n}\n"
);