コード例 #1
0
    def testRender(self):
        out_file = cStringIO.StringIO()
        cmark.Render(SIMPLE_DOC, out_file)
        self.assertEqual('<p>hi</p>\n', out_file.getvalue())

        out_file = cStringIO.StringIO()
        cmark.Render(TOC_DOC, out_file)
        print(out_file.getvalue())
コード例 #2
0
    def testRender(self):
        opts, _ = cmark.Options().parse_args([])

        out_file = cStringIO.StringIO()
        cmark.Render(opts, {}, SIMPLE_DOC, out_file)
        self.assertEqual('<p>hi</p>\n', out_file.getvalue())

        out_file = cStringIO.StringIO()
        cmark.Render(opts, {}, TOC_DOC, out_file)
        print(out_file.getvalue())
コード例 #3
0
    def testNewRender(self):
        # New style of doc

        new_flags = ['--toc-tag', 'h2', '--toc-tag', 'h3']
        opts, _ = cmark.Options().parse_args(new_flags)

        out_file = cStringIO.StringIO()
        cmark.Render(opts, NEW_DOC, out_file)
        print(out_file.getvalue())
コード例 #4
0
    def testNewRender(self):
        # New style of doc

        new_flags = ['--toc-tag', 'h2', '--toc-tag', 'h3']
        opts, _ = cmark.Options().parse_args(new_flags)

        in_file = cStringIO.StringIO(NEW_DOC)
        out_file = cStringIO.StringIO()
        cmark.Render(opts, {}, in_file, out_file)

        h = out_file.getvalue()
        self.assert_('<div class="toclevel1"><a href="#one">' in h, h)
コード例 #5
0
    def testNewPrettyHref(self):
        # New style of doc

        new_flags = ['--toc-tag', 'h2', '--toc-tag', 'h3', '--toc-pretty-href']
        opts, _ = cmark.Options().parse_args(new_flags)

        in_file = cStringIO.StringIO(NEW_DOC)
        out_file = cStringIO.StringIO()
        cmark.Render(opts, in_file, out_file)
        h = out_file.getvalue()
        self.assert_('<a name="subsubheading">' in h, h)

        self.assert_('<div class="toclevel1"><a href="#one">' in h, h)
        print(h)