09-28-2024, 09:40 AM | #1 |
Evangelist
Posts: 419
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Remove undefined classes from html?
The editor has a function to remove unused CSS rules. Is there a function to remove undefined classes from the html files? If not, is there a reason such a function would not be a good idea?
|
09-28-2024, 10:31 AM | #2 |
Well trained by Cats
Posts: 30,432
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Not auto-magic, but Diaps toolbag can do 1 (case definition) at a time.
It also can remove or modify 'naked' tags. Now for your other Q. Should you Maybe. My device mishandles some things (or I just hate the effect). I can just comment out the offending CSS without destroying the original intent. That leaves a simple recovery path. If I nuke the class code. It is just GONE. |
Advert | |
|
09-28-2024, 11:08 AM | #3 | |
Evangelist
Posts: 419
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
If it's just an undefined class there doesn't seem much risk. Emptying or removing a CSS class, then removing that class from the html is higher risk, but if there's no apparent visual effect the risk seems rather low. |
|
09-28-2024, 02:33 PM | #4 |
Bibliophagist
Posts: 40,267
Karma: 156981944
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Personally, I've been using Sigil with the cssUndefinedClasses plugin for that task. I do switch between Sigil and calibre's ebook-editor when editing since both have tools that make some tasks easier.
|
09-28-2024, 03:33 PM | #5 | |
Evangelist
Posts: 419
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
|
Quote:
|
|
Advert | |
|
09-28-2024, 03:50 PM | #6 | |
Resident Curmudgeon
Posts: 76,259
Karma: 136006010
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
You can use Diaps Editing Toolbag to remove empty <div> and <span>. |
|
09-28-2024, 10:59 PM | #7 |
creator of calibre
Posts: 44,469
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The remove unused CSS tool already has an option to remove unused class attributes.
|
09-29-2024, 08:44 AM | #8 |
Resident Curmudgeon
Posts: 76,259
Karma: 136006010
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Quick way to remove all class invokations for missing classes? | Vanguard3000 | Sigil | 8 | 10-12-2023 01:22 PM |
Removal of undefined classes from text | mcdummy | Editor | 16 | 07-08-2020 07:45 AM |
HTML to EPUB, how to keep classes? | MistaPrime | Conversion | 27 | 07-30-2019 10:33 AM |
Pseudo classes to be deleted as unused classes | Leonatus | Sigil | 2 | 09-23-2018 09:12 AM |
Is there way to list undefined classes? | phossler | Editor | 10 | 07-29-2018 09:33 PM |