MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   Plugin for tidying ePub files (https://www.mobileread.com/forums/showthread.php?t=264378)

CalibUser 11-21-2020 10:28 AM

@thosp: Thank you for letting me know about this bug. This has been fixed and the updated plugin has been put in the first post of this thread.

thosp 05-24-2021 09:44 AM

Incorrect Character Change
 
Greetings,

I ran the plugin against a file containing, "Texta / Textb"

and it changed it to, "Texta I Textb".

That is incorrect, isn't it?

CalibUser 05-25-2021 06:25 AM

Quote:

Originally Posted by thosp (Post 4124345)
I ran the plugin against a file containing, "Texta / Textb"

and it changed it to, "Texta I Textb".

That is incorrect, isn't it?

@thosp: The plugin is not perfect and a number of assumptions were made for changing text/symbols that may seem to be incorrect.

The plugin assumes that a "/" separated by two spaces should be the letter "I" as this was one of the frequent errors in ePub files that were converted from pdf files. It will not change a "/" if it is not surrounded by spaces.

So although the plugin is amending "Texta / Textb" incorrectly, it is making the change that it was programmed to do. If I amend the code to ignore " / " then it will not detect any " / "s that should be an "I".

It is not possible to amend the plugin so that it can work out whether a " / " should be changed to "I" or not:(. On balance, I will leave the plugin to change " / " to "I" as "I" in the pdf is commonly converted to "/" in the ePub.

KevinH 05-25-2021 11:27 AM

One idea is to do what Doitsu does in many of his plugins which is to use the plugins Prefs to store user-editable preferences so that the user can enable that change or not.

CalibUser 05-26-2021 06:55 AM

Quote:

Originally Posted by KevinH (Post 4124658)
...use the plugins Prefs to store user-editable preferences so that the user can enable that change or not.

Thanks for the suggestion. However, for some changes this would be long-winded to implement. In the worse case situation I would have to split up the following code to allow each term to be selected/rejected:

Code:

        if cDetermineQuotes.OpenQ == "‘":
                CorrectText("Corrected apostrophes in wrong direction", r'[ ]?‘(ad|ave|bout|eard|em|er|cause|cept|im|is|old|ome|ow|specially|Taint|til|tis|twas)(\W?)', r' ’\1\2')
        else:
                CorrectText("Corrected apostrophes in wrong direction", r'[ ]?‘(?i)(\d\d|ad[n]{0,1}|app[yines]{0,5}|appen[eds]{0,2}|ard[er]{0,2}|arf|alf|ang|as|at|av[ein]{0,3}|bout|bye|cause|cept[ing]{0,3}|copter[s]{0,1}|cos|cross|cuz|couse|e[emr]{0,1}|ell|elp[edling]{0,5}|ere[abouts]{0,5}|eard|f|fraid|fore|id|igh[er]{0,2}|ighness|im|is|isself|gainst|kay|less|mongst| n|nd|neath|nough|nother|nuff|o[o]{0,1}|ood|ome|ow|op[eding]{0,3}|oney|orse[flesh]{0,5}|ouse[ds]{0,1}|pon|puter[edrs]{0,2}|round|scuse[ds]{0,1}|spect[sed]{0,2}|scaped|sides|tween|special[ly]{0,2}|stead|t|taint|til|tis|twas|twere|twould|twil l|ud|un|urt|vise)(\W?)', r' ’\1\2')

However, if enough users want this feature then I will consider it.

democrite 05-28-2021 09:56 PM

I understand such would require a fair amount of work. As I believe I suggested something like such before, someday yes, yes I say yes.


All times are GMT -4. The time now is 08:29 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.