FIX: less aggressive gmail eliding

This commit is contained in:
Régis Hanol 2018-07-04 20:04:46 +02:00
parent 448e2fe1a2
commit 8a53941fe0
2 changed files with 3 additions and 4 deletions

View File

@ -301,7 +301,7 @@ module Email
end end
HTML_EXTRACTERS ||= [ HTML_EXTRACTERS ||= [
[:gmail, /class="gmail_(?!default)/], [:gmail, /class="gmail_(signature|extra)/],
[:outlook, /id="(divRplyFwdMsg|Signature)"/], [:outlook, /id="(divRplyFwdMsg|Signature)"/],
[:word, /class="WordSection1"/], [:word, /class="WordSection1"/],
[:exchange, /name="message(Body|Reply)Section"/], [:exchange, /name="message(Body|Reply)Section"/],
@ -313,9 +313,8 @@ module Email
] ]
def extract_from_gmail(doc) def extract_from_gmail(doc)
# GMail adds a bunch of 'gmail_' prefixed classes like: gmail_signature, gmail_extra, gmail_quote # GMail adds a bunch of 'gmail_' prefixed classes like: gmail_signature, gmail_extra, gmail_quote, gmail_default...
# Just elide them all except for 'gmail_default' elided = doc.css(".gmail_signature, .gmail_extra").remove
elided = doc.css("*[class^='gmail_']:not([class*='gmail_default'])").remove
to_markdown(doc.to_html, elided.to_html) to_markdown(doc.to_html, elided.to_html)
end end

Binary file not shown.