View Single Post
Old 09-17-2010, 08:34 PM   #5
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
Quote:
Originally Posted by slugs View Post
What epub creating tool do you use?
I'm actually one of those text editor/command-line people and a Mac user besides, so you might not find my usual toolset all that helpful.

But if you want to make a quickie NCX, just shove a few id="yourlinkhere" attributes into each and every <h1>, <div>, <p> or whatever other tag you want to have a link to, and then cut and paste the following to a new file, filling in the [] bits as appropriate.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<ncx version="2005-1" xmlns="http://www.daisy.org/z3986/2005/ncx">
<head>
<meta name="dtb:uid" content="[use same as unique-identifier="" from OPF]" />
<meta name="dtb:depth" content="1" />
<meta name="dtb:totalPageCount" content="0" />
<meta name="dtb:maxPageNumber" content="0" />
	</head>
<docTitle>
	<text>[Book Name]</text>
	</docTitle>
<docAuthor>
	<text>[Book Author]</text>
	</docAuthor>
<navMap>
<navPoint id="[yourlinkhere]" playOrder="[number in order]">
	<navLabel><text>[Chapter X Section Y]</text></navLabel>
	<content src="[name of file].html#[yourlinkhere]" />
	</navPoint>

	</navMap>
	</ncx>
You'll need to enter a navPoint for every chapter mark you want (I keep some snippets in Smultron, my usual text editor, which will let me select text and autofill in the blanks and position the cursor conveniently afterwards using a shortcut key).

If you've split into multiple files, you don't need to bother adding the id="" to the text or using the .html#yourlinkhere unless you want internal subsections or the like.

Just go directly to the files as src="chapter01.html" and everything will take care of itself. Kindlegen will even start fresh chapters on new pages instead of running the text on from the previous.

When you're done, add the following to the OPF if it doesn't already exist:

<item id="ncx" media-type="application/x-dtbncx+xml" href="toc.ncx" />

under the "manifest" element and

<spine toc="ncx">

You can call the "ncx" to anything you like, as long as you give the item id="" and toc="" the exact same name.

After that, you should be good to go once you've zipped up the ePub or converted straight to Mobi from the OPF, whichever you prefer.
ATDrake is offline   Reply With Quote