mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-01 06:14:50 +02:00
...
This commit is contained in:
parent
89a6733a92
commit
3e718aa4d6
1 changed files with 10 additions and 0 deletions
|
|
@ -57,6 +57,16 @@ def depth(self):
|
|||
except ValueError:
|
||||
return 1
|
||||
|
||||
def get_lines(self, lvl=0):
|
||||
frag = ('#'+self.frag) if self.frag else ''
|
||||
ans = [(u'\t'*lvl) + u'TOC: %s --> %s%s'%(self.title, self.dest, frag)]
|
||||
for child in self:
|
||||
ans.extend(child.get_lines(lvl+1))
|
||||
return ans
|
||||
|
||||
def __str__(self):
|
||||
return b'\n'.join([x.encode('utf-8') for x in self.get_lines()])
|
||||
|
||||
def child_xpath(tag, name):
|
||||
return tag.xpath('./*[calibre:lower-case(local-name()) = "%s"]'%name)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue