Merge pull request #523 from StephaneBunel/master

New config parameter to enable Markdown extensions
This commit is contained in:
Alexis Metaireau 2012-10-12 13:32:30 -07:00
commit 848fdedec7
7 changed files with 40 additions and 9 deletions

View file

@ -0,0 +1,8 @@
Title: Test Markdown extensions
[TOC]
## Level1
### Level2

View file

@ -69,6 +69,7 @@ class TestArticlesGenerator(unittest.TestCase):
[u'Article title', 'published', 'Default', 'article'],
[u'Article with template', 'published', 'Default', 'custom'],
[u'Test md File', 'published', 'test', 'article'],
[u'Test Markdown extensions', 'published', u'Default', 'article'],
[u'This is a super article !', 'published', 'Yeah', 'article'],
[u'This is an article with category !', 'published', 'yeah', 'article'],
[u'This is an article without category !', 'published', 'Default', 'article'],

View file

@ -70,7 +70,7 @@ class RstReaderTest(unittest.TestCase):
class MdReaderTest(unittest.TestCase):
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
def test_article_with_md_extention(self):
def test_article_with_md_extension(self):
# test to ensure the md extension is being processed by the correct reader
reader = readers.MarkdownReader({})
content, metadata = reader.read(_filename('article_with_md_extension.md'))
@ -90,3 +90,22 @@ class MdReaderTest(unittest.TestCase):
"<p>This is another markdown test file. Uses the mkd extension.</p>"
self.assertEqual(content, expected)
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
def test_article_with_markdown_markup_extension(self):
# test to ensure the markdown markup extension is being processed as expected
reader = readers.MarkdownReader({})
reader.settings.update(dict(MARKDOWN_EXTENSIONS=['toc', ]))
content, metadata = reader.read(_filename('article_with_markdown_markup_extensions.md'))
expected = '<div class="toc">\n'\
'<ul>\n'\
'<li><a href="#level1">Level1</a><ul>\n'\
'<li><a href="#level2">Level2</a></li>\n'\
'</ul>\n'\
'</li>\n'\
'</ul>\n'\
'</div>\n'\
'<h2 id="level1">Level1</h2>\n'\
'<h3 id="level2">Level2</h3>'
self.assertEqual(content, expected)