Style of quoted paragraphs

main
Bob Mottram 2020-09-14 12:30:56 +01:00
parent 488ef5b34d
commit 08b6d14400
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,12 @@ from utils import getLinkPrefixes
def htmlReplaceEmailQuote(content: str) -> str:
"""Replaces an email style quote "> Some quote" with html blockquote
"""
# replace quote paragraph
if '<p>&quot;' in content:
if '&quot;</p>' in content:
content = content.replace('<p>&quot;', '<p><blockquote>')
content = content.replace('&quot;</p>', '</blockquote></p>')
# replace email style quote
if '>&gt; ' not in content:
return content
contentStr = content.replace('<p>', '')

View File

@ -2134,6 +2134,10 @@ def testReplaceEmailQuote():
'<p>With multiple</p><p>lines</p>'
assert htmlReplaceEmailQuote(testStr) == testStr
testStr = '<p>&quot;This is a quoted paragraph.&quot;</p>'
assert htmlReplaceEmailQuote(testStr) == \
'<p><blockquote>This is a quoted paragraph.</blockquote></p>'
testStr = "<p><span class=\"h-card\">" + \
"<a href=\"https://somewebsite/@nickname\" " + \
"class=\"u-url mention\">@<span>nickname</span></a></span> " + \