mirror of https://gitlab.com/bashrc2/epicyon
Extra blockquote check
parent
f658cbeb30
commit
488ef5b34d
|
@ -26,9 +26,15 @@ def htmlReplaceEmailQuote(content: str) -> str:
|
|||
if not lineStr:
|
||||
continue
|
||||
if '>> ' not in lineStr:
|
||||
if lineStr.startswith('> '):
|
||||
lineStr = lineStr.replace('> ', '<blockquote>')
|
||||
lineStr = lineStr.replace('>', '<br>')
|
||||
newContent += '<p>' + lineStr + '</blockquote></p>'
|
||||
else:
|
||||
newContent += '<p>' + lineStr + '</p>'
|
||||
else:
|
||||
lineStr = lineStr.replace('>> ', '><blockquote>')
|
||||
lineStr = lineStr.replace('>', '<br>')
|
||||
newContent += '<p>' + lineStr + '</blockquote></p>'
|
||||
return newContent
|
||||
|
||||
|
|
10
tests.py
10
tests.py
|
@ -2149,6 +2149,16 @@ def testReplaceEmailQuote():
|
|||
print('Expect: ' + expectedStr)
|
||||
assert resultStr == expectedStr
|
||||
|
||||
testStr = "<p>Some text:</p><p>> first line->second line</p>" + \
|
||||
"<p>Some question?</p>"
|
||||
expectedStr = "<p>Some text:</p><p><blockquote>first line-<br>" + \
|
||||
"second line</blockquote></p><p>Some question?</p>"
|
||||
resultStr = htmlReplaceEmailQuote(testStr)
|
||||
if resultStr != expectedStr:
|
||||
print('Result: ' + resultStr)
|
||||
print('Expect: ' + expectedStr)
|
||||
assert resultStr == expectedStr
|
||||
|
||||
|
||||
def runAllTests():
|
||||
print('Running tests...')
|
||||
|
|
Loading…
Reference in New Issue