mirror of https://gitlab.com/bashrc2/epicyon
Replace quotes
parent
a0c6dd9374
commit
853ef7af2e
|
@ -36,9 +36,9 @@ def htmlReplaceQuoteMarks(content: str) -> str:
|
|||
markup = False
|
||||
elif ch == '"' and not markup:
|
||||
if openQuote:
|
||||
currChar = '<q>'
|
||||
currChar = '“'
|
||||
else:
|
||||
currChar = '</q>'
|
||||
currChar = '”'
|
||||
openQuote = not openQuote
|
||||
newContent += currChar
|
||||
return newContent
|
||||
|
@ -639,7 +639,7 @@ def addHtmlTags(baseDir: str, httpPrefix: str,
|
|||
if longWordsList:
|
||||
content = removeLongWords(content, maxWordLength, longWordsList)
|
||||
content = content.replace(' --linebreak-- ', '</p><p>')
|
||||
return '<p>' + content + '</p>'
|
||||
return '<p>' + htmlReplaceQuoteMarks(content) + '</p>'
|
||||
|
||||
|
||||
def getMentionsFromHtml(htmlText: str,
|
||||
|
|
6
tests.py
6
tests.py
|
@ -1928,7 +1928,7 @@ def runHtmlReplaceQuoteMarks():
|
|||
print('htmlReplaceQuoteMarks')
|
||||
testStr = 'The "cat" "sat" on the mat'
|
||||
result = htmlReplaceQuoteMarks(testStr)
|
||||
assert result == 'The <q>cat</q> <q>sat</q> on the mat'
|
||||
assert result == 'The “cat” “sat” on the mat'
|
||||
|
||||
testStr = 'The cat sat on the mat'
|
||||
result = htmlReplaceQuoteMarks(testStr)
|
||||
|
@ -1936,11 +1936,11 @@ def runHtmlReplaceQuoteMarks():
|
|||
|
||||
testStr = '"hello"'
|
||||
result = htmlReplaceQuoteMarks(testStr)
|
||||
assert result == '<q>hello</q>'
|
||||
assert result == '“hello”'
|
||||
|
||||
testStr = '"hello" <a href="somesite.html">test html</a>'
|
||||
result = htmlReplaceQuoteMarks(testStr)
|
||||
assert result == '<q>hello</q> <a href="somesite.html">test html</a>'
|
||||
assert result == '“hello” <a href="somesite.html">test html</a>'
|
||||
|
||||
|
||||
def runAllTests():
|
||||
|
|
Loading…
Reference in New Issue