310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
-
+
+
|
if "'" in sText:
sText = sText.replace("'", "’")
if "‐" in sText:
sText = sText.replace("‐", "-") # Hyphen (U+2010)
if "‑" in sText:
sText = sText.replace("‑", "-") # Non-Breaking Hyphen (U+2011)
if "@@" in sText:
sText = re.sub("@@+", "", sText)
sText = re.sub("@@+", lambda m: " " * len(m.group(0)), sText)
# function as replacement: https://docs.python.org/3.7/library/re.html#re.sub
return sText
def parseText (self, sText, sText0, bParagraph, nOffset, sCountry, dOptions, bShowRuleId, bDebug, bContext):
"parse the text with rules"
bChange = False
for sOption, lRuleGroup in _getRules(bParagraph):
if sOption == "@@@@":
|