Merge pull request #50 from Easy-D/preserve-regular-blockquotes
Preserve regular blockquotes
This commit is contained in:
@@ -138,9 +138,10 @@ def cut_by_id(html_message):
|
||||
|
||||
|
||||
def cut_blockquote(html_message):
|
||||
''' Cuts blockquote with wrapping elements. '''
|
||||
quote = html_message.find('.//blockquote')
|
||||
if quote is not None:
|
||||
''' Cuts the last non-nested blockquote with wrapping elements. '''
|
||||
quote = html_message.xpath('(.//blockquote)[not(ancestor::blockquote)][last()]')
|
||||
if quote:
|
||||
quote = quote[0]
|
||||
quote.getparent().remove(quote)
|
||||
return True
|
||||
|
||||
|
||||
@@ -49,6 +49,24 @@ def test_quotation_splitter_outside_blockquote():
|
||||
RE_WHITESPACE.sub('', quotations.extract_from_html(msg_body)))
|
||||
|
||||
|
||||
def test_regular_blockquote():
|
||||
msg_body = """Reply
|
||||
<blockquote>Regular</blockquote>
|
||||
|
||||
<div>
|
||||
On 11-Apr-2011, at 6:54 PM, Bob <bob@example.com> wrote:
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<div>
|
||||
<blockquote>Nested</blockquote>
|
||||
</div>
|
||||
</blockquote>
|
||||
"""
|
||||
eq_("<html><body><p>Reply</p><blockquote>Regular</blockquote><div></div></body></html>",
|
||||
RE_WHITESPACE.sub('', quotations.extract_from_html(msg_body)))
|
||||
|
||||
|
||||
def test_no_blockquote():
|
||||
msg_body = """
|
||||
<html>
|
||||
|
||||
Reference in New Issue
Block a user