Testing for RedCloth notextile issue and locking to 4.1.0, which parses the tag correctly
This commit is contained in:
parent
4bcece18ae
commit
26f9ad3d98
2
Rakefile
2
Rakefile
|
@ -15,7 +15,7 @@ begin
|
|||
s.rubyforge_project = "jekyll"
|
||||
s.files.exclude 'test/dest'
|
||||
s.test_files.exclude 'test/dest'
|
||||
s.add_dependency('RedCloth', '>= 4.0.4')
|
||||
s.add_dependency('RedCloth', '= 4.1.0')
|
||||
s.add_dependency('liquid', '>= 1.9.0')
|
||||
s.add_dependency('classifier', '>= 1.3.1')
|
||||
s.add_dependency('maruku', '>= 0.5.9')
|
||||
|
|
|
@ -12,6 +12,7 @@ require 'yaml'
|
|||
|
||||
# 3rd party
|
||||
require 'liquid'
|
||||
gem 'RedCloth', '= 4.1.0'
|
||||
require 'redcloth'
|
||||
|
||||
# internal requires
|
||||
|
|
|
@ -30,9 +30,9 @@ module Jekyll
|
|||
end
|
||||
|
||||
def render_pygments(context, code)
|
||||
if context["content_type"] == :markdown
|
||||
if context["content_type"] == "markdown"
|
||||
return "\n" + Albino.new(code, @lang).to_s(@options) + "\n"
|
||||
elsif context["content_type"] == :textile
|
||||
elsif context["content_type"] == "textile"
|
||||
return "<notextile>" + Albino.new(code, @lang).to_s(@options) + "</notextile>"
|
||||
else
|
||||
return Albino.new(code, @lang).to_s(@options)
|
||||
|
|
|
@ -2,15 +2,26 @@ require File.dirname(__FILE__) + '/helper'
|
|||
|
||||
class TestTags < Test::Unit::TestCase
|
||||
|
||||
def create_post(content, override = {})
|
||||
def create_post(content, override = {}, markdown = true)
|
||||
stub(Jekyll).configuration do
|
||||
Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
|
||||
end
|
||||
site = Site.new(Jekyll.configuration)
|
||||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
||||
|
||||
@result = Liquid::Template.parse(content).render({}, info)
|
||||
@result = site.markdown(@result)
|
||||
if markdown
|
||||
payload = {"content_type" => "markdown"}
|
||||
else
|
||||
payload = {"content_type" => "textile"}
|
||||
end
|
||||
|
||||
@result = Liquid::Template.parse(content).render(payload, info)
|
||||
|
||||
if markdown
|
||||
@result = site.markdown(@result)
|
||||
else
|
||||
@result = site.textile(@result)
|
||||
end
|
||||
end
|
||||
|
||||
def fill_post(code, override = {})
|
||||
|
@ -69,14 +80,24 @@ puts "3..2..1.."
|
|||
CONTENT
|
||||
end
|
||||
|
||||
context "using Textile" do
|
||||
setup do
|
||||
create_post(@content, {}, false)
|
||||
end
|
||||
|
||||
should "not textilize highlight block" do
|
||||
assert_no_match %r{3\.\.2\.\.1\.\."</span><br />}, @result
|
||||
end
|
||||
end
|
||||
|
||||
context "using Maruku" do
|
||||
setup do
|
||||
create_post(@content)
|
||||
end
|
||||
|
||||
should "parse correctly" do
|
||||
assert_match %{<em>FIGHT!</em>}, @result
|
||||
assert_match %{<em>FINISH HIM</em>}, @result
|
||||
assert_match %r{<em>FIGHT!</em>}, @result
|
||||
assert_match %r{<em>FINISH HIM</em>}, @result
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -86,8 +107,8 @@ CONTENT
|
|||
end
|
||||
|
||||
should "parse correctly" do
|
||||
assert_match %{<em>FIGHT!</em>}, @result
|
||||
assert_match %{<em>FINISH HIM</em>}, @result
|
||||
assert_match %r{<em>FIGHT!</em>}, @result
|
||||
assert_match %r{<em>FINISH HIM</em>}, @result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue