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 12-18-2020, 02:30 PM   #1
jiembe
Zealot
jiembe began at the beginning.
 
Posts: 145
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
Crazy style sheet

I just stumble on an ePub with 16915 coding line in the style sheet for 12240 lines of text (after erasing a lot of font-face{, empty lines and commentary notes). Ever top that?

That give text like :
Quote:
<p class="Style1141"><span class="FontStyle1"><span class="calibre21"><span class="title">—</span></span></span><span class="FontStyle1"><span class="calibre18">
and the Style number change every line or so!

I don't know if I have the courage to finish correcting that ePub.
jiembe is offline   Reply With Quote
Old 12-18-2020, 07:03 PM   #2
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Hi

There are two kinds of books, the ones with a simple structure (which may have a complicated code) and the others.

If your book belongs to the first category, for terminal cases like this one, I use a Sigil plugin named HTMLgen which saves the book to html format and, doing so, drastically simplifies the styles. Calibre has probably the equivalent but I do not have the practice.

I import the end result in LibreOffice (odt) and, after formatting publishes as an ePub. It's much quicker than it seems and provides you at the end with a clean code.

Last edited by roger64; 12-18-2020 at 09:39 PM. Reason: saves
roger64 is offline   Reply With Quote
Advert
Old 12-18-2020, 07:10 PM   #3
retiredbiker
Evangelist
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 450
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
I've seen books like that, with a gazillion "fontsylexxx" spans and/or a separate style name for every single paragraph. I think about 15,000 css lines was the biggest I've personally seen. I'd love to know what tools make these horrors.

I have saved searches to clean these up. I look for spans that do italics, and replace them all with simple <i>...</i> pairs. Then I blow away all spans and all styles and start over, basically.
retiredbiker is offline   Reply With Quote
Old 12-19-2020, 05:57 AM   #4
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: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
One thing to try is to convert the ePub > ePub in Calibre and see how the code ends up. You might be able to easily edit the code from there.

Another thing to try is to remove unused CSS and use the new feature "Merge CSS rules with identical properties" in case there are a lot of CSS styles the same with different names. But you need to be using the current Calibre 5 for this to work.

And finally, if the format of the eBook is not complex, just drop the styles and make your own.
JSWolf is offline   Reply With Quote
Old 12-19-2020, 10:18 AM   #5
jiembe
Zealot
jiembe began at the beginning.
 
Posts: 145
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
Quote:
Originally Posted by retiredbiker View Post
I've seen books like that, with a gazillion "fontsylexxx" spans and/or a separate style name for every single paragraph. I think about 15,000 css lines was the biggest I've personally seen. I'd love to know what tools make these horrors.
Well in this case :
<meta name="Generator" content="Microsoft Word 14"/>
meta name="Originator" content="Microsoft Word 14"/>

I correct all and finish with 9064 lines in html files and 158 lines in the stylesheet.
____________________
(Adding)

I got a new one, this time the fellow use tag names where the the longest is 111 characters! Well, at least it is descriptive!

Last edited by jiembe; 12-19-2020 at 11:37 AM.
jiembe is offline   Reply With Quote
Advert
Old 12-19-2020, 06:18 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: 79,745
Karma: 145864619
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 jiembe View Post
Well in this case :
<meta name="Generator" content="Microsoft Word 14"/>
meta name="Originator" content="Microsoft Word 14"/>

I correct all and finish with 9064 lines in html files and 158 lines in the stylesheet.
____________________
(Adding)

I got a new one, this time the fellow use tag names where the the longest is 111 characters! Well, at least it is descriptive!
I want to know how this person did this in Word? I've never seen anything like this before.

Would you please post the original CSS in a code block? Thanks.
JSWolf is offline   Reply With Quote
Old 12-19-2020, 09:30 PM   #7
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
Quote:
Originally Posted by JSWolf View Post
I want to know how this person did this in Word? I've never seen anything like this before.
I was thinking that maybe the original author's text was in Word, but loaded into an ePub maker that created that nightmare CSS, and then it was loaded into Calibre

Or maybe Word to Calibre to some ePub maker???
phossler is offline   Reply With Quote
Old 12-20-2020, 07:36 AM   #8
jiembe
Zealot
jiembe began at the beginning.
 
Posts: 145
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
Quote:
Originally Posted by JSWolf View Post
I want to know how this person did this in Word? I've never seen anything like this before.

Would you please post the original CSS in a code block? Thanks.
Here it is.

Other topic :

I see more and more using <div> instead of <p> or even <span>. Why ?
Attached Files
File Type: txt long_stylesheet.css.txt (363.6 KB, 207 views)

Last edited by jiembe; 12-20-2020 at 07:54 AM.
jiembe is offline   Reply With Quote
Old 12-20-2020, 10:29 AM   #9
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 195
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
I've never seen anything like this before.
I was once assigned by a long-suffering employer to evaluate a browser-based application from SAP, the German software giant. Altho the app was essentially only one screen, the CSS file was over 500k. (!) Given that I was the visual designer and code lord and master of a suite of 6 multi-screen apps, all using a common stylesheet less than 6k, I was skeptical the damn thing would even run on a typical client machine.

It did. The code was parsed, somehow, without smoke coming out of the CPU. I was very disappointed.

That is the wonder of modern computers—even shit code can run fine.

Last edited by Brett Merkey; 12-20-2020 at 10:40 AM. Reason: effete aesthetic requirements
Brett Merkey is offline   Reply With Quote
Old 12-20-2020, 06:03 PM   #10
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by jiembe View Post
I just stumble on an ePub with 16915 coding line in the style sheet for 12240 lines of text (after erasing a lot of font-face{, empty lines and commentary notes). Ever top that?.
About HTMLgen

If possible, can you send me the ePub in a PM? I'll return back the html file, the odt file, and the new ePub with some comments. It's a few minutes process, mostly automatic.

As the CSS file is a little verbose (...), I would begin with pruning unused styles using either Sigil or the Calibre editor.

Last edited by roger64; 12-20-2020 at 06:45 PM.
roger64 is offline   Reply With Quote
Old 12-20-2020, 07:48 PM   #11
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: 79,745
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
@jiembe can you please install the ScrambeEbook plugin for Calibre and use it to scramble this eBook? Once scrambles you can attach it and I can take a look at how much of a hassle it would be to fix it. Thanks.
JSWolf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Style Sheet entry for a 'hanging' style AThirstyMind Kindle Formats 6 12-10-2016 12:28 AM
How do I repace a Style Sheet? phossler Editor 13 12-24-2013 11:43 AM
Print style sheet ronaldl Sigil 2 10-29-2012 04:32 PM
Style Sheet editor? GraciousMe Sigil 6 06-04-2012 03:06 PM
Missing style sheet mauvais Barnes & Noble NOOK 3 12-05-2011 06:29 PM


All times are GMT -4. The time now is 06:04 AM.


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