Class: Sal::Compiler Private

Inherits:
Temple::Filter
  • Object
show all
Defined in:
lib/sal/compiler.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Compiles HTML into Temple::HTML expressions

Instance Method Summary collapse

Instance Method Details

#call(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
# File 'lib/sal/compiler.rb', line 5

def call(exp)
  [:multi,
   [:code, "_saldict = Sal::Wrapper.new(self)"],
   super]
end

#on_sal_code(code, tag, attrs, content) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sal/compiler.rb', line 23

def on_sal_code(code, tag, attrs, content)
  tmp1 = unique_name
  if code == 'yield'
    [:dynamic, code]
  else
    [:multi,
      [:if, "(#{tmp1} = _saldict['#{code}'])",
        [:block, "Array(#{tmp1}).each do |_saldict|",
          [:html, :tag, tag, ada(attrs), compile(content)]]]]
  end
end

#on_sal_tag(tag, attrs, content) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'lib/sal/compiler.rb', line 11

def on_sal_tag(tag, attrs, content)
  [:html, :tag, tag, format_attrs(attrs), compile(content)]
end

#on_sal_text(text, code = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
21
# File 'lib/sal/compiler.rb', line 15

def on_sal_text(text, code = nil)
  if code
    [:dynamic, "Sal::View.parse_for_html(_saldict, '#{code}', '#{text}')"]
  else
    [:static, text]
  end
end