![]() |
#1 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2012
Device: kindle
|
XML Coding to Create Kindle book with Calibre
Hi,
for some time I have been trying to work out how to export an existing book, which has been published as a paper book, out of InDesign CS4 and into Kindle format. There is a beta 'Kindle Export' plugin for InDesign, but I found its output was flawed. In my book at least, there are various annoying things like missing italics, etc. My next move was to open the .mobi files it made in Calibre, and to 'inspect' at problematic points to see the xml. It looked like a mess ... there were loads of redundant font and css tags. Next I tried using Indesign's built in 'Export to Digital Editions' which produces an epub file. There were also similar problems with that. So, I have resigned myself to having to do some manual editing of the xml. I have exported the file from Calibre as HTMLZ, unzipped it and have it open in Dreamweaver. This is very useful for me as an ex-coder, as I can now see it is an unscary normal html file, which gives me hope that I will be able to iron out the teething problems. However, there is a big problem: Calibre seems to have created thousands of redundant CSS tags. Almost every sentence has a new one, <div class="calibre4">, <p class="calibre27">, and so on... My idea is that, if I could just get rid of all of these and make a simple file with simple html tags <p> <h1><h2> etc., then when it was converted back to a .mobi file it would work nicely... Does anyone have any idea how to stop Calibre from creating all these tags, or why it does so? Or a quick way to strip them all out? Alternatively, has anyone succeeded in exporting from InDesign successfully to epub or mobi ? I would appreciate advice from anyone who has done so. and finally, there seems to be no straightforward guide to which standard tags you should use within a file destined for the Kindle (for the table of contents, headings, etc.). Is there one anywhere? thanks, Robin |
![]() |
![]() |
![]() |
#2 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383099
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
I would suggest that you export to ePub, edit your ePib file using Sigil and convert to Mobi when the ePub version is right.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2012
Device: kindle
|
unfortunately I have downloaded Sigil and it crashes when I try to start it up! Will try again though, thanks
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2012
Device: kindle
|
yeah, I have Mac os X 10.5.8, and Sigil only works on 10.6 or higher. Is it really that much more useful?
|
![]() |
![]() |
![]() |
#5 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383099
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
It's an ePub editor. You can of course edit your ePub files in other ways, but Sigil is a pretty damned good tool.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,364
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
It really doesn't matter how many tags are assigned css classes (even if it's every single one) in the source that's going to be used for building a mobi. Because all the css gets converted to simple HTML 3.2 attributes in the mobi (all the attributes that are supported by mobi anyway).
Before you're convinced that it's necessary to strip all of those classes from your source epub, use mobiunpack.py to see what's inside a normal mobi... all the css classes and a css file would be far prettier than what's actually in there, I promise you. ![]() |
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2012
Device: kindle
|
ok thanks, looks like it's time to upgrade my OS and give Sigil a try.
Nevertheless, it will be difficult to do any editing on this file with so many tags everywhere. I think this is what causes the problems with the italics, where there are hundreds of overlapping tags... The file formats seem quite confusing... I am also about to get Indesign CS5 which supposedly does a better job of exporting epubs than which CS4 I have at the moment. We'll see ... Last edited by UrbanR; 01-09-2012 at 06:52 PM. |
![]() |
![]() |
![]() |
#8 |
Member
![]() Posts: 10
Karma: 10
Join Date: Dec 2009
Device: none
|
I use this guide for creating my ebooks using "normal" html tags.
hope this helps. Edit** The only issue I have with his supplied header file is that I have an extra large margin on the left side in my kindle. It isn't actually that large, but it's wider than the right margin. I'm not sure what coding I'm doing wrong to create that. Last edited by halfgone; 01-11-2012 at 01:57 PM. Reason: additional info |
![]() |
![]() |
![]() |
#9 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jan 2012
Device: kindle
|
many thanks for that halfgone. I read the first page of the article and I absolutely agree with the approach! As both a book publisher and a coder, I'm not happy with not knowing exactly what is going on in the formatting tags...!
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simplest Way to Create a Kindle Book from Scratch? | knitterlauri | Workshop | 2 | 12-30-2011 01:59 PM |
Using Calibre to create Kindle format Tag for Go To Beginning | cjallan | Kindle Developer's Corner | 0 | 08-31-2011 10:38 PM |
Converting DocBook XML source book with calibre! | baccilus | Calibre | 1 | 12-04-2010 12:32 AM |
Creating XML book listing with Calibre | JTAL604622 | Library Management | 5 | 06-01-2010 02:57 PM |
Media.XML and how to create one from pc | Student1 | Sony Reader Dev Corner | 4 | 05-06-2009 07:39 PM |