mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
...
This commit is contained in:
parent
89a6733a92
commit
3e718aa4d6
@ -57,6 +57,16 @@ class TOC(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
return 1
|
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):
|
def child_xpath(tag, name):
|
||||||
return tag.xpath('./*[calibre:lower-case(local-name()) = "%s"]'%name)
|
return tag.xpath('./*[calibre:lower-case(local-name()) = "%s"]'%name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user