aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/treeprocessors.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-02-08 06:50:25 -0500
committerWaylan Limberg <waylan@gmail.com>2013-02-08 06:50:25 -0500
commita0df080088bef0fac603b83752a36c5c403016e6 (patch)
tree04ad4b2fb13032c677e472515fad8f34dffe50e4 /markdown/treeprocessors.py
parent25e187598f06f04feeacbf967b7651e93286d3f4 (diff)
downloadmarkdown-a0df080088bef0fac603b83752a36c5c403016e6.tar.gz
markdown-a0df080088bef0fac603b83752a36c5c403016e6.tar.bz2
markdown-a0df080088bef0fac603b83752a36c5c403016e6.zip
Cleaned up fixes for #183
My previous commit (d5a94c2) broke a few things badly. Unfortunately I failed to run the complete test suite and didn't catch it. A bad regex was crashing the test suite. Also cleaned up a few other odds and ends from previous work on #183. Still loosing a few random empty lines in code blocks though. I suspect this may also fix #188.
Diffstat (limited to 'markdown/treeprocessors.py')
-rw-r--r--markdown/treeprocessors.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index fb107d2..b5eedbd 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -357,3 +357,8 @@ class PrettifyTreeprocessor(Treeprocessor):
br.tail = '\n'
else:
br.tail = '\n%s' % br.tail
+ # Clean up extra empty lines at end of code blocks.
+ pres = root.getiterator('pre')
+ for pre in pres:
+ if len(pre) and pre[0].tag == 'code':
+ pre[0].text = pre[0].text.rstrip() + '\n'