![]() |
#1 | |
Zealot
![]() 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:
I don't know if I have the courage to finish correcting that ePub. |
|
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#5 | |
Zealot
![]() Posts: 145
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
|
Quote:
<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. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
Would you please post the original CSS in a code block? Thanks. |
|
![]() |
![]() |
![]() |
#7 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
Or maybe Word to Calibre to some ePub maker??? |
|
![]() |
![]() |
![]() |
#8 | |
Zealot
![]() Posts: 145
Karma: 10
Join Date: Sep 2016
Location: Montréal Québec
Device: Kobo Glo; Kobo Libra
|
Quote:
Other topic : I see more and more using <div> instead of <p> or even <span>. Why ? Last edited by jiembe; 12-20-2020 at 07:54 AM. |
|
![]() |
![]() |
![]() |
#9 | |
Not Quite Dead
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 195
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
Quote:
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 |
|
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#11 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |