mirror of
https://github.com/discourse/discourse.git
synced 2025-09-11 21:04:42 +08: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
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue