mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] [Convert] Convert comments to start with // or * in the indented syntax.
Closes gh-122
This commit is contained in:
parent
b7b3df8cdf
commit
29ffc39b8f
4 changed files with 28 additions and 20 deletions
|
@ -58,6 +58,13 @@ Note that since underscores may still be used in place of hyphens
|
|||
when referring to mixins and variables,
|
||||
this won't cause any backwards-incompatibilities.
|
||||
|
||||
#### Sass Comment Format
|
||||
|
||||
When converting to the indented syntax,
|
||||
each line of comments past the first begins with either `//` (for Sass comments)
|
||||
or ` *` (for CSS comments).
|
||||
This prevents some whitespace errors.
|
||||
|
||||
### Minor Changes
|
||||
|
||||
Indented-syntax `/*` comments may now include `*` on lines beyond the first,
|
||||
|
|
|
@ -59,10 +59,11 @@ module Sass::Tree
|
|||
else
|
||||
content.gsub!(/\n( \*|\/\/)/, "\n ")
|
||||
spaces = content.scan(/\n( *)/).map {|s| s.first.size}.min
|
||||
sep = silent ? "\n//" : "\n *"
|
||||
if spaces >= 2
|
||||
content
|
||||
content.gsub(/\n /, sep)
|
||||
else
|
||||
content.gsub(/\n#{' ' * spaces}/, "\n ")
|
||||
content.gsub(/\n#{' ' * spaces}/, sep)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -251,9 +251,9 @@ SCSS
|
|||
|
||||
assert_renders <<SASS, <<SCSS
|
||||
// foo
|
||||
bar
|
||||
baz
|
||||
bang
|
||||
// bar
|
||||
// baz
|
||||
// bang
|
||||
|
||||
foo bar
|
||||
a: b
|
||||
|
@ -309,9 +309,9 @@ SCSS
|
|||
|
||||
assert_scss_to_sass <<SASS, <<SCSS
|
||||
/* foo
|
||||
bar
|
||||
baz
|
||||
bang
|
||||
* bar
|
||||
* baz
|
||||
* bang
|
||||
|
||||
foo bar
|
||||
a: b
|
||||
|
@ -337,9 +337,9 @@ SCSS
|
|||
|
||||
assert_renders <<SASS, <<SCSS
|
||||
/* foo
|
||||
bar
|
||||
baz
|
||||
bang
|
||||
* bar
|
||||
* baz
|
||||
* bang
|
||||
|
||||
foo bar
|
||||
a: b
|
||||
|
@ -358,8 +358,8 @@ SCSS
|
|||
assert_scss_to_sass <<SASS, <<SCSS
|
||||
foo
|
||||
/* foo
|
||||
bar
|
||||
baz
|
||||
* bar
|
||||
* baz
|
||||
a: b
|
||||
SASS
|
||||
foo {
|
||||
|
@ -387,8 +387,8 @@ SASS
|
|||
def test_immediately_preceding_comments
|
||||
assert_renders <<SASS, <<SCSS
|
||||
/* Foo
|
||||
Bar
|
||||
Baz
|
||||
* Bar
|
||||
* Baz
|
||||
.foo#bar
|
||||
a: b
|
||||
SASS
|
||||
|
@ -401,8 +401,8 @@ SCSS
|
|||
|
||||
assert_renders <<SASS, <<SCSS
|
||||
// Foo
|
||||
Bar
|
||||
Baz
|
||||
// Bar
|
||||
// Baz
|
||||
=foo
|
||||
a: b
|
||||
SASS
|
||||
|
|
|
@ -105,20 +105,20 @@ elephant.rawr
|
|||
rampages: excessively
|
||||
|
||||
/* actual multiline
|
||||
comment
|
||||
*comment
|
||||
|
||||
span.turkey
|
||||
isdinner: true
|
||||
|
||||
.turducken
|
||||
/* Sounds funny
|
||||
doesn't it
|
||||
* doesn't it
|
||||
chimera: not_really
|
||||
|
||||
#overhere
|
||||
bored: sorta
|
||||
/* it's for a good
|
||||
cause
|
||||
* cause
|
||||
better_than: thread_pools
|
||||
|
||||
#one_more
|
||||
|
|
Loading…
Reference in a new issue