diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2018-07-27 10:55:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-27 10:55:41 -0400 |
commit | 25482261a494ad12c108435580ed13927bdc417c (patch) | |
tree | 5b108a5923322d5ceb3fa47d5f05d27a1039de7c /markdown/postprocessors.py | |
parent | 55d69f408cfabed6bd5953a4e7bfc926df2ac25b (diff) | |
download | markdown-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/postprocessors.py')
-rw-r--r-- | markdown/postprocessors.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py index 0fb4406..c25d00a 100644 --- a/markdown/postprocessors.py +++ b/markdown/postprocessors.py @@ -15,10 +15,10 @@ from . import util import re -def build_postprocessors(md_instance, **kwargs): +def build_postprocessors(md, **kwargs): """ Build the default postprocessors for Markdown. """ postprocessors = util.Registry() - postprocessors.register(RawHtmlPostprocessor(md_instance), 'raw_html', 30) + postprocessors.register(RawHtmlPostprocessor(md), 'raw_html', 30) postprocessors.register(AndSubstitutePostprocessor(), 'amp_substitute', 20) postprocessors.register(UnescapePostprocessor(), 'unescape', 10) return postprocessors @@ -51,13 +51,13 @@ class RawHtmlPostprocessor(Postprocessor): def run(self, text): """ Iterate over html stash and restore html. """ replacements = OrderedDict() - for i in range(self.markdown.htmlStash.html_counter): - html = self.markdown.htmlStash.rawHtmlBlocks[i] + for i in range(self.md.htmlStash.html_counter): + html = self.md.htmlStash.rawHtmlBlocks[i] if self.isblocklevel(html): replacements["<p>%s</p>" % - (self.markdown.htmlStash.get_placeholder(i))] = \ + (self.md.htmlStash.get_placeholder(i))] = \ html + "\n" - replacements[self.markdown.htmlStash.get_placeholder(i)] = html + replacements[self.md.htmlStash.get_placeholder(i)] = html if replacements: pattern = re.compile("|".join(re.escape(k) for k in replacements)) |