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.rubyforge_project = "jekyll"
|
||||||
s.files.exclude 'test/dest'
|
s.files.exclude 'test/dest'
|
||||||
s.test_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('liquid', '>= 1.9.0')
|
||||||
s.add_dependency('classifier', '>= 1.3.1')
|
s.add_dependency('classifier', '>= 1.3.1')
|
||||||
s.add_dependency('maruku', '>= 0.5.9')
|
s.add_dependency('maruku', '>= 0.5.9')
|
||||||
|
|
|
@ -12,6 +12,7 @@ require 'yaml'
|
||||||
|
|
||||||
# 3rd party
|
# 3rd party
|
||||||
require 'liquid'
|
require 'liquid'
|
||||||
|
gem 'RedCloth', '= 4.1.0'
|
||||||
require 'redcloth'
|
require 'redcloth'
|
||||||
|
|
||||||
# internal requires
|
# internal requires
|
||||||
|
|
|
@ -30,9 +30,9 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_pygments(context, code)
|
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"
|
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>"
|
return "<notextile>" + Albino.new(code, @lang).to_s(@options) + "</notextile>"
|
||||||
else
|
else
|
||||||
return Albino.new(code, @lang).to_s(@options)
|
return Albino.new(code, @lang).to_s(@options)
|
||||||
|
|
|
@ -2,15 +2,26 @@ require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestTags < Test::Unit::TestCase
|
class TestTags < Test::Unit::TestCase
|
||||||
|
|
||||||
def create_post(content, override = {})
|
def create_post(content, override = {}, markdown = true)
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
|
Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
|
||||||
end
|
end
|
||||||
site = Site.new(Jekyll.configuration)
|
site = Site.new(Jekyll.configuration)
|
||||||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
||||||
|
|
||||||
@result = Liquid::Template.parse(content).render({}, info)
|
if markdown
|
||||||
@result = site.markdown(@result)
|
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
|
end
|
||||||
|
|
||||||
def fill_post(code, override = {})
|
def fill_post(code, override = {})
|
||||||
|
@ -69,14 +80,24 @@ puts "3..2..1.."
|
||||||
CONTENT
|
CONTENT
|
||||||
end
|
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
|
context "using Maruku" do
|
||||||
setup do
|
setup do
|
||||||
create_post(@content)
|
create_post(@content)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "parse correctly" do
|
should "parse correctly" do
|
||||||
assert_match %{<em>FIGHT!</em>}, @result
|
assert_match %r{<em>FIGHT!</em>}, @result
|
||||||
assert_match %{<em>FINISH HIM</em>}, @result
|
assert_match %r{<em>FINISH HIM</em>}, @result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -86,8 +107,8 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "parse correctly" do
|
should "parse correctly" do
|
||||||
assert_match %{<em>FIGHT!</em>}, @result
|
assert_match %r{<em>FIGHT!</em>}, @result
|
||||||
assert_match %{<em>FINISH HIM</em>}, @result
|
assert_match %r{<em>FINISH HIM</em>}, @result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue