示例#1
0
文件: opf.py 项目: gabalese/lepub
 def __init__(self, opf_tree):
     self.__tree = xpath(opf_tree, './/dc:identifier')
     self.__items = [
         item.text for item in self.__tree
     ]
示例#2
0
文件: opf.py 项目: gabalese/lepub
 def __init__(self, opf_tree):
     self.__tree = xpath(opf_tree, './/opf:manifest')
     self.__items = [
         ManifestItem(item) for item in self.__tree.getchildren()
         if item.tag is not etree.Comment
         ]
示例#3
0
文件: opf.py 项目: gabalese/lepub
 def __init__(self, opf_tree):
     self.__tree = xpath(opf_tree, './/opf:guide')
     self.__items = [
         Reference(item) for item in self.__tree
         ]
示例#4
0
文件: opf.py 项目: gabalese/lepub
 def get_opf_path(self):
     with self._file.open('META-INF/container.xml') as container_file:
         container_root = etree.fromstring(container_file.read())
     opf_path = xpath(container_root, './/container:rootfile/@full-path')
     return opf_path
示例#5
0
文件: opf.py 项目: gabalese/lepub
 def __init__(self, opf_tree, manifest):
     self.__tree = xpath(opf_tree, './/opf:spine')
     self.__manifest = manifest
示例#6
0
文件: toc.py 项目: gabalese/lepub
 def __init__(self, toc_tree):
     self.__tree = xpath(toc_tree, './/ncx:navMap')
     self.__items = [
         TOCItem(item) for item in self.__tree.getchildren()
     ]
示例#7
0
文件: toc.py 项目: gabalese/lepub
 def __init__(self, item):
     self.__item = item
     self.order = int(self.__item.get('playOrder'))
     self.label = xpath(self.__item, './/ncx:navLabel/ncx:text/text()')
     self.src = xpath(self.__item, './/ncx:content/@src')
示例#8
0
 def __get_metadata_attribute(self, quantifier, *attributes):
     return quantifier(
         *[xpath(tree=self.__tree, expression=attribute, quantifier=quantifier)
           for attribute in attributes]
     )
示例#9
0
 def __init__(self, opf_tree):
     self.__unique_identifier_id = opf_tree.get('unique-identifier')
     self.__tree = xpath(opf_tree, './/opf:metadata')