Extract signatures from emails sent with Newton

This commit is contained in:
Régis Hanol 2018-04-19 12:39:55 +02:00
parent 45850a0cd6
commit 2b0e505121
1 changed files with 7 additions and 0 deletions

View File

@ -304,6 +304,7 @@ module Email
[:mozilla, / class="moz-/], [:mozilla, / class="moz-/],
[:protonmail, / class="protonmail_/], [:protonmail, / class="protonmail_/],
[:zimbra, / data-marker="__/], [:zimbra, / data-marker="__/],
[:newton, /(id|class)="cm_/],
] ]
def extract_from_gmail(doc) def extract_from_gmail(doc)
@ -360,6 +361,12 @@ module Email
to_markdown(doc.to_html, elided.to_html) to_markdown(doc.to_html, elided.to_html)
end end
def extract_from_newton(doc)
# Removes anything that has an id or a class starting with 'cm_'
elided = doc.css("*[id^='cm_'], *[class^='cm_']").remove
to_markdown(doc.to_html, elided.to_html)
end
def trim_reply_and_extract_elided(text) def trim_reply_and_extract_elided(text)
return [text, ""] if @opts[:skip_trimming] return [text, ""] if @opts[:skip_trimming]
EmailReplyTrimmer.trim(text, true) EmailReplyTrimmer.trim(text, true)