Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--sphinx/ext/todo.py3
-rw-r--r--tests/roots/test-ext-todo/index.rst2
-rw-r--r--tests/test_ext_todo.py8
4 files changed, 10 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 271e935f2..6d70f8e5f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -36,6 +36,7 @@ Bugs fixed
* #4281: Race conditions when creating output directory
* #4315: For PDF 'howto' documents, ``latex_toplevel_sectioning='part'`` generates
``\chapter`` commands
+* #4214: Two todolist directives break sphinx-1.6.5
Testing
--------
diff --git a/sphinx/ext/todo.py b/sphinx/ext/todo.py
index a58422793..badfbc35f 100644
--- a/sphinx/ext/todo.py
+++ b/sphinx/ext/todo.py
@@ -178,7 +178,8 @@ def process_todo_nodes(app, doctree, fromdocname):
todo_entry = todo_info['todo']
# Remove targetref from the (copied) node to avoid emitting a
# duplicate label of the original entry when we walk this node.
- del todo_entry['targetref']
+ if 'targetref' in todo_entry:
+ del todo_entry['targetref']
# (Recursively) resolve references in the todo content
env.resolve_references(todo_entry, todo_info['docname'],
diff --git a/tests/roots/test-ext-todo/index.rst b/tests/roots/test-ext-todo/index.rst
index 6b95f73fd..781473d6a 100644
--- a/tests/roots/test-ext-todo/index.rst
+++ b/tests/roots/test-ext-todo/index.rst
@@ -7,3 +7,5 @@ test for sphinx.ext.todo
bar
.. todolist::
+
+.. todolist::
diff --git a/tests/test_ext_todo.py b/tests/test_ext_todo.py
index 4f01a07ab..cee59fe9d 100644
--- a/tests/test_ext_todo.py
+++ b/tests/test_ext_todo.py
@@ -86,7 +86,7 @@ def test_todo_not_included(app, status, warning):
assert set(todo[1].astext() for todo in todos) == set(['todo in foo', 'todo in bar'])
@pytest.mark.sphinx('latex', testroot='ext-todo', freshenv=True,
- confoverrides={'todo_include_todos': True, 'todo_emit_warnings': True})
+ confoverrides={'todo_include_todos': True})
def test_todo_valid_link(app, status, warning):
"""
Test that the inserted "original entry" links for todo items have a target
@@ -99,11 +99,13 @@ def test_todo_valid_link(app, status, warning):
content = (app.outdir / 'TodoTests.tex').text()
- # Look for the link to foo. We could equally well look for the link to bar.
+ # Look for the link to foo. Note that there are two of them because the
+ # source document uses todolist twice. We could equally well look for links
+ # to bar.
link = r'\{\\hyperref\[\\detokenize\{(.*?foo.*?)}]\{\\sphinxcrossref{' \
r'\\sphinxstyleemphasis{original entry}}}}'
m = re.findall(link, content)
- assert len(m) == 1
+ assert len(m) == 2
target = m[0]
# Look for the targets of this link.