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())
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())
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)
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)