aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-06-01 22:35:27 -0400
committerWaylan Limberg <waylan@gmail.com>2011-06-01 22:35:27 -0400
commit7f9106965c28a1780164736e33c8244a8cc1c44b (patch)
tree0e9a5d2c6d7530fc36300240117a1ba736058a3f
parent17a56ae4318055dd1952433d23e25eaa1e4b2cfa (diff)
downloadmarkdown-7f9106965c28a1780164736e33c8244a8cc1c44b.tar.gz
markdown-7f9106965c28a1780164736e33c8244a8cc1c44b.tar.bz2
markdown-7f9106965c28a1780164736e33c8244a8cc1c44b.zip
Fixed #15. Setext Headers now work with any number of - or = characters.
-rw-r--r--markdown/blockprocessors.py2
-rw-r--r--tests/misc/h1.html4
-rw-r--r--tests/misc/h1.txt6
3 files changed, 10 insertions, 2 deletions
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index cc1d2a8..6396b4a 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -431,7 +431,7 @@ class SetextHeaderProcessor(BlockProcessor):
""" Process Setext-style Headers. """
# Detect Setext-style header. Must be first 2 lines of block.
- RE = re.compile(r'^.*?\n[=-]{3,}', re.MULTILINE)
+ RE = re.compile(r'^.*?\n[=-]+[ ]*(\n|$)', re.MULTILINE)
def test(self, parent, block):
return bool(self.RE.match(block))
diff --git a/tests/misc/h1.html b/tests/misc/h1.html
index fbf9b4d..886b61e 100644
--- a/tests/misc/h1.html
+++ b/tests/misc/h1.html
@@ -1,3 +1,5 @@
<h2>Header</h2>
<h1>Header 2</h1>
-<h3>H3</h3> \ No newline at end of file
+<h3>H3</h3>
+<h1>H1</h1>
+<h2>H2</h2> \ No newline at end of file
diff --git a/tests/misc/h1.txt b/tests/misc/h1.txt
index 0a1c8f9..f67b921 100644
--- a/tests/misc/h1.txt
+++ b/tests/misc/h1.txt
@@ -5,3 +5,9 @@ Header 2
========
### H3
+
+H1
+=
+
+H2
+--