interpolation of strings in idents is literal
This commit is contained in:
parent
29886d6845
commit
a6b61082fe
@ -525,9 +525,10 @@ pub(crate) fn eat_ident<I: Iterator<Item = Token>>(
|
||||
if kind == &'{' {
|
||||
toks.next();
|
||||
text.push_str(
|
||||
&parse_interpolation(toks, scope, super_selector)?
|
||||
.node
|
||||
.to_css_string(span)?,
|
||||
&match parse_interpolation(toks, scope, super_selector)?.node {
|
||||
Value::Ident(s, ..) => s,
|
||||
v => v.to_css_string(span)?,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Err(("Expected identifier.", *pos).into());
|
||||
|
@ -165,14 +165,10 @@ impl Value {
|
||||
let mut buf = String::with_capacity(string.len());
|
||||
for c in string.chars() {
|
||||
match c {
|
||||
// TODO: figure out what is going on here
|
||||
// This is adapted from the original dart-sass
|
||||
// code, but in the spec tests it seems that
|
||||
// newlines are not actually treated like this.
|
||||
// '\n' => {
|
||||
// buf.push(' ');
|
||||
// after_newline = true;
|
||||
// }
|
||||
'\n' => {
|
||||
buf.push(' ');
|
||||
after_newline = true;
|
||||
}
|
||||
' ' => {
|
||||
if !after_newline {
|
||||
buf.push(' ');
|
||||
|
@ -53,3 +53,8 @@ test!(
|
||||
"a {\n color: \"#{#{\"\\a\"}}\";\n}\n",
|
||||
"a {\n color: \"\\a\";\n}\n"
|
||||
);
|
||||
test!(
|
||||
interpolated_quoted_newline,
|
||||
"a {\n color: #{\"\\a\"};\n}\n",
|
||||
"a {\n color: ;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user