diff --git a/CHANGES b/CHANGES index 051423a52..ebeb32476 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Bugs fixed ---------- * Fix line numbers was not shown on warnings in LaTeX and texinfo builders +* Fix filenames were not shown on warnings of citations Release 1.3.4 (released Jan 12, 2016) ===================================== diff --git a/sphinx/transforms.py b/sphinx/transforms.py index d4ad4316e..9cecbd5e5 100644 --- a/sphinx/transforms.py +++ b/sphinx/transforms.py @@ -156,6 +156,7 @@ class CitationReferences(Transform): refnode = addnodes.pending_xref(cittext, reftype='citation', reftarget=cittext, refwarn=True, ids=citnode["ids"]) + refnode.source = citnode.source or citnode.parent.source refnode.line = citnode.line or citnode.parent.line refnode += nodes.Text('[' + cittext + ']') citnode.parent.replace(citnode, refnode) diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 18f0e8c29..538d8581d 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -37,7 +37,7 @@ with "\\?": b?'here: >>>(\\\\|/)xbb<<<' 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/footnote.txt:60: WARNING: citation not found: missing %(root)s/markup.txt:158: WARNING: unknown option: &option %(root)s/markup.txt:: WARNING: invalid single index entry u'' %(root)s/markup.txt:: WARNING: invalid pair index entry u'' diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index c8026ba54..509a19d4e 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -25,7 +25,7 @@ from test_build_html import ENV_WARNINGS LATEX_WARNINGS = ENV_WARNINGS + """\ %(root)s/markup.txt:158: WARNING: unknown option: &option -None:60: WARNING: citation not found: missing +%(root)s/footnote.txt:60: WARNING: citation not found: missing %(root)s/images.txt:20: 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 51b0b57dd..9b264a3fb 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_build_texinfo.py @@ -24,7 +24,7 @@ from test_build_html import ENV_WARNINGS TEXINFO_WARNINGS = ENV_WARNINGS + """\ %(root)s/markup.txt:158: WARNING: unknown option: &option -None:60: WARNING: citation not found: missing +%(root)s/footnote.txt:60: WARNING: citation not found: missing %(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*' %(root)s/images.txt:29: WARNING: no matching candidate for image URI u'svgimg.\\*' """