aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/blockparser.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2018-07-27 10:55:41 -0400
committerGitHub <noreply@github.com>2018-07-27 10:55:41 -0400
commit25482261a494ad12c108435580ed13927bdc417c (patch)
tree5b108a5923322d5ceb3fa47d5f05d27a1039de7c /markdown/blockparser.py
parent55d69f408cfabed6bd5953a4e7bfc926df2ac25b (diff)
downloadmarkdown-25482261a494ad12c108435580ed13927bdc417c.tar.gz
markdown-25482261a494ad12c108435580ed13927bdc417c.tar.bz2
markdown-25482261a494ad12c108435580ed13927bdc417c.zip
All Markdown instances are now 'md'. (#691)
Previously, instances of the Markdown class were represented as any one of 'md', 'md_instance', or 'markdown'. This inconsistency made it difficult when developing extensions, or just maintaining the existing code. Now, all instances are consistently represented as 'md'. The old attributes on class instances still exist, but raise a DeprecationWarning when accessed. Also on classes where the instance was optional, the attribute always exists now and is simply None if no instance was provided (previously the attribute wouldn't exist).
Diffstat (limited to 'markdown/blockparser.py')
-rw-r--r--markdown/blockparser.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/markdown/blockparser.py b/markdown/blockparser.py
index 5e9d567..ccf66a0 100644
--- a/markdown/blockparser.py
+++ b/markdown/blockparser.py
@@ -44,10 +44,16 @@ class BlockParser:
looping through them and creating an ElementTree object.
"""
- def __init__(self, markdown):
+ def __init__(self, md):
self.blockprocessors = util.Registry()
self.state = State()
- self.markdown = markdown
+ self.md = md
+
+ @property
+ @util.deprecated("Use 'md' instead.")
+ def markdown(self):
+ # TODO: remove this later
+ return self.md
def parseDocument(self, lines):
""" Parse a markdown document into an ElementTree.
@@ -60,7 +66,7 @@ class BlockParser:
"""
# Create a ElementTree from the lines
- self.root = util.etree.Element(self.markdown.doc_tag)
+ self.root = util.etree.Element(self.md.doc_tag)
self.parseChunk(self.root, '\n'.join(lines))
return util.etree.ElementTree(self.root)