Class: Hamlit::HTML

Inherits:
Temple::HTML::Fast
  • Object
show all
Defined in:
lib/hamlit/html.rb

Constant Summary collapse

DEPRECATED_FORMATS =
%i[html4 html5].freeze

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ HTML

Returns a new instance of HTML.


6
7
8
9
10
11
12
# File 'lib/hamlit/html.rb', line 6

def initialize(opts = {})
  if DEPRECATED_FORMATS.include?(opts[:format])
    opts = opts.dup
    opts[:format] = :html
  end
  super(opts)
end

Instance Method Details

#on_html_condcomment(condition, content, revealed = false) ⇒ Object

This dispatcher supports Haml's “revealed” conditional comment.


15
16
17
18
19
20
# File 'lib/hamlit/html.rb', line 15

def on_html_condcomment(condition, content, revealed = false)
  on_html_comment [:multi,
                   [:static, "[#{condition}]>#{'<!-->' if revealed}"],
                   content,
                   [:static, "#{'<!--' if revealed}<![endif]"]]
end