View Single Post
Old 04-06-2023, 03:55 AM   #15
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by akita328 View Post
Wow! this is goldmine of information! thank you!

will be bookmarking these and learn more.


Here's one more too:

You can always type stuff like this into your favorite search engines too:

Code:
cleanup CSS EPUB Tex2002ans site:mobileread.com
regular expressions Tex2002ans site:mobileread.com
That will lead you to any answers you need. (It's what I do whenever I need to dig up links to my old answers.)

I've written entire encyclopedias of tips/tricks/problems/anything-to-do with ebooks + ebook cleanup!

Quote:
Originally Posted by akita328 View Post
Not to worry. I have looked at all the classes, and verified what they are doing. many of them were duplicates... so I did a find/replace to consolidate several different labels into a single one.
That's exactly what KevinH's CSSToolbox was meant to accomplish!

It would let you:
  • Select a class
  • See all 100% exact (or very similar) CSS classes

then let you merge any "duplicates" into 1 class at the push of a button.

Instead of you manually doing multiple rounds of this, via Diap's TagMechanic + conversions + lots of elbow grease, it would cut down the cleanup work dramatically.

- - -

Side Note: KevinH's CSSToolbox isn't out yet, but will be in the near-future!

For now, you have to settle on rounds of Calibre EPUB->EPUB conversions with manual trash removal in the middle.

- - -

Right-Click Trick (to Rename Classes)

Another timesaving trick you can do in Sigil/Calibre is:
  • Right-Click on a class name in your HTML.

Now you can "Rename" that class to something more human-readable.

For example:

Code:
<p>This is a word in <span class="junk123">italics</span>.</p>
<p>Even <span class="junk123">more</span> in <span class="junk123">italics</span>.</p>
Right-Click on the class="" part of it, then you can
  • Change "junk123" -> "italics"

and it will auto-replace all others in the book too:

Code:
<p>This is a word in <span class="italics">italics</span>.</p>
<p>Even <span class="italics">more</span> in <span class="italics">italics</span>.</p>
Now, when you're doing your Diap rounds later, it makes it so much easier to see exactly what you marked as the code's intent. Then you could easily:

Code:
<p>This is a word in <i>italics</i>.</p>
<p>Even <i>more</i> in <i>italics</i>.</p>
- - -

Side Note #2: I manually did a lot of that Find/Replace stuff way back when... then the Right-Click trick was initially in Calibre, then Sigil added it recently.

Now it's so much faster than it used to be!

And that's pretty much how I initially came up with the concept for CSSToolbox...

Instead of manually flipping back-and-forth through the classes + CSS, then renaming the stuff...

I'll soon be able to yell at CSSToolbox:

"Hey! You know those dozen classes junk123, junk456, junk789... that are all effectively italics? How about you just find/rename those all for me in one shot?"

And:

"Hey! Help find my almost-twins! How about you merge/rename those for me too?"

Then it'll turn hundreds of Right-Click > Renames + lots of cross-eyed CSS compares into a few button presses too!

Last edited by Tex2002ans; 04-06-2023 at 05:05 AM.
Tex2002ans is offline   Reply With Quote