Improved signature detection.

This commit is contained in:
Martin Edenhofer 2017-03-18 11:37:56 +01:00
parent 7d4d82c1ec
commit 03b0a456e7
2 changed files with 28 additions and 1 deletions

View file

@ -334,7 +334,8 @@ class String
'<p>[[:space:]]*(--|__)',
'(<br(|\/)>|<p>|<div>)[[:space:]]*<b>(Von|From|De|от|Z|Od|Ze|Fra|Van|Mistä|Από|Dal|から|Из|од|iz|Från|จาก|з|Từ):[[:space:]]*</b>',
'(<br>|<div>)[[:space:]]*<br>[[:space:]]*(Von|From|De|от|Z|Od|Ze|Fra|Van|Mistä|Από|Dal|から|Из|од|iz|Från|จาก|з|Từ):[[:space:]]+',
'<blockquote(|.+?)>[[:space:]]*<div>[[:space:]]*(On|Am)',
'<blockquote(|.+?)>[[:space:]]*<div>[[:space:]]*(On|Am|Le|El|Den|Dňa|W dniu|Il|Op|Dne|Dana)[[:space:]]',
'<div(|.+?)>[[:space:]]*<br>[[:space:]]*(On|Am|Le|El|Den|Dňa|W dniu|Il|Op|Dne|Dana)[[:space:]].+?<blockquote',
]
map.each { |regexp|
string.sub!(/#{regexp}/m) { |placeholder|

View file

@ -1062,6 +1062,32 @@ christian.schaefer@example.com'
</blockquote></div>'
assert_equal(result, html.html2html_strict)
html = '<div>
<br> Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk &lt;support@example.com&gt;:<br>
<br>
</div>'
result = '<div>
<br> Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk &lt;support@example.com&gt;:<br>
<br>
</div>'
assert_equal(result, html.html2html_strict)
html = '<div>
<br> Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk &lt;support@example.com&gt;:<br>
<br>
</div>
<blockquote type="cite">
<div>Dear Mr. Smith,<br></div>
</blockquote>'
result = '<span class="js-signatureMarker"></span><div>
<br> Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk &lt;support@example.com&gt;:<br>
<br>
</div><blockquote type="cite">
<div>Dear Mr. Smith,<br>
</div>
</blockquote>'
assert_equal(result, html.html2html_strict)
end
end