diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2014-12-30 12:12:48 -0500 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2014-12-30 12:12:48 -0500 |
commit | 86ca8ce1eb316f796d9a3e8e70da0ad844a89f48 (patch) | |
tree | fd58eed793b094a47768d86a8fe906ea43f0558c /tests | |
parent | ab64e9dfb44b1bfaa47b8e18e4a6c1fdf558990b (diff) | |
parent | ede69aee2e53cd2eb2c960dc3ecba2d423faac82 (diff) | |
download | markdown-86ca8ce1eb316f796d9a3e8e70da0ad844a89f48.tar.gz markdown-86ca8ce1eb316f796d9a3e8e70da0ad844a89f48.tar.bz2 markdown-86ca8ce1eb316f796d9a3e8e70da0ad844a89f48.zip |
Merge branch 'temp'
Conflicts:
tests/test_extensions.py
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_extensions.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 2380f17..dae8829 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -741,6 +741,48 @@ class TestTOC(unittest.TestCase): self.md.reset() self.assertEqual(self.md.toc, '') + def testAnchorLink(self): + """ Test TOC Anchorlink. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)] + ) + text = '# Header 1\n\n## Header *2*' + self.assertEqual( + md.convert(text), + '<h1 id="header-1"><a class="toclink" href="#header-1">Header 1</a></h1>\n' + '<h2 id="header-2"><a class="toclink" href="#header-2">Header <em>2</em></a></h2>' + ) + + def testTitle(self): + """ Test TOC Title. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(title='Table of Contents')] + ) + md.convert('# Header 1\n\n## Header 2') + self.assertTrue(md.toc.startswith('<div class="toc"><span class="toctitle">Table of Contents</span><ul>')) + + def testWithAttrList(self): + """ Test TOC with attr_list Extension. """ + md = markdown.Markdown(extensions=['markdown.extensions.toc', 'markdown.extensions.attr_list']) + text = '# Header 1\n\n## Header 2 { #foo }' + self.assertEqual( + md.convert(text), + '<h1 id="header-1">Header 1</h1>\n' + '<h2 id="foo">Header 2</h2>' + ) + self.assertEqual( + md.toc, + '<div class="toc">\n' + '<ul>\n' # noqa + '<li><a href="#header-1">Header 1</a>' # noqa + '<ul>\n' # noqa + '<li><a href="#foo">Header 2</a></li>\n' # noqa + '</ul>\n' # noqa + '</li>\n' # noqa + '</ul>\n' # noqa + '</div>\n' + ) + class TestSmarty(unittest.TestCase): def setUp(self): |