Sha256: b54b9b9b03596441a02ea618cc11f18ccb27622c67d05207507810379ce8484c

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 Bytes

Contents

require 'maruku'
require 'sinatra/base'

module Sinatra
  module Maruku
    def maruku(template, options={}, locals={})
      render :maruku, template, options, locals
    end
    
  private
    def render_maruku(template, data, options, locals, &block)
      maruku_src = render_erb(template, data, options, locals, &block)
      instance = ::Maruku.new(maruku_src, options)
      if block_given?
        # render layout
        instance.to_html_document
      else
        # render template
        instance.to_html
      end  
    end
  end
  helpers Maruku
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wbzyl-sinatra-maruku-0.0.4 lib/sinatra/maruku.rb
wbzyl-sinatra-maruku-0.0.6 lib/sinatra/maruku.rb