Commits

Georg Brandl committed 75aa56e

#241: Fix a crash building LaTeX output for documents that contain
a todolist directive.

Comments (0)

Files changed (2)

 Release 0.6.3 (in development)
 ==============================
 
+* #241: Fix a crash building LaTeX output for documents that contain
+  a todolist directive.
+
 * #252: Make it easier to change the build dir in the Makefiles
   generated by quickstart.
 

sphinx/ext/todo.py

 
 from docutils import nodes
 
+from sphinx.environment import NoUri
 from sphinx.util.compat import Directive, make_admonition
 
 class todo_node(nodes.Admonition, nodes.Element): pass
             newnode = nodes.reference('', '')
             innernode = nodes.emphasis(_('here'), _('here'))
             newnode['refdocname'] = todo_info['docname']
-            newnode['refuri'] = app.builder.get_relative_uri(
-                fromdocname, todo_info['docname'])
-            newnode['refuri'] += '#' + todo_info['target']['refid']
+            try:
+                newnode['refuri'] = app.builder.get_relative_uri(
+                    fromdocname, todo_info['docname'])
+                newnode['refuri'] += '#' + todo_info['target']['refid']
+            except NoUri:
+                # ignore if no URI can be determined, e.g. for LaTeX output
+                pass
             newnode.append(innernode)
             para += newnode
             para += nodes.Text('.)', '.)')