Implemented the auto-replace code in the doc viewer.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
import nw
|
||||
|
||||
from operator import itemgetter
|
||||
@@ -57,6 +58,15 @@ class Tokenizer():
|
||||
|
||||
return
|
||||
|
||||
def doAutoReplace(self):
|
||||
if len(self.theProject.autoReplace) > 0:
|
||||
theDict = {}
|
||||
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)
|
||||
return
|
||||
|
||||
def tokenizeText(self):
|
||||
"""Scan the text for either lines starting with specific characters that indicate headers,
|
||||
comments, commands etc, or just contains plain text. in the case of plain text, apply the
|
||||
|
||||
Reference in New Issue
Block a user