Skip to content

Commit

Permalink
Merge commit 'chriseppstein/stable' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Feb 26, 2009
2 parents 5e09c48 + edc4c78 commit d19db97
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions lib/sass/engine.rb
Expand Up @@ -136,13 +136,27 @@ def render_to_tree
def split_lines
@line = 0
old_tabs = nil
last_line_was_comment = false
@template.each_with_index do |line, index|
@line += 1

tabs = count_tabs(line)

if line[0] == COMMENT_CHAR && line[1] == SASS_COMMENT_CHAR && tabs == 0
tabs = old_tabs
last_line_was_comment = true
elsif last_line_was_comment && tabs
if tabs > 0
context = "On line #{@line}"
context << " of #{@options[:filename]}" if @options[:filename]
warn <<ENDENDEND
DEPRECATION WARNING:
#{context}
Silent comments (//) in version 2.2 will comment out the lines indented beneath them.
Please indent line #{@line - 1} to match the surrounding indentation level
ENDENDEND
end
last_line_was_comment = false
end

if tabs # if line isn't blank
Expand Down
8 changes: 7 additions & 1 deletion test/sass/engine_test.rb
Expand Up @@ -98,7 +98,13 @@ def test_exceptions
end

def test_exception_line
to_render = "rule\n :attr val\n// comment!\n\n :broken\n"
to_render = <<SASS
rule
:attr val
// comment!
:broken
SASS
begin
Sass::Engine.new(to_render).render
rescue Sass::SyntaxError => err
Expand Down
1 change: 0 additions & 1 deletion test/sass/templates/complex.sass
Expand Up @@ -79,7 +79,6 @@ body
:margin 0 5px
:padding 5px 5px 0 5px
:display inline
// This comment is in the middle of this rule
:font-size 1.1em
// This comment is properly indented
:color #fff
Expand Down

0 comments on commit d19db97

Please sign in to comment.