Mobi debug: Write the kind field from NCX entries as well

This commit is contained in:
Kovid Goyal 2012-05-21 13:32:16 +05:30
parent eff927bbc4
commit 8283515d51
2 changed files with 3 additions and 3 deletions

View File

@ -159,7 +159,7 @@ class NCXIndex(Index):
if self.table is not None: if self.table is not None:
NCXEntry = namedtuple('NCXEntry', 'index start length depth parent ' NCXEntry = namedtuple('NCXEntry', 'index start length depth parent '
'first_child last_child title pos_fid') 'first_child last_child title pos_fid kind')
for num, x in enumerate(self.table.iteritems()): for num, x in enumerate(self.table.iteritems()):
text, tag_map = x text, tag_map = x
@ -192,7 +192,7 @@ class NCXIndex(Index):
length=e['len'], depth=e['hlvl'], parent=refindx(e, length=e['len'], depth=e['hlvl'], parent=refindx(e,
'parent'), first_child=refindx(e, 'child1'), 'parent'), first_child=refindx(e, 'child1'),
last_child=refindx(e, 'childn'), title=e['text'], last_child=refindx(e, 'childn'), title=e['text'],
pos_fid=e['pos_fid']) pos_fid=e['pos_fid'], kind=e['kind'])
self.records.append(entry) self.records.append(entry)

View File

@ -193,7 +193,7 @@ class MOBIFile(object):
entry_map = [] entry_map = []
for index in self.ncx_index: for index in self.ncx_index:
vals = list(index)[:-1] + [None, None, None, None] vals = list(index)[:-1] + [None, None, None, None]
entry_map.append(Entry(*vals)) entry_map.append(Entry(*(vals[:12])))
indexing_data = collect_indexing_data(entry_map, list(map(len, indexing_data = collect_indexing_data(entry_map, list(map(len,