mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
22 lines
563 B
Ruby
22 lines
563 B
Ruby
module Hamlit
|
|
module Parsers
|
|
module Comment
|
|
def parse_comment(scanner)
|
|
raise SyntaxError unless scanner.scan(/\//)
|
|
|
|
ast = [:html, :comment]
|
|
text = (scanner.scan(/.+/) || '').strip
|
|
|
|
if text.empty?
|
|
content = with_indented { parse_lines }
|
|
return ast << [:multi, [:static, "\n"], *content]
|
|
elsif !text.match(/\[.*\]/)
|
|
return ast << [:static, " #{text} "]
|
|
end
|
|
|
|
content = with_indented { parse_lines }
|
|
[:haml, :comment, text, content]
|
|
end
|
|
end
|
|
end
|
|
end
|