aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/__init__.py56
-rw-r--r--markdown/extensions/toc.py8
-rw-r--r--tests/test_apis.py12
3 files changed, 35 insertions, 41 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 12b53ba..19c4fc7 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -121,10 +121,9 @@ class Markdown(object):
# ignore any additional args
break
if len(args):
- warnings.warn('Positional arguments are pending depreacted in '
- 'Markdown and will be deprecated in version 2.6. '
+ warnings.warn('Positional arguments are depreacted in Markdown'
'Use keyword arguments only.',
- PendingDeprecationWarning)
+ DeprecationWarning)
# Loop through kwargs and assign defaults
for option, default in self.option_defaults.items():
@@ -136,19 +135,17 @@ class Markdown(object):
self.enable_attributes = False
if 'safe_mode' in kwargs:
- warnings.warn('"safe_mode" is pending deprecation in '
- 'Python-Markdown and will be deprecated in '
- 'version 2.6. Use an HTML sanitizer (like '
+ warnings.warn('"safe_mode" is deprecated in Python-Markdown'
+ 'Use an HTML sanitizer (like '
'Bleach http://bleach.readthedocs.org/) '
'if you are parsing untrusted markdown text. '
- 'See the 2.5 release notes for more info',
- PendingDeprecationWarning)
+ 'See the 2.6 release notes for more info',
+ DeprecationWarning)
if 'html_replacement_text' in kwargs:
- warnings.warn('The "html_replacement_text" keyword is pending '
- 'deprecation in Python-Markdown and will be '
- 'deprecated in version 2.6 along with "safe_mode".',
- PendingDeprecationWarning)
+ warnings.warn('The "html_replacement_text" keyword is '
+ 'deprecated along with "safe_mode".',
+ DeprecationWarning)
self.registeredExtensions = []
self.docType = ""
@@ -217,13 +214,12 @@ class Markdown(object):
pairs = [x.split("=") for x in ext_args.split(",")]
configs.update([(x.strip(), y.strip()) for (x, y) in pairs])
warnings.warn('Setting configs in the Named Extension string is '
- 'pending deprecation. It is recommended that you '
+ 'deprecated. It is recommended that you '
'pass an instance of the extension class to '
'Markdown or use the "extension_configs" keyword. '
- 'The current behavior will be deprecated in '
- 'version 2.6 and raise an error in version 2.7. '
+ 'The current behavior will raise an error in version 2.7. '
'See the Release Notes for Python-Markdown version '
- '2.5 for more info.', PendingDeprecationWarning)
+ '2.6 for more info.', DeprecationWarning)
# Get class name (if provided): `path.to.module:ClassName`
ext_name, class_name = ext_name.split(':', 1) \
@@ -253,15 +249,14 @@ class Markdown(object):
module_name
)
warnings.warn('Using short names for Markdown\'s builtin '
- 'extensions is pending deprecation. Use the '
+ 'extensions is deprecated. Use the '
'full path to the extension with Python\'s dot '
'notation (eg: "%s" instead of "%s"). The '
- 'current behavior will be deprecated in '
- 'version 2.6 and raise an error in version '
+ 'current behavior will raise an error in version '
'2.7. See the Release Notes for '
- 'Python-Markdown version 2.5 for more info.' %
+ 'Python-Markdown version 2.6 for more info.' %
(module_name, ext_name),
- PendingDeprecationWarning)
+ DeprecationWarning)
except ImportError:
# Preppend `mdx_` to name
module_name_old_style = '_'.join(['mdx', ext_name])
@@ -270,17 +265,16 @@ class Markdown(object):
logger.debug(
'Successfuly imported extension module "%s".' %
module_name_old_style)
- warnings.warn('Markdown\'s behavuor of appending "mdx_" '
- 'to an extension name is pending '
- 'deprecation. Use the full path to the '
+ warnings.warn('Markdown\'s behavior of prepending "mdx_" '
+ 'to an extension name is deprecated. '
+ 'Use the full path to the '
'extension with Python\'s dot notation '
'(eg: "%s" instead of "%s"). The current '
- 'behavior will be deprecated in version '
- '2.6 and raise an error in version 2.7. '
+ 'behavior will raise an error in version 2.7. '
'See the Release Notes for Python-Markdown '
- 'version 2.5 for more info.' %
+ 'version 2.6 for more info.' %
(module_name_old_style, ext_name),
- PendingDeprecationWarning)
+ DeprecationWarning)
except ImportError as e:
message = "Failed loading extension '%s' from '%s', '%s' " \
"or '%s'" % (ext_name, ext_name, module_name,
@@ -524,10 +518,10 @@ def markdownFromFile(*args, **kwargs):
if c == len(pos):
break
if len(args):
- warnings.warn('Positional arguments are pending depreacted in '
- 'Markdown and will be deprecated in version 2.6. '
+ warnings.warn('Positional arguments are depreacted in '
+ 'Markdown and will raise an error in version 2.7. '
'Use keyword arguments only.',
- PendingDeprecationWarning)
+ DeprecationWarning)
md = Markdown(**kwargs)
md.convertFile(kwargs.get('input', None),
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index fdb193b..cea3440 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -88,7 +88,7 @@ def order_toc_list(toc_list):
class TocTreeprocessor(Treeprocessor):
def __init__(self, md, config):
super(TocTreeprocessor, self).__init__(md)
-
+
self.marker = config["marker"]
self.title = config["title"]
self.slugify = config["slugify"]
@@ -104,7 +104,7 @@ class TocTreeprocessor(Treeprocessor):
for parent in root.iter():
for child in parent:
yield parent, child
-
+
def replace_marker(self, root, elem):
''' Replace marker with elem. '''
for (p, c) in self.iterparent(root):
@@ -177,12 +177,12 @@ class TocTreeprocessor(Treeprocessor):
div = etree.Element("div")
div.attrib["class"] = "toc"
self.replace_marker(doc, div)
-
+
toc_list = []
for el in doc.iter():
if self.header_rgx.match(el.tag):
text = ''.join(itertext(el)).strip()
-
+
# Do not override pre-existing ids
if "id" not in el.attrib:
elem_id = stashedHTML2text(text, self.markdown)
diff --git a/tests/test_apis.py b/tests/test_apis.py
index 769ac83..4ed2990 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -371,24 +371,24 @@ class TestErrors(unittest.TestCase):
)
def testMdxExtention(self):
- """ Test that appending mdx_ raises a PendingDeprecationWarning. """
+ """ Test that prepending mdx_ raises a DeprecationWarning. """
_create_fake_extension(name='fake', use_old_style=True)
self.assertRaises(
- PendingDeprecationWarning,
+ DeprecationWarning,
markdown.Markdown, extensions=['fake']
)
def testShortNameExtention(self):
- """ Test that using a short name raises a PendingDeprecationWarning. """
+ """ Test that using a short name raises a DeprecationWarning. """
self.assertRaises(
- PendingDeprecationWarning,
+ DeprecationWarning,
markdown.Markdown, extensions=['footnotes']
)
def testStringConfigExtention(self):
- """ Test that passing configs to an Extension in the name raises a PendingDeprecationWarning. """
+ """ Test that passing configs to an Extension in the name raises a DeprecationWarning. """
self.assertRaises(
- PendingDeprecationWarning,
+ DeprecationWarning,
markdown.Markdown, extensions=['markdown.extension.footnotes(PLACE_MARKER=FOO)']
)