Sha256: 32cd4c12c0322f4fc5ff7557382619807768268e31afa70cd5a6fa2b74727c3d

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 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
  extend Ramaze::Helper
  helper :link, :file, :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") || {}
          action.instance.extend ::Amrita2::Runtime if data.kind_of? Binding
          template.render_with(data)
        end

        def compile(action, template)
          ::Amrita2::Template.new(template)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ramaze-0.3.5 lib/ramaze/template/amrita2.rb