![]() |
#1 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 173
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Calibre conversion adding classes and screwing the layout?
One small bug I've noticed.
Lately, in the epubs, I've started to wrap differently formatted paragraphs inside divs, instead of giving a class to each <p>. So if until some time ago I'd simply go with something like Code:
<p> bla bla bla goes like this:</p> <p class="quotations">This is how the world ends </p> <p class="quotations">Not with a bang, but with a whimper</p> <p> cool, innit?</p> Code:
<p> bla bla bla goes like this:</p> <div class="quotations"> <p>This is how the world ends </p> <p>Not with a bang, but with a whimper</p> </div> <p> cool, innit?</p> I noticed, however, that sometimes the conversion to azw3 with calibre screws this layout. As you might know, Calibre add its own classes, named "calibre" followed by a number. I don't like this (oh and btw, any idea on how to quickly get rid of them? Besides removing them with a regex and c/p the original css from the epub), but I don't know if this is the reason. Anyway this does not happen all the time. I tried with a small file and it works fine, but if I convert the whole book it doesn't. I attach the 2 epub files. Any ideas? Ty ![]() |
![]() |
![]() |
![]() |
#2 | |
ebooknut
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
Quote:
Calibre seems to create a class for every element. I have found that if the element already has a class named, Calibre will respect that name and use it. But if there is no class named, Calibre will create one and call it Calibre1, Calibre2, etc. This happens with every element, including <body> <img> <i> <b> <br>, etc. If you want to avoid generic Calibre classes, add a class to every element: <body class="ebook"> <img class="picture">, <i class="italic">, <b class="bold">, etc. Last edited by pssquirrel; 02-16-2015 at 10:53 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,029
Karma: 27109760
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre *flattens* all css, that means that every CSS rule in the source document (including implicit rules) are converted to class based rules. This is done for excellent reasons, that I have explained many times before, a bit of googling should find you the explanation.
As for your issue, I dont have time to look at it right now, but from your description it sounds like you need to turn off the option to "Remove fake margins" under structure detection in the conversion dialog. |
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
My solution for this is a plugin, (a really great calibre feature), which uses a set of customisable regexes and some other custom tidy-up processing. However I am working with Markdown sources, (with my own class extensions), and so the ePub output is predictable. You may be able to do this if your output is also predictable. This fix is quick, practically instant on any ePub, once you have written your plugin.
|
![]() |
![]() |
![]() |
#5 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You can always use kindlegen...
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 173
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
|
![]() |
![]() |
![]() |
#7 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 173
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
I got a new one though: I used this solution for numbering the lines. The numbers were wrapper inside a
Code:
<span class="number"> I easily fixed it from the stylesheet, but I don't undestand why it happened. |
![]() |
![]() |
![]() |
Tags |
calibre, classes, css |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Automatic entity conversion screwing up search and replacerch and replace | ldolse | Sigil | 10 | 01-05-2012 01:46 AM |
txt to Epub - adding classes with textile | Nareshkendel | Conversion | 4 | 11-23-2011 05:30 PM |
Why, During ePub to ePub Conversion does Calibre changes existing CSS classes? | JSWolf | Conversion | 7 | 08-06-2011 07:32 PM |
Is there a way to prevent Calibre adding to the TOC upon conversion? | PatNY | Conversion | 21 | 03-17-2011 03:09 PM |
Calibre conversion without adding to library | Starganderfish | Calibre | 2 | 01-02-2011 04:31 AM |