+ def html_part(self, depth=0):
+ texts = []
+ for child in self.children:
+ texts.append(
+ "<div style='margin-left:%dem;'><a href='%s'>%s</a></div>" %
+ (depth, child.href(), child.name))
+ texts.append(child.html_part(depth+1))
+ return "\n".join(texts)
+
+ def html(self):
+ with open(get_resource('epub/toc.html')) as f:
+ t = unicode(f.read(), 'utf-8')
+ return t % self.html_part()
+