Sorry, I was imprecise. When I said that Calibre generates an empty TOC, I meant that it generates a TOC with just one entry, for the entire document. Here's a shell script to remove the offending TOC entry; however, it's a horrible hack, and what I'm really after is a way to avoid generating it in the first place:
#!/bin/sh
# remove-epub-toc
# Remove the TOC from an EPUB
# (Designed to work with Calibre-generated EPUBs with a single section; see FIXMEs for generalization)
# Reuben Thomas 27th November 2012
# Shell function from atool(1)
aunpack () {
TMP=`mktemp /tmp/aunpack.XXXXXXXXXX`
atool -x --save-outdir=$TMP "$@"
DIR="`cat $TMP`"
[ "$DIR" != "" -a -d "$DIR" ] && cd "$DIR"
rm $TMP
}
book=$1
shift
# FIXME: edit the XML properly rather than grepping
# FIXME: ensure identifiers are correct, computed if necessarily
aunpack -F zip "$book"
rm *_split_000.html
sed -i -e 's/split_000/split_001/' toc.ncx
grep -v html2 content.opf > content.opf.new
mv content.opf.new content.opf
apack -F zip "$book" .
mv "$book" ..
cd ..
rm -rf "$DIR"
|