Sha256: 554101ee99d0874c2c846acea633e02f8fa8cb8b49c593086b47e30ec1f38547

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'ramaze/template/ezamar/engine'
require 'ramaze/template/ezamar/render_partial'

module Ramaze
  module Template

    # Is responsible for compiling a template using the Ezamar templating engine.

    class Ezamar < Template

      ENGINES[self] = %w[ xhtml zmr ]

      TRANSFORM_PIPELINE = [ ::Ezamar::Element ]

      class << self

        # Transforms an action into the XHTML code for parsing and returns
        # the result
        def transform action
          ezamar = wrap_compile(action)
          ezamar.result(action.binding)
        end

        # Compile a template, applying all transformations from the pipeline
        # and returning an instance of ::Ezamar::Template

        def compile(action, template)
          file = (action.template || __FILE__)

          TRANSFORM_PIPELINE.each do |tp|
            template = tp.transform(template)
          end

          ::Ezamar::Template.new(template, :file => file)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ramaze-0.1.3 lib/ramaze/template/ezamar.rb
ramaze-0.1.4 lib/ramaze/template/ezamar.rb
ramaze-0.2.0 lib/ramaze/template/ezamar.rb
ramaze-0.2.1 lib/ramaze/template/ezamar.rb