Sha256: 7f8ca90ee13a8dd828cafed94ae8b4584fab7f9a23b3e4678c2668cf8698cd79
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. require 'amrita2' class Amrita2::Template # Ramaze helpers are available in template contexts. include Ramaze::Helper::Methods helper :link, :sendfile, :flash, :cgi end module Ramaze module Template # Is responsible for compiling a template using the Amrita2 templating engine. # Can be found at: http://rubyforge.org/projects/amrita2 class Amrita2 < Template ENGINES[self] = %w[ amrita amr a2html ] class << self # Takes an Action # The result or file is rendered using Amrita2::Template. # # The context data are set to @data in the controller before expansion. def transform(action) template = wrap_compile(action) data = action.instance.instance_variable_get("@data") || {} binding = action.instance.instance_variable_get("@binding") action.instance.extend(::Amrita2::Runtime) template.render_with(data, binding) end # Compile a template, return instance of Amrita2::Template def compile(action, template) ::Amrita2::Template.new(template) end end end end end
Version data entries
4 entries across 4 versions & 3 rubygems