From a7adc20b47426f4c387da28bcf0a1d82b9109baa Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 2 May 2012 15:27:47 -0700 Subject: [PATCH] still support and test redcarpet --- Gemfile | 10 ++-- middleman-more/features/markdown.feature | 47 ++++++++++++++----- .../fixtures/markdown-app/config.rb | 9 ---- .../lib/middleman-more/renderers/markdown.rb | 9 ++-- 4 files changed, 45 insertions(+), 30 deletions(-) diff --git a/Gemfile b/Gemfile index a7f19a1a..953f33b0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,16 +1,17 @@ source :rubygems group :development do - gem "cucumber", "~> 1.1.0" - gem "fivemat" - gem "aruba", "~> 0.4.11" gem "rake", "~> 0.9.2" - gem "rspec", "~> 2.7" gem "rdoc", "~> 3.9" gem "yard", "~> 0.8.0" end group :test do + gem "cucumber", "~> 1.1.0" + gem "fivemat" + gem "aruba", "~> 0.4.11" + gem "rspec", "~> 2.7" + # For actual tests gem "sinatra" gem "slim" @@ -19,6 +20,7 @@ group :test do gem "jquery-rails", "~> 2.0.1" # gem "bootstrap-rails", "0.0.5" # gem "zurb-foundation" + gem "redcarpet", "~> 2.1.1" end gem "middleman-core", :path => "middleman-core" diff --git a/middleman-more/features/markdown.feature b/middleman-more/features/markdown.feature index 5919088c..9987435b 100644 --- a/middleman-more/features/markdown.feature +++ b/middleman-more/features/markdown.feature @@ -6,7 +6,7 @@ Feature: Markdown support When I go to "/index.html" Then I should see "

Hello World

" - Scenario: Redcarpet 2 extensions + Scenario: Markdown extensions (Maruku) Given the Server is running at "markdown-app" When I go to "/smarty_pants.html" Then I should see "“" @@ -14,18 +14,39 @@ Feature: Markdown support Then I should not see "" When I go to "/tables.html" Then I should see "" - # Maruku doesn't support fenced code blocks :-( - #When I go to "/fenced_code_blocks.html" - #Then I should see "" - # or autolink - #When I go to "/autolink.html" - #Then I should see "" When I go to "/space_after_headers.html" Then I should not see "

" - # or superscript - #When I go to "/superscript.html" - #Then I should see "" + + Scenario: Redcarpet 2 extensions + Given a fixture app "markdown-app" + And a file named "config.rb" with: + """ + set :markdown_engine, :redcarpet + set :markdown, :no_intra_emphasis => true, + :tables => true, + :fenced_code_blocks => true, + :autolink => true, + :strikethrough => true, + :lax_html_blocks => true, + :space_after_headers => true, + :superscript => true#, :smartypants => true + + """ + Given the Server is running at "markdown-app" + # When I go to "/smarty_pants.html" + # Then I should see "“" + When I go to "/no_intra_emphasis.html" + Then I should not see "" + When I go to "/tables.html" + Then I should see "

" + When I go to "/fenced_code_blocks.html" + Then I should see "" + When I go to "/autolink.html" + Then I should see "" + When I go to "/space_after_headers.html" + Then I should not see "

" + When I go to "/superscript.html" + Then I should see "" \ No newline at end of file diff --git a/middleman-more/fixtures/markdown-app/config.rb b/middleman-more/fixtures/markdown-app/config.rb index 3dbc5c06..e69de29b 100644 --- a/middleman-more/fixtures/markdown-app/config.rb +++ b/middleman-more/fixtures/markdown-app/config.rb @@ -1,9 +0,0 @@ -set :markdown, :smartypants => true, - :no_intra_emphasis => true, - :tables => true, - :fenced_code_blocks => true, - :autolink => true, - :strikethrough => true, - :lax_html_blocks => true, - :space_after_headers => true, - :superscript => true \ No newline at end of file diff --git a/middleman-more/lib/middleman-more/renderers/markdown.rb b/middleman-more/lib/middleman-more/renderers/markdown.rb index f7acd86d..e898e32a 100644 --- a/middleman-more/lib/middleman-more/renderers/markdown.rb +++ b/middleman-more/lib/middleman-more/renderers/markdown.rb @@ -36,16 +36,17 @@ module Middleman else markdown_engine_prefix end - - # Tell tilt to use that engine - ::Tilt.prefer(markdown_engine_klass) - + if markdown_engine == :redcarpet # Forcably disable Redcarpet1 support. # Tilt defaults to this if available, but the compat # layer disables extensions. + require "redcarpet" Object.send(:remove_const, :RedcarpetCompat) if defined? ::RedcarpetCompat end + + # Tell tilt to use that engine + ::Tilt.prefer(markdown_engine_klass) end end end