aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2007-10-08 01:36:05 +0000
committerWaylan Limberg <waylan@gmail.com>2007-10-08 01:36:05 +0000
commita75df2c7bf2325449fdecc613290f126b7141ccb (patch)
treef37a5c25f0237774e66b5a224241bec5225bfa73
parente26b6af09b5277711a89ebada8118bd7ab259de3 (diff)
downloadmarkdown-a75df2c7bf2325449fdecc613290f126b7141ccb.tar.gz
markdown-a75df2c7bf2325449fdecc613290f126b7141ccb.tar.bz2
markdown-a75df2c7bf2325449fdecc613290f126b7141ccb.zip
Fixed lazy blockquote and added tests
-rw-r--r--markdown.py11
-rw-r--r--tests/misc/lazy-block-quote.html9
-rw-r--r--tests/misc/lazy-block-quote.txt5
-rw-r--r--tests/misc/multi-paragraph-block-quote.html10
-rw-r--r--tests/misc/multi-paragraph-block-quote.txt8
5 files changed, 41 insertions, 2 deletions
diff --git a/markdown.py b/markdown.py
index adcce81..e1e7dae 100644
--- a/markdown.py
+++ b/markdown.py
@@ -1442,15 +1442,22 @@ class Markdown:
dequoted = []
i = 0
+ blank_line = False # allow one blank line between paragraphs
for line in lines :
m = RE.regExp['quoted'].match(line)
if m :
dequoted.append(m.group(1))
i += 1
+ blank_line = False
+ elif not blank_line and line.strip() != '' :
+ dequoted.append(line)
+ i += 1
+ elif not blank_line and line.strip() == '' :
+ dequoted.append(line)
+ i += 1
+ blank_line = True
else :
break
- else :
- i += 1
blockquote = self.doc.createElement('blockquote')
parent_elem.appendChild(blockquote)
diff --git a/tests/misc/lazy-block-quote.html b/tests/misc/lazy-block-quote.html
new file mode 100644
index 0000000..14da987
--- /dev/null
+++ b/tests/misc/lazy-block-quote.html
@@ -0,0 +1,9 @@
+
+<blockquote><p>Line one of lazy block quote.
+ Line two of lazy block quote.
+</p>
+<p>Line one of paragraph two.
+ Line two of paragraph two.
+</p>
+</blockquote>
+
diff --git a/tests/misc/lazy-block-quote.txt b/tests/misc/lazy-block-quote.txt
new file mode 100644
index 0000000..e7c17ca
--- /dev/null
+++ b/tests/misc/lazy-block-quote.txt
@@ -0,0 +1,5 @@
+> Line one of lazy block quote.
+Line two of lazy block quote.
+
+> Line one of paragraph two.
+Line two of paragraph two.
diff --git a/tests/misc/multi-paragraph-block-quote.html b/tests/misc/multi-paragraph-block-quote.html
new file mode 100644
index 0000000..b213d84
--- /dev/null
+++ b/tests/misc/multi-paragraph-block-quote.html
@@ -0,0 +1,10 @@
+
+<blockquote><p>This is line one of paragraph one
+ This is line two of paragraph one
+</p>
+<p>This is line one of paragraph two
+</p>
+</blockquote><blockquote><p>This is another blockquote.
+</p>
+</blockquote>
+
diff --git a/tests/misc/multi-paragraph-block-quote.txt b/tests/misc/multi-paragraph-block-quote.txt
new file mode 100644
index 0000000..f8a986f
--- /dev/null
+++ b/tests/misc/multi-paragraph-block-quote.txt
@@ -0,0 +1,8 @@
+> This is line one of paragraph one
+> This is line two of paragraph one
+
+> This is line one of paragraph two
+
+
+
+> This is another blockquote.