From 456abdefbe5167dfde70ecefd1b5ace09bb03ca9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 3 Sep 2009 18:08:57 +0200 Subject: [PATCH] #241: Fix a crash building LaTeX output for documents that contain a todolist directive. --- CHANGES | 3 +++ sphinx/ext/todo.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 3f7341609ea..a95350b0b63 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ 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. diff --git a/sphinx/ext/todo.py b/sphinx/ext/todo.py index e2a1bb4a606..d726b0eb479 100644 --- a/sphinx/ext/todo.py +++ b/sphinx/ext/todo.py @@ -14,6 +14,7 @@ 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 @@ -104,9 +105,13 @@ def process_todo_nodes(app, doctree, fromdocname): 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('.)', '.)')