mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
c7439742e3
commit
f193a3aac3
@ -93,10 +93,15 @@ class TOC(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def as_dict(self):
|
def as_dict(self):
|
||||||
return {
|
ans = {
|
||||||
'title':self.title, 'dest':self.dest, 'frag':self.frag, 'dest_exists':self.dest_exists, 'dest_error':self.dest_error,
|
'title':self.title, 'dest':self.dest, 'frag':self.frag,
|
||||||
'children':[c.as_dict for c in self.children]
|
'children':[c.as_dict for c in self.children]
|
||||||
}
|
}
|
||||||
|
if self.dest_exists is not None:
|
||||||
|
ans['dest_exists'] = self.dest_exists
|
||||||
|
if self.dest_error is not None:
|
||||||
|
ans['dest_error'] = self.dest_error
|
||||||
|
return ans
|
||||||
|
|
||||||
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