Strip text before adding blockquote markers (#76)
This commit is contained in:
@@ -237,7 +237,7 @@ class MarkdownConverter(object):
|
||||
if convert_as_inline:
|
||||
return text
|
||||
|
||||
return '\n' + (line_beginning_re.sub('> ', text) + '\n\n') if text else ''
|
||||
return '\n' + (line_beginning_re.sub('> ', text.strip()) + '\n\n') if text else ''
|
||||
|
||||
def convert_br(self, el, text, convert_as_inline):
|
||||
if convert_as_inline:
|
||||
|
||||
@@ -52,6 +52,12 @@ def test_b_spaces():
|
||||
|
||||
def test_blockquote():
|
||||
assert md('<blockquote>Hello</blockquote>') == '\n> Hello\n\n'
|
||||
assert md('<blockquote>\nHello\n</blockquote>') == '\n> Hello\n\n'
|
||||
|
||||
|
||||
def test_blockquote_with_nested_paragraph():
|
||||
assert md('<blockquote><p>Hello</p></blockquote>') == '\n> Hello\n\n'
|
||||
assert md('<blockquote><p>Hello</p><p>Hello again</p></blockquote>') == '\n> Hello\n> \n> Hello again\n\n'
|
||||
|
||||
|
||||
def test_blockquote_with_paragraph():
|
||||
@@ -60,7 +66,7 @@ def test_blockquote_with_paragraph():
|
||||
|
||||
def test_blockquote_nested():
|
||||
text = md('<blockquote>And she was like <blockquote>Hello</blockquote></blockquote>')
|
||||
assert text == '\n> And she was like \n> > Hello\n> \n> \n\n'
|
||||
assert text == '\n> And she was like \n> > Hello\n\n'
|
||||
|
||||
|
||||
def test_br():
|
||||
|
||||
Reference in New Issue
Block a user