diff options
-rw-r--r-- | markdown.py | 9 | ||||
-rw-r--r-- | tests/misc/blockquote-hr.html | 23 | ||||
-rw-r--r-- | tests/misc/blockquote-hr.txt | 21 |
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. |