diff --git a/lib/jekyll/converters/smartypants.rb b/lib/jekyll/converters/smartypants.rb index 7af9d297..d1bc8103 100644 --- a/lib/jekyll/converters/smartypants.rb +++ b/lib/jekyll/converters/smartypants.rb @@ -1,8 +1,8 @@ class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown def initialize(source, options) super - @block_parsers = [] - @span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :escaped_chars] + @block_parsers = [:block_html] + @span_parsers = [:smart_quotes, :html_entity, :typographic_syms, :span_html] end end diff --git a/test/test_filters.rb b/test/test_filters.rb index 63e52672..d2d281c3 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -31,9 +31,32 @@ class TestFilters < JekyllUnitTest assert_equal "

something really simple

\n", @filter.markdownify("something **really** simple") end - should "smartify with simple string" do - assert_equal "SmartyPants is *not* Markdown", @filter.smartify("SmartyPants is *not* Markdown") - assert_equal "“This filter’s test…”", @filter.smartify(%q{"This filter's test..."}) + context "smartify filter" do + should "convert quotes and typographic characters" do + assert_equal "SmartyPants is *not* Markdown", @filter.smartify("SmartyPants is *not* Markdown") + assert_equal "“This filter’s test…”", @filter.smartify(%q{"This filter's test..."}) + end + + should "escapes special characters when configured to do so" do + kramdown = JekyllFilter.new({:kramdown => {:entity_output => :symbolic}}) + assert_equal "“This filter’s test…”", kramdown.smartify(%q{"This filter's test..."}) + end + + should "convert HTML entities to unicode characters" do + assert_equal "’", @filter.smartify("’") + assert_equal "“", @filter.smartify("“") + end + + should "allow raw HTML passthrough" do + assert_equal "Span HTML is not escaped", @filter.smartify("Span HTML is not escaped") + assert_equal "
Block HTML is not escaped
", @filter.smartify("
Block HTML is not escaped
") + end + + should "escape special characters" do + assert_equal "3 < 4", @filter.smartify("3 < 4") + assert_equal "5 > 4", @filter.smartify("5 > 4") + assert_equal "This & that", @filter.smartify("This & that") + end end should "sassify with simple string" do