forked from indymedia/epicyon
Style of quoted paragraphs
parent
488ef5b34d
commit
08b6d14400
|
@ -17,6 +17,12 @@ from utils import getLinkPrefixes
|
||||||
def htmlReplaceEmailQuote(content: str) -> str:
|
def htmlReplaceEmailQuote(content: str) -> str:
|
||||||
"""Replaces an email style quote "> Some quote" with html blockquote
|
"""Replaces an email style quote "> Some quote" with html blockquote
|
||||||
"""
|
"""
|
||||||
|
# replace quote paragraph
|
||||||
|
if '<p>"' in content:
|
||||||
|
if '"</p>' in content:
|
||||||
|
content = content.replace('<p>"', '<p><blockquote>')
|
||||||
|
content = content.replace('"</p>', '</blockquote></p>')
|
||||||
|
# replace email style quote
|
||||||
if '>> ' not in content:
|
if '>> ' not in content:
|
||||||
return content
|
return content
|
||||||
contentStr = content.replace('<p>', '')
|
contentStr = content.replace('<p>', '')
|
||||||
|
|
4
tests.py
4
tests.py
|
@ -2134,6 +2134,10 @@ def testReplaceEmailQuote():
|
||||||
'<p>With multiple</p><p>lines</p>'
|
'<p>With multiple</p><p>lines</p>'
|
||||||
assert htmlReplaceEmailQuote(testStr) == testStr
|
assert htmlReplaceEmailQuote(testStr) == testStr
|
||||||
|
|
||||||
|
testStr = '<p>"This is a quoted paragraph."</p>'
|
||||||
|
assert htmlReplaceEmailQuote(testStr) == \
|
||||||
|
'<p><blockquote>This is a quoted paragraph.</blockquote></p>'
|
||||||
|
|
||||||
testStr = "<p><span class=\"h-card\">" + \
|
testStr = "<p><span class=\"h-card\">" + \
|
||||||
"<a href=\"https://somewebsite/@nickname\" " + \
|
"<a href=\"https://somewebsite/@nickname\" " + \
|
||||||
"class=\"u-url mention\">@<span>nickname</span></a></span> " + \
|
"class=\"u-url mention\">@<span>nickname</span></a></span> " + \
|
||||||
|
|
Loading…
Reference in New Issue