mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] [SCSS] Make sure multiple adjacent silent Sass comments count as a single block.
This commit is contained in:
parent
d5a0c8ecd4
commit
7974a92aae
2 changed files with 30 additions and 0 deletions
|
@ -301,6 +301,7 @@ MSG
|
|||
|
||||
def append_children(parent, children, root)
|
||||
continued_rule = nil
|
||||
continued_comment = nil
|
||||
children.each do |line|
|
||||
child = build_tree(parent, line, root)
|
||||
|
||||
|
@ -323,6 +324,17 @@ MSG
|
|||
continued_rule, child = nil, continued_rule
|
||||
end
|
||||
|
||||
if child.is_a?(Tree::CommentNode) && child.silent
|
||||
if continued_comment &&
|
||||
child.line == continued_comment.line +
|
||||
continued_comment.value.count("\n") + 1
|
||||
continued_comment.value << "\n" << child.value
|
||||
next
|
||||
end
|
||||
|
||||
continued_comment = child
|
||||
end
|
||||
|
||||
check_for_no_children(child)
|
||||
validate_and_append_child(parent, child, line, root)
|
||||
end
|
||||
|
|
|
@ -252,6 +252,24 @@ SASS
|
|||
foo bar {
|
||||
a: b; }
|
||||
SCSS
|
||||
|
||||
assert_sass_to_scss <<SCSS, <<SASS
|
||||
// foo
|
||||
// bar
|
||||
// baz
|
||||
// bang
|
||||
|
||||
foo bar {
|
||||
a: b; }
|
||||
SCSS
|
||||
// foo
|
||||
// bar
|
||||
// baz
|
||||
// bang
|
||||
|
||||
foo bar
|
||||
a: b
|
||||
SASS
|
||||
end
|
||||
|
||||
def test_loud_comments
|
||||
|
|
Loading…
Add table
Reference in a new issue