forked from github/pelican
Avoid Markdown 2.6 deprecations; make MD_EXTENSIONS a dict
* Make MD_EXTENSIONS setting a dict and add tests for this change;
* Short extension names ('extra', 'meta') are deprecated
https://pythonhosted.org/Markdown/release-2.6.html#shortened-extension-names-deprecated
* Extension config as part of extension name is deprecated
https://pythonhosted.org/Markdown/release-2.6.html#extension-configuration-as-part-of-extension-name-deprecated
This commit is contained in:
parent
a2852da3e7
commit
510961bbb9
6 changed files with 51 additions and 15 deletions
|
|
@ -101,7 +101,11 @@ DEFAULT_CONFIG = {
|
|||
'PELICAN_CLASS': 'pelican.Pelican',
|
||||
'DEFAULT_DATE_FORMAT': '%a %d %B %Y',
|
||||
'DATE_FORMATS': {},
|
||||
'MD_EXTENSIONS': ['codehilite(css_class=highlight)', 'extra'],
|
||||
'MD_EXTENSIONS': {
|
||||
'markdown.extensions.codehilite': {'css_class': 'highlight'},
|
||||
'markdown.extensions.extra': {},
|
||||
'markdown.extensions.meta': {},
|
||||
},
|
||||
'JINJA_EXTENSIONS': [],
|
||||
'JINJA_FILTERS': {},
|
||||
'LOG_FILTER': [],
|
||||
|
|
@ -362,6 +366,14 @@ def configure_settings(settings):
|
|||
PATH_KEY)
|
||||
settings[PATH_KEY] = DEFAULT_CONFIG[PATH_KEY]
|
||||
|
||||
# Save people from declaring MD_EXTENSIONS as a list rather than a dict
|
||||
if not isinstance(settings.get('MD_EXTENSIONS', {}), dict):
|
||||
logger.warning('The format of the MD_EXTENSIONS setting has '
|
||||
'changed. It should now be a dict mapping '
|
||||
'fully-qualified extension names to their '
|
||||
'configurations. Falling back to the default.')
|
||||
settings['MD_EXTENSIONS'] = DEFAULT_CONFIG['MD_EXTENSIONS']
|
||||
|
||||
# Add {PAGE,ARTICLE}_PATHS to {ARTICLE,PAGE}_EXCLUDES
|
||||
mutually_exclusive = ('ARTICLE', 'PAGE')
|
||||
for type_1, type_2 in [mutually_exclusive, mutually_exclusive[::-1]]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue