Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 09-28-2024, 09:40 AM   #1
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 416
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?
foosion is offline   Reply With Quote
Old 09-28-2024, 10:31 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,426
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.
theducks is online now   Reply With Quote
Advert
Old 09-28-2024, 11:08 AM   #3
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 416
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Quote:
Originally Posted by theducks View Post
Not auto-magic, but Diaps toolbag can do 1 (case definition) at a time.
It also can remove or modify 'naked' tags.
Search/replace with regex also works.

Quote:
Originally Posted by theducks View Post
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.
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.
foosion is offline   Reply With Quote
Old 09-28-2024, 02:33 PM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,066
Karma: 154919858
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.
DNSB is online now   Reply With Quote
Old 09-28-2024, 03:33 PM   #5
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 416
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Quote:
Originally Posted by DNSB View Post
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.
That works.

foosion is offline   Reply With Quote
Advert
Old 09-28-2024, 03:50 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,163
Karma: 134458692
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by foosion View Post
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?
If there are classes in the HTML that are not used, they will be removed. If they belong to a <div> or <span> the <div> and/or <span> will be left empty. I cannot see the reason for the empty <span> but you may want to keep the empty <div> if it surrounds an <img>.

You can use Diaps Editing Toolbag to remove empty <div> and <span>.
JSWolf is offline   Reply With Quote
Old 09-28-2024, 10:59 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,440
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.
kovidgoyal is offline   Reply With Quote
Old 09-29-2024, 08:44 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,163
Karma: 134458692
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by kovidgoyal View Post
The remove unused CSS tool already has an option to remove unused class attributes.
Can the remove unused CSS have options to remove empty <div> and empty <span> as well when it removes classes from them? Thanks.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:33 PM.


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