aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/util.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2018-07-31 14:12:49 -0400
committerGitHub <noreply@github.com>2018-07-31 14:12:49 -0400
commit1e7fd3f236f63f9ca9b85de9cd172b77e7f9be80 (patch)
tree480f31abf71a8c205d04f961478fd579680b570f /markdown/util.py
parent7dad12c07e3e701da42474696398cb32e5c9979f (diff)
downloadmarkdown-1e7fd3f236f63f9ca9b85de9cd172b77e7f9be80.tar.gz
markdown-1e7fd3f236f63f9ca9b85de9cd172b77e7f9be80.tar.bz2
markdown-1e7fd3f236f63f9ca9b85de9cd172b77e7f9be80.zip
Move isBlockLevel to class. (#693)
Allows users and/or extensions to alter the list of block level elements. The old implementation remains with a DeprecationWarning. Fixes #575.
Diffstat (limited to 'markdown/util.py')
-rw-r--r--markdown/util.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/markdown/util.py b/markdown/util.py
index b40c010..262521c 100644
--- a/markdown/util.py
+++ b/markdown/util.py
@@ -113,6 +113,26 @@ AUXILIARY GLOBAL FUNCTIONS
"""
+def deprecated(message):
+ """
+ Raise a DeprecationWarning when wrapped function/method is called.
+
+ Borrowed from https://stackoverflow.com/a/48632082/866026
+ """
+ def deprecated_decorator(func):
+ @wraps(func)
+ def deprecated_func(*args, **kwargs):
+ warnings.warn(
+ "'{}' is deprecated. {}".format(func.__name__, message),
+ category=DeprecationWarning,
+ stacklevel=2
+ )
+ return func(*args, **kwargs)
+ return deprecated_func
+ return deprecated_decorator
+
+
+@deprecated("Use 'Markdown.is_block_level' instead.")
def isBlockLevel(tag):
"""Check if the tag is a block level HTML tag."""
if isinstance(tag, string_type):
@@ -151,25 +171,6 @@ def code_escape(text):
return text
-def deprecated(message):
- """
- Raise a DeprecationWarning when wrapped function/method is called.
-
- Borrowed from https://stackoverflow.com/a/48632082/866026
- """
- def deprecated_decorator(func):
- @wraps(func)
- def deprecated_func(*args, **kwargs):
- warnings.warn(
- "'{}' is deprecated. {}".format(func.__name__, message),
- category=DeprecationWarning,
- stacklevel=2
- )
- return func(*args, **kwargs)
- return deprecated_func
- return deprecated_decorator
-
-
"""
MISC AUXILIARY CLASSES
=============================================================================