Thoughts on Python Function Replacement
I also have a question about the value of the request to add python function replace? Who actually uses this feature in calibre to write their own python routines for anything else other than numbering things?
Things like changing case can already be done, and smart quotes conversion is better done in plugin settings.
As for numbering why could we not just include the match count as an additional subcapture pattern value allowing the user to reference it in any replacement. Or alternatively just create a plugin that does heading renumbering. A heading renumberer plugin would be the most flexible if you allow the a regex to determine what you are numbering.
What else are people actually using it for that would not be handled better by a plugin.
Having a general user write their own replacement functions in python, edit them, debug them, compile them to bytecode, add and delete them, etc is a lot of overhead and code bloat for just numbering things.
So is this still needed assuming we added a general renumbering plugin controlled by a regex?
Last edited by KevinH; 03-22-2022 at 11:09 AM.
|