summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2013-05-02 10:37:12 +0900
committershimizukawa <shimizukawa@gmail.com>2013-05-02 10:37:12 +0900
commit95510a2f5e878de04819b3ff3ef28857dca91e92 (patch)
treeec8f4583ba9bc5763a6463fb7c0b58346f257cec
parent07d9e7e42352534a82e8e44801c5c1cc577728b2 (diff)
downloadsphinx-95510a2f5e878de04819b3ff3ef28857dca91e92.tar.gz
Fix: Citation target missing cause AssertionError. Closes #1160
-rw-r--r--CHANGES1
-rw-r--r--sphinx/environment.py4
-rw-r--r--tests/root/footnote.txt6
-rw-r--r--tests/test_build_html.py1
-rw-r--r--tests/test_build_latex.py1
-rw-r--r--tests/test_build_texinfo.py1
6 files changed, 14 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 08493a85..ac8a9ce3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,7 @@ Features added
Bugs fixed
----------
+* #1160: Citation target missing cause AssertionError.
* #1157: Combination of 'globaltoc.html' and hidden toctree cause exception.
* Fix: 'make gettext' cause UnicodeDecodeError when templates contain utf-8
encoded string.
diff --git a/sphinx/environment.py b/sphinx/environment.py
index b27cbfed..35799bea 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -1354,6 +1354,10 @@ class BuildEnvironment:
if not isinstance(contnode, nodes.Element):
del node['ids'][:]
raise
+ elif 'ids' in node:
+ # remove ids attribute that annotated at
+ # transforms.CitationReference.apply.
+ del node['ids'][:]
# no new node found? try the missing-reference event
if newnode is None:
newnode = builder.app.emit_firstresult(
diff --git a/tests/root/footnote.txt b/tests/root/footnote.txt
index c1359dfe..b600697f 100644
--- a/tests/root/footnote.txt
+++ b/tests/root/footnote.txt
@@ -38,3 +38,9 @@ footenotes
.. rubric:: Citations
.. [bar] cite
+
+
+missing target
+--------------------
+[missing]_ citation
+
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 6b4a07df..73a4e309 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -49,6 +49,7 @@ http://sphinx-doc.org/domains.html
HTML_WARNINGS = ENV_WARNINGS + """\
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
+None:\\d+: WARNING: citation not found: missing
%(root)s/markup.txt:: WARNING: invalid single index entry u''
%(root)s/markup.txt:: WARNING: invalid pair index entry u''
%(root)s/markup.txt:: WARNING: invalid pair index entry u'keyword; '
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index bb79e52c..50aef045 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -28,6 +28,7 @@ def teardown_module():
latex_warnfile = StringIO()
LATEX_WARNINGS = ENV_WARNINGS + """\
+None:None: WARNING: citation not found: missing
None:None: WARNING: no matching candidate for image URI u'foo.\\*'
WARNING: invalid pair index entry u''
WARNING: invalid pair index entry u'keyword; '
diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py
index 587d123b..eb60fb8f 100644
--- a/tests/test_build_texinfo.py
+++ b/tests/test_build_texinfo.py
@@ -28,6 +28,7 @@ def teardown_module():
texinfo_warnfile = StringIO()
TEXINFO_WARNINGS = ENV_WARNINGS + """\
+None:None: WARNING: citation not found: missing
None:None: WARNING: no matching candidate for image URI u'foo.\\*'
None:None: WARNING: no matching candidate for image URI u'svgimg.\\*'
"""