Sha256: 4a9aa5b9d0e3d68fa0469545797e5f2526c022ae3c616ec520d65b23c2213f25
Contents?: true
Size: 1.95 KB
Versions: 9
Compression:
Stored size: 1.95 KB
Contents
# 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', 'use_coderay' => true, 'coderay_bold_every'=> 12, 'coderay' => { 'coderay_css' => :style, 'coderay_bold_every' => 8 } } } @config = Jekyll.configuration(@config) @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(Utils.deep_merge_hashes(@config, override)) assert_match /<p>(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip end context "moving up nested coderay options" do setup do @markdown.convert('some markup') @converter_config = @markdown.instance_variable_get(:@config)['kramdown'] end should "work correctly" do assert_equal :style, @converter_config['coderay_css'] end should "also work for defaults" do default = Jekyll::Configuration::DEFAULTS['kramdown']['coderay']['coderay_tab_width'] assert_equal default, @converter_config['coderay_tab_width'] end should "not overwrite" do assert_equal 12, @converter_config['coderay_bold_every'] end end end end
Version data entries
9 entries across 9 versions & 1 rubygems