diff --git a/lib/middleman/base.rb b/lib/middleman/base.rb index 434e0fbe..8441af39 100644 --- a/lib/middleman/base.rb +++ b/lib/middleman/base.rb @@ -28,7 +28,6 @@ module Middleman disable :minify_css disable :minify_javascript disable :relative_assets - disable :markaby disable :maruku disable :smush_pngs diff --git a/lib/middleman/features/markaby.rb b/lib/middleman/features/markaby.rb deleted file mode 100644 index ef2c73f2..00000000 --- a/lib/middleman/features/markaby.rb +++ /dev/null @@ -1,43 +0,0 @@ -begin - require 'markaby' -rescue LoadError - puts "Markaby not available. Install it with: gem install markaby" -end - -module Middleman - module Markaby - def self.included(base) - base.supported_formats << "mab" - end - - def render_path(path) - if template_exists?(path, :mab) - markaby path.to_sym - else - super - end - end - - def markaby(template=nil, options={}, locals = {}, &block) - options, template = template, nil if template.is_a?(Hash) - template = lambda { block } if template.nil? - render :mab, template, options, locals - end - - protected - def render_mab(template, data, options, locals, &block) - filename = options.delete(:filename) || '' - line = options.delete(:line) || 1 - mab = ::Markaby::Builder.new(locals) - if data.respond_to?(:to_str) - eval(data.to_str, binding, filename, line) - elsif data.kind_of?(Proc) - data.call(mab) - end - end - end - - class Base - include Middleman::Markaby - end -end \ No newline at end of file diff --git a/lib/middleman/features/maruku.rb b/lib/middleman/features/maruku.rb index 6d3f9809..b3d35b69 100644 --- a/lib/middleman/features/maruku.rb +++ b/lib/middleman/features/maruku.rb @@ -8,23 +8,20 @@ module Middleman module Maruku def self.included(base) base.supported_formats << "maruku" + base.set :maruku, {} end def render_path(path) if template_exists?(path, :maruku) - maruku path.to_sym + render :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) + 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 diff --git a/spec/builder_spec.rb b/spec/builder_spec.rb index 44021582..32bd959b 100644 --- a/spec/builder_spec.rb +++ b/spec/builder_spec.rb @@ -17,18 +17,13 @@ describe "Builder" do after :each do FileUtils.rm_rf(File.join(@root_dir, "build")) end - - xit "should build markaby files" do - File.exists?("#{@root_dir}/build/markaby.html").should be_true - File.read("#{@root_dir}/build/markaby.html").should include("Hi Markaby") - end it "should build haml files" do File.exists?("#{@root_dir}/build/index.html").should be_true File.read("#{@root_dir}/build/index.html").should include("

Welcome

") end - xit "should build maruku files" do + it "should build maruku files" do File.exists?("#{@root_dir}/build/maruku.html").should be_true File.read("#{@root_dir}/build/maruku.html").should include("

Hello Maruku

") end diff --git a/spec/fixtures/sample/init.rb b/spec/fixtures/sample/init.rb index dd38727b..41a78066 100644 --- a/spec/fixtures/sample/init.rb +++ b/spec/fixtures/sample/init.rb @@ -1,2 +1 @@ -# enable :maruku -# enable :markaby \ No newline at end of file +enable :maruku \ No newline at end of file diff --git a/spec/fixtures/sample/views/markaby.html.mab b/spec/fixtures/sample/views/markaby.html.mab deleted file mode 100644 index 0e197f74..00000000 --- a/spec/fixtures/sample/views/markaby.html.mab +++ /dev/null @@ -1,5 +0,0 @@ -mab.html do - head do - title "Hi Markaby" - end -end \ No newline at end of file