Improved signature detection.
This commit is contained in:
parent
37288861e4
commit
e8c32728bb
2 changed files with 29 additions and 0 deletions
|
@ -377,6 +377,22 @@ class App.Utils
|
|||
foundInLines = lineCount
|
||||
searchForMs(textToSearchInLines, markers)
|
||||
|
||||
# word 14
|
||||
# edv hotline wrote:
|
||||
# edv hotline schrieb:
|
||||
searchForWord14 = (textToSearchInLines, markers) ->
|
||||
lineCount = 0
|
||||
for line in textToSearchInLines
|
||||
lineCount += 1
|
||||
if line && line.match( /^.{1,250}\s(wrote|schrieb):/ )
|
||||
marker =
|
||||
line: cleanup(line)
|
||||
lineCount: lineCount
|
||||
type: 'Word14'
|
||||
markers.push marker
|
||||
return
|
||||
searchForWord14(textToSearchInLines, markers)
|
||||
|
||||
# marker template
|
||||
markerTemplate = '<span class="js-signatureMarker"></span>'
|
||||
|
||||
|
|
|
@ -706,6 +706,19 @@ test( "identify signature", function() {
|
|||
result = App.Utils.signatureIdentify( message, true )
|
||||
equal( result, should )
|
||||
|
||||
// word 14
|
||||
// en
|
||||
message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Bob Smith wrote:<br/>lalala</div>"
|
||||
should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>Bob Smith wrote:<br/>lalala</div>'
|
||||
result = App.Utils.signatureIdentify( message, true )
|
||||
equal( result, should )
|
||||
|
||||
// de
|
||||
message = "<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/>Bob Smith schrieb:<br/>lalala</div>"
|
||||
should = '<div>test 123 <br/><br/>--no not match--<br/><br/>Bob Smith<br/><span class="js-signatureMarker"></span>Bob Smith schrieb:<br/>lalala</div>'
|
||||
result = App.Utils.signatureIdentify( message, true )
|
||||
equal( result, should )
|
||||
|
||||
});
|
||||
|
||||
// replace tags
|
||||
|
|
Loading…
Reference in a new issue