Quote:
Originally Posted by AlexBell
In fact my long term dream is to be able to design a template in XHTML 1.1/CSS and use this as the common base from which to convert the template into Mobipocket and ePub with Calibre.
|
I do believe several people here have made similar templates...
I have a question, though. If you'll only be using Calibre for conversion, why not modify both (X)HTML and command-line so they would mesh?
I have something very similar to the following for my template:
Code:
<html>
<head>
<title>Book Title</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body>
<div class="cover">
<h1 class="booktitle">Book Title</h1>
<h2 class="bookauthor">Author</h2>
<p>Summary and other information goes here.</p>
</div>
<div class="chapter">
<div class="chapterhead">
<h1 class="chaptertitle">Chapter One</h1>
</div>
<div class="chapterbody">
<p>The chapter content goes here.</p>
</div>
</div>
<div class="chapter">
<div class="chapterhead">
<h1 class="chaptertitle">Chapter Two</h1>
</div>
<div class="chapterbody">
<p>The chapter content goes here.</p>
</div>
</div>
</body>
</html>
Then, I just changed the command-line options to the following so it jives well with my source HTML:
Code:
html2epub --level1-toc "//*[@class='chaptertitle']|//*[@class='booktitle']" --chapter "//*[@class='chapter']" --chapter-mark "pagebreak"
Basically, I overrode all the default chapter detection expressions Calibre uses. It's fine for me since I have tight control on how the source is formatted. Note, I didn't even bother putting ID tags in the source HTML. With just the above command-line, Calibre is able to create a TOC that follows my requirements to a T. Yes, I still haven't upgraded my conversion (virtual) machine to the new version, but I rather think ebook-convert uses very similar commands.
From my
discussions with Kovid earlier, the TOC and chapter detection work independently of each other. I doubt that has changed.