diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2014-11-20 16:07:03 -0500 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2014-11-20 16:07:03 -0500 |
commit | 8f66a94eab1389d97041944ed24afd2bf7c4389c (patch) | |
tree | 10b53664076650be951468cbbb163f3d637e5891 /markdown/postprocessors.py | |
parent | 0c2143819ef7de53be52f7a4d47e027ff194a9b4 (diff) | |
download | markdown-8f66a94eab1389d97041944ed24afd2bf7c4389c.tar.gz markdown-8f66a94eab1389d97041944ed24afd2bf7c4389c.tar.bz2 markdown-8f66a94eab1389d97041944ed24afd2bf7c4389c.zip |
Flake8 cleanup (mostly whitespace).
Got all but a couple files in the tests (ran out of time today).
Apparently I have been using some bad form for years (although a few
things seemed to look better before the update). Anyway, conformant now.
Diffstat (limited to 'markdown/postprocessors.py')
-rw-r--r-- | markdown/postprocessors.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py index 7b568ad..2d4dcb5 100644 --- a/markdown/postprocessors.py +++ b/markdown/postprocessors.py @@ -42,7 +42,7 @@ class Postprocessor(util.Processor): (possibly modified) string. """ - pass #pragma: no cover + pass # pragma: no cover class RawHtmlPostprocessor(Postprocessor): @@ -51,7 +51,7 @@ class RawHtmlPostprocessor(Postprocessor): def run(self, text): """ Iterate over html stash and restore "safe" html. """ for i in range(self.markdown.htmlStash.html_counter): - html, safe = self.markdown.htmlStash.rawHtmlBlocks[i] + html, safe = self.markdown.htmlStash.rawHtmlBlocks[i] if self.markdown.safeMode and not safe: if str(self.markdown.safeMode).lower() == 'escape': html = self.escape(html) @@ -59,12 +59,16 @@ class RawHtmlPostprocessor(Postprocessor): html = '' else: html = self.markdown.html_replacement_text - if self.isblocklevel(html) and (safe or not self.markdown.safeMode): - text = text.replace("<p>%s</p>" % - (self.markdown.htmlStash.get_placeholder(i)), - html + "\n") - text = text.replace(self.markdown.htmlStash.get_placeholder(i), - html) + if (self.isblocklevel(html) and + (safe or not self.markdown.safeMode)): + text = text.replace( + "<p>%s</p>" % + (self.markdown.htmlStash.get_placeholder(i)), + html + "\n" + ) + text = text.replace( + self.markdown.htmlStash.get_placeholder(i), html + ) return text def escape(self, html): @@ -88,7 +92,7 @@ class AndSubstitutePostprocessor(Postprocessor): """ Restore valid entities """ def run(self, text): - text = text.replace(util.AMP_SUBSTITUTE, "&") + text = text.replace(util.AMP_SUBSTITUTE, "&") return text |