Fix #611: latex writer raised IndexError on pages with no section but a link target.

This commit is contained in:
Georg Brandl 2011-09-21 10:37:48 +02:00
parent 1f59194ee3
commit a4b8b81712

View File

@ -1048,8 +1048,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
next = node.parent[parindex+1]
except IndexError:
# last node in parent, look at next after parent
# (for section of equal level)
next = node.parent.parent[node.parent.parent.index(node.parent)]
# (for section of equal level) if it exists
if node.parent.parent is not None:
next = node.parent.parent[
node.parent.parent.index(node.parent)]
else:
raise
if isinstance(next, nodes.section):
if node.get('refid'):
self.next_section_ids.add(node['refid'])