From 488ef5b34d136765d5ed0203e4e6f267da3370ca Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 14 Sep 2020 11:25:12 +0100 Subject: [PATCH] Extra blockquote check --- content.py | 8 +++++++- tests.py | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/content.py b/content.py index 3db21aa92..8adf8adaf 100644 --- a/content.py +++ b/content.py @@ -26,9 +26,15 @@ def htmlReplaceEmailQuote(content: str) -> str: if not lineStr: continue if '>> ' not in lineStr: - newContent += '

' + lineStr + '

' + if lineStr.startswith('> '): + lineStr = lineStr.replace('> ', '
') + lineStr = lineStr.replace('>', '
') + newContent += '

' + lineStr + '

' + else: + newContent += '

' + lineStr + '

' else: lineStr = lineStr.replace('>> ', '>
') + lineStr = lineStr.replace('>', '
') newContent += '

' + lineStr + '

' return newContent diff --git a/tests.py b/tests.py index 110c99be5..95fd86f6b 100644 --- a/tests.py +++ b/tests.py @@ -2149,6 +2149,16 @@ def testReplaceEmailQuote(): print('Expect: ' + expectedStr) assert resultStr == expectedStr + testStr = "

Some text:

> first line->second line

" + \ + "

Some question?

" + expectedStr = "

Some text:

first line-
" + \ + "second line

Some question?

" + resultStr = htmlReplaceEmailQuote(testStr) + if resultStr != expectedStr: + print('Result: ' + resultStr) + print('Expect: ' + expectedStr) + assert resultStr == expectedStr + def runAllTests(): print('Running tests...')