variables do not include interpolation
This commit is contained in:
parent
52349fb730
commit
ae0ce9894c
@ -97,7 +97,7 @@ use crate::style::Style;
|
|||||||
pub(crate) use crate::token::Token;
|
pub(crate) use crate::token::Token;
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
devour_whitespace, eat_comment, eat_ident, eat_variable_value, parse_quoted_string,
|
devour_whitespace, eat_comment, eat_ident, eat_variable_value, parse_quoted_string,
|
||||||
read_until_newline, VariableDecl,
|
read_until_newline, VariableDecl, eat_ident_no_interpolation
|
||||||
};
|
};
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
|
|||||||
values.push(toks.next().unwrap());
|
values.push(toks.next().unwrap());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let name = eat_ident(toks, scope, super_selector)?;
|
let name = eat_ident_no_interpolation(toks)?;
|
||||||
if toks.peek().unwrap().kind == ':' {
|
if toks.peek().unwrap().kind == ':' {
|
||||||
toks.next();
|
toks.next();
|
||||||
devour_whitespace(toks);
|
devour_whitespace(toks);
|
||||||
|
@ -15,7 +15,7 @@ use crate::selector::Selector;
|
|||||||
use crate::unit::Unit;
|
use crate::unit::Unit;
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
devour_whitespace, eat_comment, eat_ident, eat_number, parse_interpolation,
|
devour_whitespace, eat_comment, eat_ident, eat_number, parse_interpolation,
|
||||||
parse_quoted_string, read_until_newline,
|
parse_quoted_string, read_until_newline, eat_ident_no_interpolation
|
||||||
};
|
};
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
use crate::Token;
|
use crate::Token;
|
||||||
@ -465,7 +465,7 @@ impl Value {
|
|||||||
}
|
}
|
||||||
'$' => {
|
'$' => {
|
||||||
toks.next();
|
toks.next();
|
||||||
Ok(scope.get_var(&eat_ident(toks, scope, super_selector)?)?)
|
Ok(scope.get_var(&eat_ident_no_interpolation(toks)?)?)
|
||||||
}
|
}
|
||||||
'@' => Err("expected \";\".".into()),
|
'@' => Err("expected \";\".".into()),
|
||||||
'+' => {
|
'+' => {
|
||||||
|
@ -103,3 +103,8 @@ test!(
|
|||||||
// "$vär: foo;\na {\n color: $vär;\n}\n",
|
// "$vär: foo;\na {\n color: $vär;\n}\n",
|
||||||
// "a {\n color: foo;\n}\n"
|
// "a {\n color: foo;\n}\n"
|
||||||
// );
|
// );
|
||||||
|
test!(
|
||||||
|
variable_does_not_include_interpolation,
|
||||||
|
"$input: foo;\na {\n color: $input#{\"literal\"};\n}\n",
|
||||||
|
"a {\n color: foo literal;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user