This commit is contained in:
Sergey Obukhov
2015-12-05 00:37:02 -08:00
parent 2c416ecc0e
commit 41457d8fbd
5 changed files with 93 additions and 81 deletions

View File

@@ -76,7 +76,7 @@ def delete_quotation_tags(html_note, counter, quotation_checkpoints):
def cut_gmail_quote(html_message):
''' Cuts the outermost block element with class gmail_quote. '''
gmail_quote = html_message.cssselect('.gmail_quote')
gmail_quote = html_message.cssselect('div.gmail_quote')
if gmail_quote:
gmail_quote[0].getparent().remove(gmail_quote[0])
return True
@@ -138,8 +138,12 @@ def cut_by_id(html_message):
def cut_blockquote(html_message):
''' Cuts the last non-nested blockquote with wrapping elements. '''
quote = html_message.xpath('(.//blockquote)[not(ancestor::blockquote)][last()]')
''' Cuts the last non-nested blockquote with wrapping elements.'''
quote = html_message.xpath(
'(.//blockquote)'
'[not(@class="gmail_quote") and not(ancestor::blockquote)]'
'[last()]')
if quote:
quote = quote[0]
quote.getparent().remove(quote)