Sha256: 0dc8f8166a43a00669d9894dd2df0b27f7462c02a3085f1dde814363584db370

Contents?: true

Size: 829 Bytes

Versions: 15

Compression:

Stored size: 829 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"
      base.set :maruku, {}
    end
    
    def render_path(path, layout)
      if template_exists?(path, :maruku)
        render :maruku, path.to_sym
      else
        super
      end
    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
  
  class Base
    include Middleman::Maruku
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
middleman-0.12.2 lib/middleman/features/maruku.rb
middleman-0.12.1 lib/middleman/features/maruku.rb
middleman-0.12.0.pre3 lib/middleman/features/maruku.rb
middleman-0.12.0.pre2 lib/middleman/features/maruku.rb
middleman-0.12.0.pre lib/middleman/features/maruku.rb
middleman-0.11.5 lib/middleman/features/maruku.rb
middleman-0.11.4 lib/middleman/features/maruku.rb
middleman-0.11.3 lib/middleman/features/maruku.rb
middleman-0.11.2 lib/middleman/features/maruku.rb
middleman-0.11.1 lib/middleman/features/maruku.rb
middleman-0.11.0 lib/middleman/features/maruku.rb
middleman-0.10.17 lib/middleman/features/maruku.rb
middleman-0.10.16 lib/middleman/features/maruku.rb
middleman-0.10.15 lib/middleman/features/maruku.rb
middleman-0.10.14 lib/middleman/features/maruku.rb