interpolated strings are literal
This commit is contained in:
parent
4ca6e304a5
commit
8f27525536
@ -707,7 +707,10 @@ pub(crate) fn parse_quoted_string<I: Iterator<Item = Token>>(
|
|||||||
if toks.peek().unwrap().kind == '{' {
|
if toks.peek().unwrap().kind == '{' {
|
||||||
toks.next();
|
toks.next();
|
||||||
let interpolation = parse_interpolation(toks, scope, super_selector)?;
|
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;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
s.push('#');
|
s.push('#');
|
||||||
|
@ -43,3 +43,8 @@ test!(
|
|||||||
"a {\n color: #{\"a\" 'b'};\n}\n",
|
"a {\n color: #{\"a\" 'b'};\n}\n",
|
||||||
"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"
|
||||||
|
);
|
||||||
|
@ -150,3 +150,7 @@ test!(
|
|||||||
allows_escaped_quote_at_start_of_ident,
|
allows_escaped_quote_at_start_of_ident,
|
||||||
"a {\n color: \\\"c\\\";\n}\n"
|
"a {\n color: \\\"c\\\";\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
quoted_escaped_newline_unchanged,
|
||||||
|
"a {\n color: \"\\a\";\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user