aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'markdown/extensions/__init__.py')
-rw-r--r--markdown/extensions/__init__.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/markdown/extensions/__init__.py b/markdown/extensions/__init__.py
index 03b2a4c..a823fef 100644
--- a/markdown/extensions/__init__.py
+++ b/markdown/extensions/__init__.py
@@ -7,9 +7,10 @@ from __future__ import unicode_literals
from ..util import parseBoolValue
import warnings
+
class Extension(object):
""" Base class for extensions to subclass. """
-
+
# Default config -- to be overriden by a subclass
# Must be of the following format:
# {
@@ -18,7 +19,7 @@ class Extension(object):
# Note that Extension.setConfig will raise a KeyError
# if a default is not set here.
config = {}
-
+
def __init__(self, *args, **kwargs):
""" Initiate Extension and set up configs. """
@@ -26,23 +27,26 @@ class Extension(object):
# (there only ever used to be one so we use arg[0])
if len(args):
self.setConfigs(args[0])
- warnings.warn('Extension classes accepting positional args is pending Deprecation. '
- 'Each setting should be passed into the Class as a keyword. Positional '
- 'args will be deprecated in version 2.6 and raise an error in version '
- '2.7. See the Release Notes for Python-Markdown version 2.5 for more info.',
+ warnings.warn('Extension classes accepting positional args is '
+ 'pending Deprecation. Each setting should be '
+ 'passed into the Class as a keyword. Positional '
+ 'args will be deprecated in version 2.6 and raise '
+ 'an error in version 2.7. See the Release Notes for '
+ 'Python-Markdown version 2.5 for more info.',
PendingDeprecationWarning)
# check for configs kwarg for backward compat.
if 'configs' in kwargs.keys():
self.setConfigs(kwargs.pop('configs', {}))
- warnings.warn('Extension classes accepting a dict on the single keyword "config" is '
- 'pending Deprecation. Each setting should be passed into the Class as '
- 'a keyword directly. The "config" keyword will be deprecated in version '
- '2.6 and raise an error in version 2.7. See the Release Notes for '
+ warnings.warn('Extension classes accepting a dict on the single '
+ 'keyword "config" is pending Deprecation. Each '
+ 'setting should be passed into the Class as a '
+ 'keyword directly. The "config" keyword will be '
+ 'deprecated in version 2.6 and raise an error in '
+ 'version 2.7. See the Release Notes for '
'Python-Markdown version 2.5 for more info.',
PendingDeprecationWarning)
# finally, use kwargs
self.setConfigs(kwargs)
-
def getConfig(self, key, default=''):
""" Return a setting for the given key or an empty string. """
@@ -88,6 +92,7 @@ class Extension(object):
* md_globals: Global variables in the markdown module namespace.
"""
- raise NotImplementedError('Extension "%s.%s" must define an "extendMarkdown"' \
- 'method.' % (self.__class__.__module__, self.__class__.__name__))
-
+ raise NotImplementedError(
+ 'Extension "%s.%s" must define an "extendMarkdown"'
+ 'method.' % (self.__class__.__module__, self.__class__.__name__)
+ )