diff --git a/content.py b/content.py index 3db21aa9..8adf8ada 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('>', '' + else: + newContent += '
') + newContent += '' + lineStr + '
' + lineStr + '
' else: lineStr = lineStr.replace('>> ', '>') + lineStr = lineStr.replace('>', '' return newContent diff --git a/tests.py b/tests.py index 110c99be..95fd86f6 100644 --- a/tests.py +++ b/tests.py @@ -2149,6 +2149,16 @@ def testReplaceEmailQuote(): print('Expect: ' + expectedStr) assert resultStr == expectedStr + testStr = "
') newContent += '' + lineStr + '
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...')