Module: Haml::Temple::Expressions

Defined in:
lib/haml/temple.rb

Instance Method Summary (collapse)

Instance Method Details

- on_doctype



17
18
19
# File 'lib/haml/temple.rb', line 17

def on_doctype
  [:html, :doctype, value[:version] || 5]
end

- on_plain



9
10
11
# File 'lib/haml/temple.rb', line 9

def on_plain
  [:static, "\n" + value[:text]]
end

- on_root



13
14
15
# File 'lib/haml/temple.rb', line 13

def on_root
  [:multi]
end

- on_tag



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/haml/temple.rb', line 21

def on_tag
  exp = [:html, :tag, value[:name], [:html, :attrs]]
  if value[:value] && value[:value] != ""
    if value[:parse]
      exp.push << [:dynamic, value[:value]]
    else
      exp.push << [:static, value[:value]]
    end
  end

  if attribs = value[:attributes]
    attribs.each do |key, value|
      exp.last << [:html, :attr, key, [:static, value]]
    end
  end

  exp
end