View Single Post
Old 02-22-2009, 12:50 AM   #1
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
html2epub TOC and chapter detection help

I have some questions regarding html2epub's chapter detection and TOC generation.

I'm testing an HTML file with a level depth of 2.
Code:
<html>
<head>
<title>Omnibus Collection</title>
</head>
<body>

	<div class='header1'>Omnibus Collection</div>
	<hr />

	<div class='booklist'>
		<a href='#book1'>Book One</a><br />
		<a href='#book2'>Book Two</a><br />
	</div>

	<div class='book'>
		<a name='book1' />
		<div class='booktitle'>Book One</div><hr />
		<div class='introduction'>
			<p>The first book in the series.</p>
		</div>
		<div class='chapter'>
			<div class='chaptertitle'>1. Chapter One</div>
			<div class='chaptercontent'>
			        <p>This is a truly fascinating chapter.</p>
			</div>
		</div>
		<div class='chapter'>
			<div class='chaptertitle'>2. Chapter Two</div>
			<div class='chaptercontent'>
			        <p>A worthy continuation of a fine tradition.</p>
			</div>
		</div>
	</div>

	<div class='book'>
		<a name='book2' />
		<div class='booktitle'>Book Two</div><hr />
		<div class='introduction'>
			<p>The second book in the series.</p>
		</div>
		<div class='chapter'>
			<div class='chaptertitle'>1. Chapter One</div>
			<div class='chaptercontent'>
			        <p>This is a truly fascinating chapter.</p>
			</div>
		</div>
		<div class='chapter'>
			<div class='chaptertitle'>2. Chapter Two</div>
			<div class='chaptercontent'>
			        <p>A worthy continuation of a fine tradition.</p>
			</div>
		</div>
	</div>

</body>
</html>
Level 1 TOC: //*[@class = 'booktitle']
Level 2 TOC: //*[@class = 'chaptertitle']

The generated TOC looks like:

Book One
1. Chapter One
2. Chapter Two
Book Two
1. Chapter One
2. Chapter Two
which is the desired outcome. My problem is it doesn't insert a pagebreak or rule before the book entry. It does, however, insert both before the chapter entry. Help please?

Also, what's the command-line syntax for the above? I'm just using the GUI for testing right now but will be using the command-line utility for an automated script once I get the chapter detection working the way I want.

Thanks!
ilovejedd is offline   Reply With Quote