class Temple::Generator
@api public
compile the Core Abstraction to ruby code.
Generators should inherit this class and
Abstract generator base class
def buffer
def buffer options[:buffer] end
def call(exp)
def call(exp) [preamble, compile(exp), postamble].join('; ') end
def capture_generator
def capture_generator @capture_generator ||= Class === options[:capture_generator] ? options[:capture_generator] : Generators.const_get(options[:capture_generator]) end
def concat(str)
def concat(str) "#{buffer} << (#{str})" end
def on(*exp)
def on(*exp) raise InvalidExpression, "Generator supports only core expressions - found #{exp.inspect}" end
def on_capture(name, exp)
def on_capture(name, exp) capture_generator.new(:buffer => name).call(exp) end
def on_code(code)
def on_code(code) code end
def on_dynamic(code)
def on_dynamic(code) concat(code) end
def on_multi(*exp)
def on_multi(*exp) exp.map {|e| compile(e) }.join('; ') end
def on_newline
def on_newline "\n" end
def on_static(text)
def on_static(text) concat(text.inspect) end
def postamble
def postamble 'nil' end
def preamble
def preamble end