Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 08-13-2020, 12:14 AM   #1
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 38
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.

For now I tested the plugin with Sigil 1.2 and 1.3 on Linux Mint, Manjaro, Win7 and Win10.

I uploaded the first version of the plugin as a beta (needs some more testing), let me know if you encounter any problems, thanks!

The license of the plugin is the GPL v3 or any later version.

Changes:
Spoiler:
v0.2.0:
- the search for fragment identifiers has been extended to all xml files (ncx, media overlays...);
- the list of attributes in which to search for fragment identifiers is user customizable in the preferences pane, and the default values are href, epub:textref and src;
- another option for the user in the preferences pane is to restrict the search for classes and IDs to be removed to only a selected subset of files.
v0.2.1:
- flash bug fix (in v0.2.0 fragment identifiers were searched for only in selected xhtml files).
v0.2.2
- added an icon for the plugin;
- less rigid parsing of css selectors: now the plugin process also some invalid names for classes and ids in the stylesheets (although invalid, the plugin shouldn't ignore them).
Attached Files
File Type: zip cssUndefinedClasses_v0.2.1.zip (22.7 KB, 485 views)
File Type: zip cssUndefinedClasses_v0.2.2.zip (26.0 KB, 2090 views)

Last edited by wrCisco; 08-22-2020 at 01:01 PM. Reason: Update to version 0.2.2
wrCisco is offline   Reply With Quote
Old 08-13-2020, 01:44 AM   #2
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,656
Karma: 5432100
Join Date: Mar 2015
Device: Kindle, iOS
I use Calibre to do this and am happy to now have this functionality in Sigil. (I also love your cssRemoveUnusedSelectors plugin )
odamizu is offline   Reply With Quote
Advert
Old 08-13-2020, 09:02 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,108
Karma: 5450184
Join Date: Nov 2009
Device: many
Thank you! I added it to the Sigil Plugin Index.
KevinH is offline   Reply With Quote
Old 08-14-2020, 02:47 PM   #4
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 38
Karma: 467802
Join Date: Apr 2016
Device: none
Quote:
Originally Posted by odamizu View Post
I use Calibre to do this and am happy to now have this functionality in Sigil. (I also love your cssRemoveUnusedSelectors plugin )
Quote:
Originally Posted by KevinH View Post
Thank you! I added it to the Sigil Plugin Index.
Thanks for the appreciation. I just uploaded a second version of the plugin with some improvement and a preferences panel for the user.
wrCisco is offline   Reply With Quote
Old 08-14-2020, 02:53 PM   #5
David Kudler
Enthusiast
David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'David Kudler knows the difference between 'who' and 'whom'
 
David Kudler's Avatar
 
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!
David Kudler is offline   Reply With Quote
Advert
Old 08-22-2020, 01:15 PM   #6
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 38
Karma: 467802
Join Date: Apr 2016
Device: none
Quote:
Originally Posted by David Kudler View Post
Ah! Nice. I too have either resorted to sloppy Regex or Calibre to take care of this. Thanks!
I'm glad it helps.


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).
wrCisco is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 11:43 AM.


MobileRead.com is a privately owned, operated and funded community.