Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-23-2015, 05:59 AM   #1
1v4n0
Groupie
1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.
 
Posts: 171
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>
, recently I thought that it might be cleaner (and easier with top and bottom margin) to switch to

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>
Possibly with some minor changes to the css as well.

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
Attached Files
File Type: epub untitled - Sconosciuto.epub (3.6 KB, 237 views)
File Type: epub Carlo Mazzantini - A cercar la bella morte.epub (305.4 KB, 302 views)
1v4n0 is offline   Reply With Quote
Old 01-23-2015, 03:25 PM   #2
pssquirrel
ebooknut
pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.pssquirrel ought to be getting tired of karma fortunes by now.
 
pssquirrel's Avatar
 
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
Quote:
Originally Posted by 1v4n0 View Post
...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?
I don't have any insight into your main question, but re: generic Calibre classes:

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.
pssquirrel is offline   Reply With Quote
Old 01-23-2015, 08:07 PM   #3
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: 43,835
Karma: 22666666
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.
kovidgoyal is offline   Reply With Quote
Old 01-25-2015, 07:04 AM   #4
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Quote:
Originally Posted by 1v4n0 View Post
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)
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.
Agama is offline   Reply With Quote
Old 01-25-2015, 11:48 AM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
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...
eschwartz is offline   Reply With Quote
Old 01-26-2015, 02:54 PM   #6
1v4n0
Groupie
1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.
 
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
turn off the option to "Remove fake margins" under structure detection in the conversion dialog.
Whoa, a reply from The Man Himself. No wonder it's correct

Fixed, ty
1v4n0 is offline   Reply With Quote
Old 01-29-2015, 12:57 PM   #7
1v4n0
Groupie
1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.
 
Posts: 171
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">
, but calibre decided that from the second span on the class had to be "number1", and the font-size had to be smaller.

I easily fixed it from the stylesheet, but I don't undestand why it happened.
1v4n0 is offline   Reply With Quote
Reply

Tags
calibre, classes, css

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 09:20 AM.


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