Class: Hamlit::HTML::Pretty

Inherits:
Temple::HTML::Pretty
  • Object
show all
Includes:
Concerns::Deprecation
Defined in:
lib/hamlit/html/pretty.rb

Constant Summary

Constants included from Concerns::Deprecation

Concerns::Deprecation::DEPCATED_OPTIONS

Instance Method Summary collapse

Methods included from Concerns::Deprecation

#initialize, #rewrite_deprecated_options

Instance Method Details

#call(exp) ⇒ Object



13
14
15
16
17
# File 'lib/hamlit/html/pretty.rb', line 13

def call(exp)
  result = super(exp)
  result << [:static, "\n"] if @added_newline
  result
end

#on_html_tag(name, attrs, content = nil) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/hamlit/html/pretty.rb', line 28

def on_html_tag(name, attrs, content = nil)
  if content.is_a?(Array) && content.first != :multi
    return parse_oneline_tag(name, attrs, content)
  end

  super
end

#on_static(exp) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/hamlit/html/pretty.rb', line 19

def on_static(exp)
  if exp == "\n"
    @added_newline = true
    [:static, '']
  else
    [:static, exp]
  end
end