Added wrapper classes for spell checker so new libraries can be added

This commit is contained in:
Veronica K. B. Olsen
2019-06-11 20:27:29 +02:00
parent 3c2864f161
commit c48b1deb8f
10 changed files with 113 additions and 21 deletions
+3 -3
View File
@@ -28,13 +28,13 @@ class ToHtml(Tokenizer):
def doAutoReplace(self):
Tokenizer.doAutoReplace(self)
theDict = {
repDict = {
"<" : "&lt;",
">" : "&gt;",
"&" : "&amp;",
}
xRep = re.compile("|".join([re.escape(k) for k in theDict.keys()]), flags=re.DOTALL)
self.theText = xRep.sub(lambda x: theDict[x.group(0)], self.theText)
xRep = re.compile("|".join([re.escape(k) for k in repDict.keys()]), flags=re.DOTALL)
self.theText = xRep.sub(lambda x: repDict[x.group(0)], self.theText)
return
+4 -4
View File
@@ -60,11 +60,11 @@ class Tokenizer():
def doAutoReplace(self):
if len(self.theProject.autoReplace) > 0:
theDict = {}
repDict = {}
for aKey, aVal in self.theProject.autoReplace.items():
theDict["<%s>" % aKey] = aVal
xRep = re.compile("|".join([re.escape(k) for k in theDict.keys()]), flags=re.DOTALL)
self.theText = xRep.sub(lambda x: theDict[x.group(0)], self.theText)
repDict["<%s>" % aKey] = aVal
xRep = re.compile("|".join([re.escape(k) for k in repDict.keys()]), flags=re.DOTALL)
self.theText = xRep.sub(lambda x: repDict[x.group(0)], self.theText)
return
def tokenizeText(self):