Skip to content

Commit

Permalink
Fix ToC detection with an explicit ToC class
Browse files Browse the repository at this point in the history
  • Loading branch information
palfrey committed Apr 21, 2013
1 parent e27f946 commit e3d62a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common.py
Expand Up @@ -17,7 +17,7 @@ def hexdigest_md5(data):
def generatePage(page, title, content, folder, toc):
fname = unicode(hexdigest_md5(page) + ".html")
fpath = join(folder, fname)
toc.write(u"\t\t\t<a title=\"%s\" href=\"%s\" />\n" % (title, fname))
toc.write(u"\t\t\t<a class=\"toc_title\" href=\"%s\">%s</a>\n" % (fname, title))
if not exists(fpath) or getsize(fpath) < 500:
open(fpath, "wb", "utf-8").write(u"""<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
Expand Down Expand Up @@ -57,7 +57,7 @@ def tocEnd(toc):

def makeMobi(folder, author, newitems = False):
if newitems or not exists(folder + ".mobi"):
cmd = "rm -f book.zip && zip -j book.zip %s/* && ebook-convert book.zip \"%s.mobi\" --output-profile kindle --margin-top 0 --margin-bottom 0 --margin-left 0 --authors=\"%s\" --input-encoding=utf-8" %(folder.replace(" ", "\\ "), folder, author)
cmd = "rm -f book.zip && zip -j book.zip %s/* && ebook-convert book.zip \"%s.mobi\" --output-profile kindle --margin-top 0 --margin-bottom 0 --margin-left 0 --authors=\"%s\" --input-encoding=utf-8 --level1-toc '//*[@class='toc_title']' --no-chapters-in-toc --toc-threshold=1" %(folder.replace(" ", "\\ "), folder, author)
print cmd
system(cmd)

0 comments on commit e3d62a6

Please sign in to comment.