added test case to hard_breaks (disable/enable in _config.yml)
This commit is contained in:
parent
3468f0a2c3
commit
3f889ef077
|
@ -27,9 +27,11 @@ module Jekyll
|
||||||
def convert(content)
|
def convert(content)
|
||||||
setup
|
setup
|
||||||
r = RedCloth.new(content)
|
r = RedCloth.new(content)
|
||||||
if !@config['redcloth']['hard_breaks']
|
r.hard_breaks = @config['redcloth']['hard_breaks']
|
||||||
r.hard_breaks = false
|
# if @config['redcloth']['hard_breaks'] == false
|
||||||
end
|
# STDERR.puts 'hards_breaks disabled'
|
||||||
|
# r.hard_breaks = false
|
||||||
|
# end
|
||||||
r.to_html
|
r.to_html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
|
class TestRedCloth < Test::Unit::TestCase
|
||||||
|
context "RedCloth with hard_breaks enabled" do
|
||||||
|
setup do
|
||||||
|
config = {
|
||||||
|
'redcloth' => {
|
||||||
|
'hard_breaks' => true # default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@textile = TextileConverter.new config
|
||||||
|
end
|
||||||
|
|
||||||
|
should "preserve single line breaks in HTML output" do
|
||||||
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "RedCloth with hard_breaks disabled" do
|
||||||
|
setup do
|
||||||
|
config = {
|
||||||
|
'redcloth' => {
|
||||||
|
'hard_breaks' => false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@textile = TextileConverter.new config
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not generate break tags in HTML output" do
|
||||||
|
assert_equal "<p>line1\nline2</p>", @textile.convert("p. line1\nline2").strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue