Class: Hpricot::Comment

Inherits:
Object show all
Defined in:
lib/haml/html.rb

Overview

See Also:

Instance Method Summary collapse

Instance Method Details

#to_haml(tabs, options) ⇒ Object



206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/haml/html.rb', line 206

def to_haml(tabs, options)
  content = self.content
  if content =~ /\A(\[[^\]]+\])>(.*)<!\[endif\]\z/m
    condition = $1
    content = $2
  end

  if content.include?("\n")
    "#{tabulate(tabs)}/#{condition}\n#{parse_text(content, tabs + 1)}"
  else
    "#{tabulate(tabs)}/#{condition} #{content.strip}"
  end
end