Sha256: 6d258cd96c4054b3a9596d78226a1868c0de9cc8a0cf442c41052306294493a2

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'nagoro'
require 'ramaze/view/nagoro/render_partial'

module Ramaze
  module View
    # Binding to the Nagoro templating engine.
    #
    # To pipe your template through tidy you have to use:
    #
    #   Ramaze::View::Nagoro.options.tidy = true
    #
    # @see http://github.com/manveru/nagoro
    module Nagoro
      include Optioned

      options.dsl do
        o "Pipes to pass the template through",
          :pipes, ::Nagoro::DEFAULT_PIPES

        o "Use tidy to cleanup the rendered template",
          :tidy, false
      end

      def self.call(action, string)
        default_options = {
          :pipes     => options.pipes,
          :filename  => action.view,
          :binding   => action.binding,
          :variables => action.variables
        }

        render_options = default_options.merge(action.options)

        if options.tidy
          html = ::Nagoro.tidy_render(string.to_s, render_options)
        else
          html = ::Nagoro.render(string.to_s, render_options)
        end

        return html, 'text/html'
      end
    end # Nagoro
  end # View
end # Ramaze

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ramaze-2023.01.06 lib/ramaze/view/nagoro.rb
ramaze-2012.12.08 lib/ramaze/view/nagoro.rb
ramaze-2012.12.08b lib/ramaze/view/nagoro.rb
ramaze-2011.12.28 lib/ramaze/view/nagoro.rb
ramaze-2011.10.23 lib/ramaze/view/nagoro.rb
ramaze-2011.07.25 lib/ramaze/view/nagoro.rb