mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
25ef6ef13a
commit
4b7d303560
@ -224,6 +224,8 @@ class TBS(object): # {{{
|
|||||||
|
|
||||||
if depth_map[0]:
|
if depth_map[0]:
|
||||||
# We have a terminal record
|
# We have a terminal record
|
||||||
|
|
||||||
|
# Find the first non periodical node
|
||||||
first_node = None
|
first_node = None
|
||||||
for nodes in (depth_map[1], depth_map[2]):
|
for nodes in (depth_map[1], depth_map[2]):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
@ -232,10 +234,17 @@ class TBS(object): # {{{
|
|||||||
first_node = node
|
first_node = node
|
||||||
|
|
||||||
typ = (self.type_110 if has_section_start else self.type_010)
|
typ = (self.type_110 if has_section_start else self.type_010)
|
||||||
|
|
||||||
|
# parent_section_index is needed for the last record
|
||||||
if first_node is not None and first_node.depth > 0:
|
if first_node is not None and first_node.depth > 0:
|
||||||
parent_section_index = (first_node.index if first_node.depth
|
parent_section_index = (first_node.index if first_node.depth
|
||||||
== 1 else first_node.parent_index)
|
== 1 else first_node.parent_index)
|
||||||
|
else:
|
||||||
|
parent_section_index = max(self.section_map.iterkeys())
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# Non terminal record
|
||||||
|
|
||||||
if spanner is not None:
|
if spanner is not None:
|
||||||
# record is spanned by a single article
|
# record is spanned by a single article
|
||||||
parent_section_index = spanner.parent_index
|
parent_section_index = spanner.parent_index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user