mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #523 from StephaneBunel/master
New config parameter to enable Markdown extensions
This commit is contained in:
commit
848fdedec7
7 changed files with 40 additions and 9 deletions
8
tests/content/article_with_markdown_markup_extensions.md
Normal file
8
tests/content/article_with_markdown_markup_extensions.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Title: Test Markdown extensions
|
||||
|
||||
[TOC]
|
||||
|
||||
## Level1
|
||||
|
||||
### Level2
|
||||
|
||||
|
|
@ -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'],
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue