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