1
2
3
4
5
6
7
8
9
10
11
|
#!python3
import re
from ..echo import echo
dReplTable = {
# surnumerary_spaces
"start_of_paragraph": [("^[ ]+", "")],
"end_of_paragraph": [("[ ]+$", "")],
"between_words": [(" | ", " "), # espace + espace insécable -> espace
|
<
|
1
2
3
4
5
6
7
8
9
10
|
#!python3
import re
dReplTable = {
# surnumerary_spaces
"start_of_paragraph": [("^[ ]+", "")],
"end_of_paragraph": [("[ ]+$", "")],
"between_words": [(" | ", " "), # espace + espace insécable -> espace
|
245
246
247
248
249
250
251
252
253
254
255
|
for i, t in enumerate(lTup):
lTup[i] = (re.compile(t[0]), t[1])
def formatText (self, sText, **args):
for sOptName, bVal in lOptRepl:
if bVal:
for zRgx, sRep in dReplTable[sOptName]:
#echo("{} --> {}".format(zRgx.pattern, sRep))
sText = zRgx.sub(sRep, sText)
#echo(sText)
return sText
|
<
<
|
244
245
246
247
248
249
250
251
252
|
for i, t in enumerate(lTup):
lTup[i] = (re.compile(t[0]), t[1])
def formatText (self, sText, **args):
for sOptName, bVal in lOptRepl:
if bVal:
for zRgx, sRep in dReplTable[sOptName]:
sText = zRgx.sub(sRep, sText)
return sText
|