aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_extensions.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 5a04e64..aee9bac 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -845,6 +845,41 @@ class TestTOC(TestCaseWithAssertStartsWith):
self.assertEqual(unique('foo', ids), 'foo_1')
self.assertEqual(ids, set(['foo', 'foo_1']))
+ def testTocInHeaders(self):
+
+ text = '[TOC]\n#[TOC]'
+ self.assertEqual(
+ self.md.convert(text),
+ '<div class="toc">\n' # noqa
+ '<ul>\n' # noqa
+ '<li><a href="#toc">[TOC]</a></li>\n' # noqa
+ '</ul>\n' # noqa
+ '</div>\n' # noqa
+ '<h1 id="toc">[TOC]</h1>' # noqa
+ )
+
+ text = '#[TOC]\n[TOC]'
+ self.assertEqual(
+ self.md.convert(text),
+ '<h1 id="toc">[TOC]</h1>\n' # noqa
+ '<div class="toc">\n' # noqa
+ '<ul>\n' # noqa
+ '<li><a href="#toc">[TOC]</a></li>\n' # noqa
+ '</ul>\n' # noqa
+ '</div>' # noqa
+ )
+
+ text = '[TOC]\n# *[TOC]*'
+ self.assertEqual(
+ self.md.convert(text),
+ '<div class="toc">\n' # noqa
+ '<ul>\n' # noqa
+ '<li><a href="#toc">[TOC]</a></li>\n' # noqa
+ '</ul>\n' # noqa
+ '</div>\n' # noqa
+ '<h1 id="toc"><em>[TOC]</em></h1>' # noqa
+ )
+
class TestSmarty(unittest.TestCase):
def setUp(self):