Update docs and tests for MARKDOWN_EXTENTIONS

This commit is contained in:
Stéphane Bunel 2012-09-28 23:09:57 +02:00
commit 45c836fdf5
5 changed files with 30 additions and 9 deletions

View file

@ -101,7 +101,7 @@ class RstReader(Reader):
def _get_publisher(self, filename):
extra_params = {'initial_header_level': '2'}
pub = docutils.core.Publisher(
destination_class=docutils.io.StringOutput)
destination_class=docutils.io.StringOutput)
pub.set_components('standalone', 'restructuredtext', 'html')
pub.writer.translator_class = PelicanHTMLTranslator
pub.process_programmatic_settings(None, extra_params, None)
@ -124,13 +124,17 @@ class RstReader(Reader):
class MarkdownReader(Reader):
enabled = bool(Markdown)
file_extensions = ['md', 'markdown', 'mkd']
extensions = ['codehilite', 'extra' ]
extensions = ['codehilite', 'extra']
def read(self, filename):
"""Parse content and metadata of markdown files"""
markdown_extentions = self.settings.get('MARKDOWN_EXTENTIONS', [])
if isinstance(markdown_extentions, (str, unicode)):
markdown_extentions = [m.strip() for m in
markdown_extentions.split(',')]
text = pelican_open(filename)
md = Markdown(extensions=set(self.extensions + markdown_extentions + ['meta']))
md = Markdown(extensions=set(
self.extensions + markdown_extentions + ['meta']))
content = md.convert(text)
metadata = {}

View file

@ -75,7 +75,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
'SUMMARY_MAX_LENGTH': 50,
'WEBASSETS': False,
'PLUGINS': [],
'MARKDOWN_EXTENTIONS': [],
'MARKDOWN_EXTENTIONS': [ 'toc', ],
}