mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-01 09:39:51 -04:00
FIX: Add "On day, name wrote:" quote trigger for emails
This commit is contained in:
parent
4edbb5b98c
commit
a0dccf7bc0
2 changed files with 14 additions and 2 deletions
lib/email
|
@ -74,9 +74,20 @@ module Email
|
|||
private
|
||||
|
||||
def add_newlines(doc)
|
||||
# Replace <br> tags with a markdown \n
|
||||
doc.xpath('//br').each do |br|
|
||||
br.replace(Nokogiri::XML::Text.new("\n", doc))
|
||||
br.replace(new_linebreak_node doc)
|
||||
end
|
||||
# Surround <p> tags with newlines, to help with line-wise postprocessing
|
||||
# and ensure markdown paragraphs
|
||||
doc.xpath('//p').each do |p|
|
||||
p.before(new_linebreak_node doc)
|
||||
p.after(new_linebreak_node doc, 2)
|
||||
end
|
||||
end
|
||||
|
||||
def new_linebreak_node(doc, count=1)
|
||||
Nokogiri::XML::Text.new("\n" * count, doc)
|
||||
end
|
||||
|
||||
def trim_process_node(node)
|
||||
|
|
|
@ -159,7 +159,8 @@ module Email
|
|||
(l =~ /via #{SiteSetting.title}(.*)\:$/) ||
|
||||
# This one might be controversial but so many reply lines have years, times and end with a colon.
|
||||
# Let's try it and see how well it works.
|
||||
(l =~ /\d{4}/ && l =~ /\d:\d\d/ && l =~ /\:$/)
|
||||
(l =~ /\d{4}/ && l =~ /\d:\d\d/ && l =~ /\:$/) ||
|
||||
(l =~ /On \w+ \d+,? \d+,?.*wrote:/)
|
||||
|
||||
# Headers on subsequent lines
|
||||
break if (0..2).all? { |off| lines[idx+off] =~ REPLYING_HEADER_REGEX }
|
||||
|
|
Loading…
Add table
Reference in a new issue