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:
|
if not lineStr:
|
||||||
continue
|
continue
|
||||||
if '>> ' not in lineStr:
|
if '>> ' not in lineStr:
|
||||||
newContent += '<p>' + lineStr + '</p>'
|
if lineStr.startswith('> '):
|
||||||
|
lineStr = lineStr.replace('> ', '<blockquote>')
|
||||||
|
lineStr = lineStr.replace('>', '<br>')
|
||||||
|
newContent += '<p>' + lineStr + '</blockquote></p>'
|
||||||
|
else:
|
||||||
|
newContent += '<p>' + lineStr + '</p>'
|
||||||
else:
|
else:
|
||||||
lineStr = lineStr.replace('>> ', '><blockquote>')
|
lineStr = lineStr.replace('>> ', '><blockquote>')
|
||||||
|
lineStr = lineStr.replace('>', '<br>')
|
||||||
newContent += '<p>' + lineStr + '</blockquote></p>'
|
newContent += '<p>' + lineStr + '</blockquote></p>'
|
||||||
return newContent
|
return newContent
|
||||||
|
|
||||||
|
|
10
tests.py
10
tests.py
|
@ -2149,6 +2149,16 @@ def testReplaceEmailQuote():
|
||||||
print('Expect: ' + expectedStr)
|
print('Expect: ' + expectedStr)
|
||||||
assert resultStr == 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():
|
def runAllTests():
|
||||||
print('Running tests...')
|
print('Running tests...')
|
||||||
|
|
Loading…
Reference in New Issue