File: test_rdiscount.rb

package info (click to toggle)
jekyll 2.2.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,908 kB
  • ctags: 687
  • sloc: ruby: 6,811; sh: 121; xml: 106; makefile: 35
file content (22 lines) | stat: -rw-r--r-- 808 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'helper'

class TestRdiscount < Test::Unit::TestCase

  context "rdiscount" do
    setup do
      config = {
        'markdown' => 'rdiscount',
        'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' }
      }
      @markdown = Converters::Markdown.new config
    end

    should "pass rdiscount extensions" do
      assert_equal "<p>&ldquo;smart&rdquo;</p>", @markdown.convert('"smart"').strip
    end

    should "render toc" do
      assert_equal "<a name=\"Header.1\"></a>\n<h1>Header 1</h1>\n\n<a name=\"Header.2\"></a>\n<h2>Header 2</h2>\n\n<p><ul>\n <li><a href=\"#Header.1\">Header 1</a>\n <ul>\n  <li><a href=\"#Header.2\">Header 2</a></li>\n </ul>\n </li>\n</ul>\n\n</p>", @markdown.convert("# Header 1\n\n## Header 2\n\n{:toc}").strip
    end
  end
end