Sha256: 51b1b51bc719bb28b0cf9dccebdc000122408dffda0ad0b9af4cfc98ee79158d
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'malt/engines/abstract' module Malt::Engines # Tenjin # # http://www.kuwata-lab.com/tenjin/ # # options # :escapefunc=>'CGI.escapeHTML' # class Tenjin < Abstract default :tenjin, :rbhtml # def render(params, &yld) text = params[:text] file = params[:file] data = params[:data] type = params[:type] format = params[:format] || :html return super(params, &yld) if type == :rbhtml && format != :html data = make_hash(data, &yld) template = intermediate(params) template.convert(text, file) template.render(data) end # def compile(params) text = params[:text] file = params[:file] intermediate(params).convert(text, file) end private def intermediate(params) ::Tenjin::Template.new(nil, engine_options(params)) end # Load Liquid library if not already loaded. def initialize_engine return if defined? ::Tenjin::Engine require_library 'tenjin' end def engine_options(params) opts = {} opts[:escapefunc] = params[:escapefunc] || settings[:escapefunc] opts end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
malt-0.1.0 | lib/malt/engines/tenjin.rb |