class Tilt::LiquidTemplate
time when using this template engine.
It’s suggested that your program require ‘liquid’ at load
LiquidTemplate does not support yield blocks.
to #to_h it will be ignored.
as a hash by responding to #to_h. If the scope
does not respond
support a scope
, the scope
must be able to represent itself
does not provide direct access to execuatable scopes. In order to
Liquid is designed to be a safe template system and threfore
/
Liquid template implementation. See:
def evaluate(scope, locals, &block)
def evaluate(scope, locals, &block) locals = locals.inject({}){ |h,(k,v)| h[k.to_s] = v ; h } if scope.respond_to?(:to_h) scope = scope.to_h.inject({}){ |h,(k,v)| h[k.to_s] = v ; h } locals = scope.merge(locals) end locals['yield'] = block.nil? ? '' : yield locals['content'] = locals['yield'] @engine.render(locals) end
def initialize_engine
def initialize_engine return if defined? ::Liquid::Template require_template_library 'liquid' end
def prepare
def prepare @engine = ::Liquid::Template.parse(data) end