35 lines
1.1 KiB
Ruby
35 lines
1.1 KiB
Ruby
# encoding: UTF-8
|
||
|
||
require 'helper'
|
||
|
||
class TestKramdown < Test::Unit::TestCase
|
||
context "kramdown" do
|
||
setup do
|
||
@config = {
|
||
'markdown' => 'kramdown',
|
||
'kramdown' => {
|
||
'auto_ids' => false,
|
||
'footnote_nr' => 1,
|
||
'entity_output' => 'as_char',
|
||
'toc_levels' => '1..6',
|
||
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo'
|
||
}
|
||
}
|
||
@markdown = Converters::Markdown.new(@config)
|
||
end
|
||
|
||
# http://kramdown.rubyforge.org/converter/html.html#options
|
||
should "pass kramdown options" do
|
||
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
|
||
end
|
||
|
||
should "convert quotes to smart quotes" do
|
||
assert_match /<p>(“|“)Pit(’|’)hy(”|”)<\/p>/, @markdown.convert(%{"Pit'hy"}).strip
|
||
|
||
override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } }
|
||
markdown = Converters::Markdown.new(@config.deep_merge(override))
|
||
assert_match /<p>(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
|
||
end
|
||
end
|
||
end
|