diff --git a/content.py b/content.py
index 69c5f0905..ef5069148 100644
--- a/content.py
+++ b/content.py
@@ -41,6 +41,23 @@ def htmlReplaceQuoteMarks(content: str) -> str:
currChar = '”'
openQuote = not openQuote
newContent += currChar
+
+ if '"' in newContent:
+ openQuote = True
+ content = newContent
+ newContent = ''
+ ctr = 0
+ sections = content.split('"')
+ noOfSections = len(sections)
+ for s in sections:
+ newContent += s
+ if ctr < noOfSections - 1:
+ if openQuote:
+ newContent += '“'
+ else:
+ newContent += '”'
+ openQuote = not openQuote
+ ctr += 1
return newContent
diff --git a/tests.py b/tests.py
index 68dbaaad6..2f85cd218 100644
--- a/tests.py
+++ b/tests.py
@@ -1938,9 +1938,9 @@ def runHtmlReplaceQuoteMarks():
result = htmlReplaceQuoteMarks(testStr)
assert result == '“hello”'
- testStr = '"hello" test html'
+ testStr = '"hello" "test" html'
result = htmlReplaceQuoteMarks(testStr)
- assert result == '“hello” test html'
+ assert result == '“hello” “test” html'
def runAllTests():