212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
-
+
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
|
def _createError (s, sx, sRepl, nOffset, m, iGroup, sLineId, sRuleId, bUppercase, sMsg, sURL, bShowRuleId, sOption, bContext):
nStart = nOffset + m.start(iGroup)
nEnd = nOffset + m.end(iGroup)
# suggestions
if sRepl[0:1] == "=":
sugg = globals()[sRepl[1:]](s, m)
sSugg = globals()[sRepl[1:]](s, m)
if sugg:
if bUppercase and m.group(iGroup)[0:1].isupper():
lSugg = list(map(str.capitalize, sugg.split("|")))
else:
lSugg = sugg.split("|")
else:
lSugg = []
lSugg = sSugg.split("|") if sSugg else []
elif sRepl == "_":
lSugg = []
else:
lSugg = m.expand(sRepl).split("|")
if bUppercase and m.group(iGroup)[0:1].isupper():
lSugg = list(map(str.capitalize, m.expand(sRepl).split("|")))
if bUppercase and lSugg and m.group(iGroup)[0:1].isupper():
lSugg = list(map(str.capitalize, lSugg))
else:
lSugg = m.expand(sRepl).split("|")
# Message
sMessage = globals()[sMsg[1:]](s, m) if sMsg[0:1] == "=" else m.expand(sMsg)
if bShowRuleId:
sMessage += " # " + sLineId + " # " + sRuleId
#
if _bWriterError:
xErr = SingleProofreadingError() # uno.createUnoStruct( "com.sun.star.linguistic2.SingleProofreadingError" )
|
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
|
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
|
-
-
-
-
-
+
-
-
+
-
-
+
+
-
-
|
raise Exception(str(e), sLineId, sRuleId, self.sSentence)
return bChange, dError
def _createError (self, sSugg, nTokenOffset, iFirstToken, nStart, nEnd, sLineId, sRuleId, bUppercase, sMsg, sURL, bShowRuleId, sOption, bContext):
# suggestions
if sSugg[0:1] == "=":
sSugg = globals()[sSugg[1:]](self.lToken, nTokenOffset)
if sSugg:
if bUppercase and self.lToken[iFirstToken]["sValue"][0:1].isupper():
lSugg = list(map(str.capitalize, sSugg.split("|")))
else:
lSugg = sSugg.split("|")
lSugg = sSugg.split("|") if sSugg else []
else:
lSugg = []
elif sSugg == "_":
lSugg = []
else:
lSugg = self._expand(sSugg, nTokenOffset).split("|")
if bUppercase and self.lToken[iFirstToken]["sValue"][0:1].isupper():
lSugg = list(map(str.capitalize, self._expand(sSugg, nTokenOffset).split("|")))
if bUppercase and lSugg and self.lToken[iFirstToken]["sValue"][0:1].isupper():
lSugg = list(map(str.capitalize, lSugg))
else:
lSugg = self._expand(sSugg, nTokenOffset).split("|")
# Message
sMessage = globals()[sMsg[1:]](self.lToken) if sMsg[0:1] == "=" else self._expand(sMsg, nTokenOffset)
if bShowRuleId:
sMessage += " " + sLineId + " # " + sRuleId
#
if _bWriterError:
xErr = SingleProofreadingError() # uno.createUnoStruct( "com.sun.star.linguistic2.SingleProofreadingError" )
|