![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 41
Karma: 467802
Join Date: Apr 2016
Device: none
|
[Plugin] cssUndefinedClasses
Hi to all,
as requested some weeks ago, here is a plugin that deletes from the xhtml all classes and ids that are not referenced anywhere in the stylesheets (nor in fragment identifiers in href or other attributes, in the case of ids). There is a graphical interface that lets the user choose what they want to remove and what they want to keep. I tried to adjust the colors of backgrounds and texts to keep it all readable and not too ugly in the various dark modes, but I couldn't test the plugin on a Mac (and I know Tcl/Tk and Mac don't always get along very well...). The parser css used by the plugin is css_parser/cssutils, the parser xhtml is gumbo (adapter for sigil_bs4), all provided by Sigil installers. The license of the plugin is the GPL v3 or any later version. I tested this plugin on Windows 11 with Sigil 2.3 and 2.4.2, but it should work the same on Linux and macOS. If the plugin's window doesn't appear after launch on macOS, it probably is just hidden behind other windows: you should be able to bring it to the foreground just by clicking on the plugin's icon in the dock. Until version 0.2.2 the plugin by default looked for id references in the form of fragment identifiers in the attributes "href", "epub:textref" and "src", since version 0.2.3 this list has been expanded in three groups of attributes (users can edit these lists in the Preferences pane of the plugin, after launching it). Attributes that can contain a fragment identifier:
Attributes that can contain a single id reference:
Attributes that can contain a whitespace separated list of id references:
(A fragment identifier is the part of a URI that follows the '#' character, e.g. href="#fragid". An id reference is just the value of the id that is referenced.) Some of the attributes will probably never be used in epubs to match an element's id (like the "ping" attribute), but it should be harmless to keep them around, just in case. Version 0.2.3 of the plugin also provides a different tk theme for the Linux ui, that I find more pleasant than the default one. If it causes problems, you can disable it updating manually the preferences of the plugin in $SIGIL_PREFS/plugin_prefs/cssUndefinedClasses/cssUndefinedClasses.json, setting (or adding) the "tktheme" entry to an empty string (i.e. Code:
"tktheme": "", Changes: Spoiler:
Last edited by wrCisco; 02-25-2025 at 11:49 AM. Reason: Update to version 0.2.3 |
![]() |
![]() |
![]() |
#2 |
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,787
Karma: 6706327
Join Date: Mar 2015
Device: Kindle, iOS
|
![]() ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
Join Date: Nov 2009
Device: many
|
Thank you! I added it to the Sigil Plugin Index.
|
![]() |
![]() |
![]() |
#4 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 41
Karma: 467802
Join Date: Apr 2016
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 48
Karma: 10000
Join Date: Apr 2011
Device: iPad
|
Ah! Nice. I too have either resorted to sloppy Regex or Calibre to take care of this. Thanks!
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 41
Karma: 467802
Join Date: Apr 2016
Device: none
|
Quote:
I just uploaded version 0.2.2 of the plugin, with an icon for displaying in Sigil and in the window manager (if the 'manager' allows it). Also, the plugin now accepts some invalid class and id names found in css selectors (even if they are invalid, the plugin should not ignore them entirely). |
|
![]() |
![]() |
![]() |
#7 |
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,787
Karma: 6706327
Join Date: Mar 2015
Device: Kindle, iOS
|
Hello! After updating macOS from Sonoma to Sequoia 15.2, cssUndefinedClasses plugin stopped working. The plugin launches and starts running ... and running ... and running ... and never gets past the startup window to completion (I let it run 30 minutes, also tried it on multiple ebooks).
The same thing is happening with cssRemoveUnusedSelectors plugin. I'm guessing there's some incompatibility introduced in Sequoia. Maybe something with Python ...? What further information can I provide to help identify the problem and solution? Thank you ETA: I do have "Use Bundled Python" checked in the Manage Plugins window and all other plugins I have tried work. It's just these two. Last edited by odamizu; 12-21-2024 at 04:30 PM. |
![]() |
![]() |
![]() |
#8 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
Join Date: Nov 2009
Device: many
|
That is the plugin icon. This plugin uses Tk for graphics. My guess is Tk is either broken by Sequoia or the plugin's Tk window has opened underneath Sigil, or underneath the PluginRunner dialog or requires you to click on the plugins icon to bring its dialog window to the front.
This is why I never use the latest release of macOS as it invariably breaks things. I stay one full macOS version back. Last edited by KevinH; 12-21-2024 at 10:00 PM. |
![]() |
![]() |
![]() |
#9 | ||
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,787
Karma: 6706327
Join Date: Mar 2015
Device: Kindle, iOS
|
Quote:
Quote:
Also, if I had waited until next fall to update to Sequoia (staying one full macOS version behind), would this necessarily have been fixed by then? (and how would it have been fixed if someone didn't discover the problem?) |
||
![]() |
![]() |
![]() |
#10 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,466
Karma: 167726775
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Very likely one of the developers, likely KevinH since he is a Mac user, would update a test machine. There are users who update to the "latest and greatest" and then kvetch when things break. Personally, I keep testing Sigil on my Windows 11 Preview virtual machine so I can attempt to spot any issues with Sigil in that environment before the updates arrive for my physical computer.
|
![]() |
![]() |
![]() |
#11 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
Join Date: Nov 2009
Device: many
|
I think this is not a bug but a new "security feature" of Sequoia which forces the user to select the icon of forked/subprocess gui programs (like a plugin using Tk for example) at least the very first time something is launched.
MacOS ideas of "security" are for the birds as any python program can pretty much do whatever it wants to files it has permission to access. |
![]() |
![]() |
![]() |
#12 | |
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,787
Karma: 6706327
Join Date: Mar 2015
Device: Kindle, iOS
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,437
Karma: 5702578
Join Date: Nov 2009
Device: many
|
No. I only meant that updating to Sequoia that has been out officially only 2 months is probably not something for everyone.
FWIW, I could already both extend and mirror my screen to my iPad and iPhone using the earlier version of macOS, but to each his own. Testing and reporting issues is always fine. Thank you. It is just that early releases of macOS are often very broken and do not get fixed by Apple until many minor releases have come and gone. If you read my earlier reply, I think this is an extra "security" change by Apple. It is really Qt that vets its software against Apple releases and trues to make sure gui things work. There have already been two MacOS releases that crashed for no reasons which we had to track down and work around in Sigil only to undo those changes when Apple and or fixed its issues. You helped test workarounds for both of them. Last edited by KevinH; 12-22-2024 at 05:34 PM. |
![]() |
![]() |
![]() |
#14 | |
just an egg
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,787
Karma: 6706327
Join Date: Mar 2015
Device: Kindle, iOS
|
My reply was really in response to DNSB's comment about "kvetching", which startled me as you (KevinH) have always seemed interested in hearing about issues, even from reckless early adopters (which I usually am not — I clung to High Sierra for years and years).
In any case, I now have a simple and effective workaround, for which I thank you. P.S. The new feature in Sequoia that interested me is that I can now control my iPhone from my Mac. I think this is new and different from being able to mirror a Mac to an iPhone/iPad. It requires macOS Sequoia and iOS 18: https://support.apple.com/en-us/120421 Quote:
Last edited by odamizu; 12-22-2024 at 06:08 PM. |
|
![]() |
![]() |
![]() |
#15 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,466
Karma: 167726775
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Metadata Source Plugin] Empty Plugin? (Fake Identifier) | mneimeyer | Plugins | 3 | 11-11-2019 08:07 PM |
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. | slowsmile | Plugins | 3 | 07-25-2018 08:14 PM |
Goodread Perception Expander plugin not shown on plugin list (kobo h2o) | www | KOReader | 4 | 09-28-2017 10:34 AM |
Problem with my ScrambleEbook plugin and the Plugin Updater tool | jackie_w | Development | 14 | 01-19-2017 10:49 PM |
Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 02:24 AM |