I was looking to create a RegEx function and wanted to see how one of the others was set up, so I opened one (clicked the 'Create/Edit' button on Lower-Case Text)
Without changing anything, as I just wanted to see how it was set up, I clicked 'OK' and I got the following error message:
I realize that perhaps while I was checking this out I might have inadvertently changed something, I wasn't really paying attention, so I checked 'Upper-case text'. This time I definitely touched only the 'OK' button and got the same error message.
I checked 'Title-case text', and this one does NOT give me the error message.
Here is what is in the Function:
Spoiler:
Code:
from calibre.utils.icu import change_case
from calibre.ebooks.oeb.polish.utils import apply_func_to_match_groups
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
'''Make matched text lower case. If the regular expression contains groups,
only the text in the groups will be changed, otherwise the entire text is
changed.'''
return apply_func_to_match_groups(match, lower)