![]() |
#1 |
Member
![]() Posts: 12
Karma: 10
Join Date: Apr 2012
Device: iPad, Kindle, iPhone, Windows
|
Cluttered Calibre style code in EPUB
If I feed an RTF or a simple HTML to Calibre, it puts in overly many (in my opinion) styles with opaque names, and has oddly intricate knots of styles for things a simple as a <br /> tag, which becomes <br class="calibre107" /> or something.
I have learned to format my HTML with a nice CSS stylesheet and paste those styles into the Convert Books | Look and Feel | Extra CSS box, and then I don't get so many alien inscrutable Calibre styles. But there are still a lot more crud than I'd like I'm talking about something like <h1 class="flurbheader" id="calibre_pb_0"><strong class="calibre11">Section Title</strong><br class="calibre5" /> where all I need is <h1 class="flurbheader">Section Title</h1><br/> I guess the answer is maybe that I shouldn't care if the production HTML in my EPUB is clean or not... |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,231
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre flattens all CSS. That is the only way that automatic processing like font size rationalization and fake margin removal can work. It also greatly lowers the load on viewers reading calibre produced epubs. That is one of the reasons that doing an epub to epub conversion in calibre will often make a non working epub work. calibre is *not* an ebook authoring tool. If you care about the exact contents of your final epub, create it by hand.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 12
Karma: 10
Join Date: Apr 2012
Device: iPad, Kindle, iPhone, Windows
|
Thanks, Kovid, for answering. You are of course a God-like figure for us beginning epub makers! We thank you for your great work.
I'm not quite clear what it means to "flatten CSS" Does it simply mean to move the style definitions from an external CSS file into the HTML file itself? Or does it meant to replacve things like <strong><p class="bodytext"> Hello </p></strong? by something like <p class="strongbodytext">Hellow</p>? Anyway the big point from your remark is that, as I kind of knew but had stopped thinking about, you can author your EPUB without using Calibre. For instance, write an HTML you're happy with and add that into a new Sigil EPUB and you have an EPUB with the code you might prefer. And I learned a trick for having Sigil split the big HTML into small files so it's all good. This said, for a beginning EPUB maker, it works fine to just load the HTML or even the RTF into Calibre and let Calibre convert to EPUB and don't freak out over the kind of intricate styling statements that end up in the code. I know YOU know this, Kovid, but I'm just writing this down so I remember it and possibly to be of help to some other noob. One thing I found I really did need to use Calibre for was that I had a whole website with thirteen separate pages, and it was really easy just to load the index.html into Calibre and it dragged along all the other files and pumped out a usable EPUB, downloadble as issue #14 of my Flurb webzine. ---Rudy Rucker |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,231
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Flatten CSS means all the CSS is reduced to using only class definitions. This makes the CSS very easy to modify for automated programslike calibre. It also makes it easy to parse and apply for viewer programs.
|
![]() |
![]() |
![]() |
#5 | |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,893
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
Quote:
I believe calibre takes any non-CSS controlled entities floating around the html and creates classes in the css for them. Examples of non-CSS controlled entities floating around the html: <strong>, <br />, <em>, <bold>, <font size="3" color="red"> etc... to equivalent code controlled from the CSS. Good Reading. |
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Editing epub's style.css when converting to epub | Pros | Calibre | 0 | 02-02-2012 01:13 PM |
Getting rid of cluttered Archived shelf... | dkperez | Nook Color & Nook Tablet | 5 | 11-01-2011 11:13 AM |
Paragraph Style Not Exporting / ePub | soulartist | Workshop | 5 | 12-11-2010 12:02 AM |
Epub style question - TOC | luthar28 | ePub | 4 | 08-04-2010 07:19 PM |
Mobi TOC style vs ePub style? | phearlez | Kindle Formats | 3 | 04-11-2010 06:35 AM |