Sha256: f30a6f04e7c939b67290adede17431cb6e918d671e4ba6db972b00ce8445738b

Contents?: true

Size: 765 Bytes

Versions: 8

Compression:

Stored size: 765 Bytes

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 'ramaze/template/ezamar/engine'


module Ezamar

  # A transformer for <render /> tags.

  class RenderPartial
    extend Ramaze::Helper::Partial

    # Renders <render src="/path" [optional="option", ...]> in place.
    #
    # Other options than `src` will be transformed to session parameters for the
    # rendered action to use.

    def self.transform(template)
      template.gsub!(/<render (.*?) \/>/) do |m|
        args = Hash[*$1.scan(/(\S+)=["'](.*?)["']/).flatten]
        if src = args.delete('src')
          render_partial(src, args)
        end
      end

      template
    end

  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.09 lib/ramaze/template/ezamar/render_partial.rb
clivecrous-ramaze-0.3.9.5 lib/ramaze/template/ezamar/render_partial.rb
manveru-ramaze-2008.07 lib/ramaze/template/ezamar/render_partial.rb
manveru-ramaze-2008.08 lib/ramaze/template/ezamar/render_partial.rb
manveru-ramaze-2008.09 lib/ramaze/template/ezamar/render_partial.rb
manveru-ramaze-2008.10 lib/ramaze/template/ezamar/render_partial.rb
ramaze-2008.06 lib/ramaze/template/ezamar/render_partial.rb
ramaze-2008.11 lib/ramaze/template/ezamar/render_partial.rb