Sha256: ca6ab89f49ce2dded54a222f6ee6eba07d2a81f12c20beae60152cb7e22f0d67

Contents?: true

Size: 874 Bytes

Versions: 11

Compression:

Stored size: 874 Bytes

Contents

begin
  require 'maruku'
rescue LoadError
  puts "Maruku not available. Install it with: gem install maruku"
end

module Middleman
  module Maruku
    def self.included(base)
      base.supported_formats << "maruku"
    end
    
    def render_path(path)
      if template_exists?(path, :maruku)
        maruku path.to_sym
      else
        super
      end
    end
    
    def maruku(template, options={}, locals={})
      render :maruku, template, options, locals
    end

  private
    def render_maruku(data, options, locals, &block)
      maruku_src = render_erb(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
  
  class Base
    include Middleman::Maruku
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
middleman-0.9.13 lib/middleman/features/maruku.rb
middleman-0.9.12 lib/middleman/features/maruku.rb
middleman-0.9.11 lib/middleman/features/maruku.rb
middleman-0.9.10 lib/middleman/features/maruku.rb
middleman-0.9.9 lib/middleman/features/maruku.rb
middleman-0.9.8 lib/middleman/features/maruku.rb
middleman-0.9.7 lib/middleman/features/maruku.rb
middleman-0.9.6 lib/middleman/features/maruku.rb
middleman-0.9.5 lib/middleman/features/maruku.rb
middleman-0.9.4 lib/middleman/features/maruku.rb
middleman-0.9.3 lib/middleman/features/maruku.rb