Give line number info where possible in toctree-related warnings.

This commit is contained in:
Georg Brandl 2011-01-07 14:22:27 +01:00
parent 9d4f8c4a16
commit 33647ec898

View File

@ -1240,11 +1240,12 @@ class BuildEnvironment:
self.warn(docname, self.warn(docname,
'toctree contains reference to document ' 'toctree contains reference to document '
'%r that doesn\'t have a title: no link ' '%r that doesn\'t have a title: no link '
'will be generated' % ref) 'will be generated' % ref, toctreenode.line)
except KeyError: except KeyError:
# this is raised if the included file does not exist # this is raised if the included file does not exist
self.warn(docname, 'toctree contains reference to ' self.warn(docname, 'toctree contains reference to '
'nonexisting document %r' % ref) 'nonexisting document %r' % ref,
toctreenode.line)
else: else:
# if titles_only is given, only keep the main title and # if titles_only is given, only keep the main title and
# sub-toctrees # sub-toctrees