interpolation in multiline comments
This commit is contained in:
parent
71546d7fc4
commit
cb8be064a9
@ -553,8 +553,8 @@ pub(crate) fn read_until_newline<I: Iterator<Item = Token>>(toks: &mut Peekable<
|
|||||||
/// TODO: support interpolation within multiline comments
|
/// TODO: support interpolation within multiline comments
|
||||||
pub(crate) fn eat_comment<I: Iterator<Item = Token>>(
|
pub(crate) fn eat_comment<I: Iterator<Item = Token>>(
|
||||||
toks: &mut Peekable<I>,
|
toks: &mut Peekable<I>,
|
||||||
_scope: &Scope,
|
scope: &Scope,
|
||||||
_super_selector: &Selector,
|
super_selector: &Selector,
|
||||||
) -> SassResult<Spanned<String>> {
|
) -> SassResult<Spanned<String>> {
|
||||||
let mut comment = String::new();
|
let mut comment = String::new();
|
||||||
let mut span = if let Some(tok) = toks.peek() {
|
let mut span = if let Some(tok) = toks.peek() {
|
||||||
@ -567,6 +567,11 @@ pub(crate) fn eat_comment<I: Iterator<Item = Token>>(
|
|||||||
if tok.kind == '*' && toks.peek().unwrap().kind == '/' {
|
if tok.kind == '*' && toks.peek().unwrap().kind == '/' {
|
||||||
toks.next();
|
toks.next();
|
||||||
break;
|
break;
|
||||||
|
} else if tok.kind == '#' && toks.peek().unwrap().kind == '{' {
|
||||||
|
toks.next();
|
||||||
|
comment
|
||||||
|
.push_str(&parse_interpolation(toks, scope, super_selector)?.to_css_string(span)?);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
comment.push(tok.kind);
|
comment.push(tok.kind);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,17 @@ test!(
|
|||||||
"a {\n /* \n*/\n color: red;\n}\n"
|
"a {\n /* \n*/\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
converts_cr_in_comment,
|
closing_curly_brace_in_comment,
|
||||||
"a {\n color: 1 + // flang }\n blang }",
|
"a {\n color: 1 + // flang }\n blang }",
|
||||||
"a {\n color: 1blang;\n}\n"
|
"a {\n color: 1blang;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
converts_cr_in_comment,
|
||||||
|
"a {\n /* \r*/ color: red;\n}\n",
|
||||||
|
"a {\n /* \n*/\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
interpolation_in_multiline_comment,
|
||||||
|
"$a: foo;/* interpolation #{1 + 1} in #{$a} comments */",
|
||||||
|
"/* interpolation 2 in foo comments */\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user