aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2007-10-11 02:21:42 +0000
committerWaylan Limberg <waylan@gmail.com>2007-10-11 02:21:42 +0000
commita9b2d38626a95ccad8e4bbdc9d2cc7325ab7b928 (patch)
treed96f8c018a9269d0f646589756c42c15d6ebb475
parentad4a8806b056e966fed410cb127582145b61e234 (diff)
downloadmarkdown-a9b2d38626a95ccad8e4bbdc9d2cc7325ab7b928.tar.gz
markdown-a9b2d38626a95ccad8e4bbdc9d2cc7325ab7b928.tar.bz2
markdown-a9b2d38626a95ccad8e4bbdc9d2cc7325ab7b928.zip
Horizontal rules in block quotes with tests. Fixes [1709864].
-rw-r--r--markdown.py9
-rw-r--r--tests/misc/blockquote-hr.html23
-rw-r--r--tests/misc/blockquote-hr.txt21
3 files changed, 51 insertions, 2 deletions
diff --git a/markdown.py b/markdown.py
index f0a2b36..0b7fac0 100644
--- a/markdown.py
+++ b/markdown.py
@@ -442,10 +442,15 @@ HEADER_PREPROCESSOR = HeaderPreprocessor()
class LinePreprocessor (Preprocessor):
"""Deals with HR lines (needs to be done before processing lists)"""
+ blockquote_re = re.compile(r'^(> )+')
+
def run (self, lines) :
for i in range(len(lines)) :
- if self._isLine(lines[i]) :
- lines[i] = self.stash.store("<hr />", safe=True)
+ prefix = ''
+ m = self.blockquote_re.search(lines[i])
+ if m : prefix = m.group(0)
+ if self._isLine(lines[i][len(prefix):]) :
+ lines[i] = prefix + self.stash.store("<hr />", safe=True)
return lines
def _isLine(self, block) :
diff --git a/tests/misc/blockquote-hr.html b/tests/misc/blockquote-hr.html
new file mode 100644
index 0000000..1d7af0f
--- /dev/null
+++ b/tests/misc/blockquote-hr.html
@@ -0,0 +1,23 @@
+<p>This is a paragraph.
+</p>
+<hr />
+
+<blockquote><p>Block quote with horizontal lines.
+</p>
+<hr />
+
+<blockquote><p>Double block quote.
+</p>
+<hr />
+
+<p>End of the double block quote.
+</p>
+</blockquote><p>A new paragraph.
+ With multiple lines.
+ Even a lazy line.
+</p>
+<hr />
+
+<p>The last line.
+</p>
+</blockquote> \ No newline at end of file
diff --git a/tests/misc/blockquote-hr.txt b/tests/misc/blockquote-hr.txt
new file mode 100644
index 0000000..ef9c44f
--- /dev/null
+++ b/tests/misc/blockquote-hr.txt
@@ -0,0 +1,21 @@
+This is a paragraph.
+
+---
+
+> Block quote with horizontal lines.
+
+> ---
+
+> > Double block quote.
+
+> > ---
+
+> > End of the double block quote.
+
+> A new paragraph.
+> With multiple lines.
+Even a lazy line.
+
+> ---
+
+> The last line.