View Single Post
Old 09-28-2008, 01:48 PM   #6
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: 45,160
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Steve Jordan View Post
My ePub creation has been a strictly manual process so far. I'm working in WinXP, have WinZip 8, and use Dreamweaver for any HTML editing.

I used the Jedisaber ePub files as a beginning template. I start by manually copying and pasting existing (and working) ePub files into a new folder, and editing as needed (titles, dates, chapter names, etc). Then I manually add each chapter as an HTML file, and images as JPG files. I use the same filetype descriptions that were in the original (working) ePub files.

The Book Glutton files use a slightly different formatting than the Jedisaber template, but both of their files open in DE, and after converting to .zip and back to .epub, will no longer open.

I haven't upgraded WinZip yet, but it is the only other obvious thing I can try. Still, I don't see how simply changing the extension could cause this problem.
Wow that's a lot of work. Since you already have your chapters as HTML files, create a simple cover HTML file (one that has a table of contents) that looks like this:

Code:
.
.
.
<h2>Table of contents</h2>
<a href="chapter1.htm">Title of chapter 1</a>
.
.
.
In the top part of the file you can have title, dedication etc. The important thing is that it should have links to all the chapter files, in the order that you want them.

Now make sure that in all your chapter files, you mark the tags that have the chapter titles with class="chapter_title", so for e.g. in a chapter file

Code:
.
.
.
<h2 class="chapter_title">Chapter title</h2>
.
.
.
You can choose any class you want, instead of chapter_title, so long as it unique to chapter titles.

Then just run html2epub (part of calibre) on the table of contents file (lets call it index.html)

Code:
html2epub --chapter '//*[@class = "chapter_title"]' index.html -o mybook.epub --title booktitle --author "Steve Jordan"
And voila! You have a nice EPUB file called mybook.epub that automatically has all your chapter files, your images, stylesheets etc included.

If you dont want the table of contents to be displayed in the final epub, you can enclose it like so:

Code:
<div style="display:none">
<h2>Table of contents</h2>
<a href="chapter1.htm">Title of chapter 1</a>
</div>
kovidgoyal is offline   Reply With Quote