@CalibUser
Those are ok, if you can add a Message for the user such as when you haven't checked the Fix line breaks or in the Plugin Runner message window.
Something like... "Please check the FixP & FixE words!!!"
Code:
############ FIXES Π ###########
def IsFixP(m):
"""
This function examines a word to see whether is required to fix the Π character that is misspelled.
It is called by a regular expression function (re.sub) in FixCommonErrors()
It returns the original expression if the checked word is not in the dictionary,
otherwise it returns the word without the Π fixed
"""
FixP="Π"+m.group(2)
FixP2=m.group(1)+m.group(2)
if spell(FixP2):
return(m.group(0))
elif spell(FixP):
print("FixP: ",FixP2, " changed to ", FixP)
return ('Π'+m.group(2))
else:
return(m.group(1)+m.group(2))
############ FIXES έ ###########
def IsFixE(m):
"""
This function examines a word to see whether is required to fix the έ character that is misspelled.
It is called by a regular expression function (re.sub) in FixCommonErrors()
It returns the original expression if the checked word is not in the dictionary,
otherwise it returns the word without the Π fixed
"""
FixE=m.group(1)+"έ"+m.group(2)
FixE2=m.group(1)+"ύ"+m.group(2)
if spell(FixE2):
return(m.group(1)+"ύ"+m.group(2))
elif spell(FixE):
print("FixE: ",FixE2, " changed to ", FixE)
return(m.group(1)+"έ"+m.group(2))
else:
return(m.group(1)+"ύ"+m.group(2))
Code:
#Fixes Π in words that are misspelled
if dictExists == True:
CorrectText("Π fixes",r"(1\ Ι|1\ Ι|1Ι|1I|ΓΙ|Γΐ|ΙΙ|II|Ι\ Ι|ΓΤ|ΙΊ|Ιί)[ ]?(\w+)(?![^<>]*>)(?!.*<body[^>]*>)", IsFixP)
#Fixes έ in words that are misspelled
if dictExists == True:
CorrectText("έ fixes",r"(\w+)ύ(\w+)(?![^<>]*>)(?!.*<body[^>]*>)", IsFixE)