mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Allow comment indentation
This commit is contained in:
parent
f8d8158792
commit
158866c94e
2 changed files with 11 additions and 6 deletions
|
@ -5,21 +5,28 @@ module Hamlit
|
|||
class PrettyCompiler < Compiler
|
||||
def initialize(*)
|
||||
super
|
||||
@tag_indent = 0
|
||||
@indent_level = 0
|
||||
@whitespace_compiler = Whitespace::IndentedCompiler.new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compile_children(node)
|
||||
@whitespace_compiler.compile_children(node, @tag_indent) { |n| compile(n) }
|
||||
@whitespace_compiler.compile_children(node, @indent_level) { |n| compile(n) }
|
||||
end
|
||||
|
||||
def compile_comment(node)
|
||||
@indent_level += 1
|
||||
super
|
||||
ensure
|
||||
@indent_level -= 1
|
||||
end
|
||||
|
||||
def compile_tag(node)
|
||||
@tag_indent += 1
|
||||
@indent_level += 1
|
||||
super
|
||||
ensure
|
||||
@tag_indent -= 1
|
||||
@indent_level -= 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -790,7 +790,6 @@ class PrettyTest < MiniTest::Test
|
|||
end
|
||||
|
||||
def test_a_nested_markup_comment
|
||||
skip
|
||||
haml = %q{/
|
||||
comment
|
||||
comment2}
|
||||
|
@ -808,7 +807,6 @@ class PrettyTest < MiniTest::Test
|
|||
|
||||
class Conditionalcomments < MiniTest::Test
|
||||
def test_a_conditional_comment
|
||||
skip
|
||||
haml = %q{/[if IE]
|
||||
%p a}
|
||||
html = %q{<!--[if IE]>
|
||||
|
|
Loading…
Add table
Reference in a new issue