/usr/lib/ruby/vendor_ruby/tilt/liquid.rb is in ruby-tilt 2.0.0+really1.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | require 'tilt/template'
module Tilt
# Liquid template implementation. See:
# http://liquid.rubyforge.org/
#
# Liquid is designed to be a *safe* template system and threfore
# does not provide direct access to execuatable scopes. In order to
# support a +scope+, the +scope+ must be able to represent itself
# as a hash by responding to #to_h. If the +scope+ does not respond
# to #to_h it will be ignored.
#
# LiquidTemplate does not support yield blocks.
#
# It's suggested that your program require 'liquid' at load
# time when using this template engine.
class LiquidTemplate < Template
def self.engine_initialized?
defined? ::Liquid::Template
end
def initialize_engine
require_template_library 'liquid'
end
def prepare
@engine = ::Liquid::Template.parse(data)
end
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 allows_script?
false
end
end
end
|