FEATURE: begone gmail signatures!
This commit is contained in:
parent
73ee62f55f
commit
3c430a3949
|
@ -261,7 +261,7 @@ module Email
|
||||||
end
|
end
|
||||||
|
|
||||||
markdown, elided_markdown = if html.present?
|
markdown, elided_markdown = if html.present?
|
||||||
if html[/<div class="gmail_(quote|extra)"/]
|
if html[%{<div class="gmail_}]
|
||||||
html, elided_html = extract_from_gmail(html)
|
html, elided_html = extract_from_gmail(html)
|
||||||
markdown = HtmlToMarkdown.new(html, keep_img_tags: true, keep_cid_imgs: true).to_markdown
|
markdown = HtmlToMarkdown.new(html, keep_img_tags: true, keep_cid_imgs: true).to_markdown
|
||||||
elided_markdown = HtmlToMarkdown.new(elided_html).to_markdown
|
elided_markdown = HtmlToMarkdown.new(elided_html).to_markdown
|
||||||
|
@ -286,9 +286,9 @@ module Email
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_from_gmail(html)
|
def extract_from_gmail(html)
|
||||||
doc = Nokogiri::HTML.fragment(html)
|
doc = Nokogiri::HTML.parse(html)
|
||||||
elided = doc.css(".gmail_quote, .gmail_extra").remove
|
elided = doc.xpath("//*[contains(@class, 'gmail_')]").remove
|
||||||
[doc.to_html, elided.to_html]
|
[doc.root.to_html, elided.to_html]
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_from_outlook(html)
|
def extract_from_outlook(html)
|
||||||
|
|
Loading…
Reference in New Issue