mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix Emit wrong warnings if citation label includes hyphens (refs: #3558)
This commit is contained in:
parent
e3c39deb1e
commit
2f61be8bb7
1
CHANGES
1
CHANGES
@ -19,6 +19,7 @@ Bugs fixed
|
||||
* #3821: Failed to import sphinx.util.compat with docutils-0.14rc1
|
||||
* #3829: sphinx-quickstart template is incomplete regarding use of alabaster
|
||||
* #3772: 'str object' has no attribute 'filename'
|
||||
* Emit wrong warnings if citation label includes hyphens (refs: #3558)
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -493,7 +493,7 @@ class StandardDomain(Domain):
|
||||
'progoptions': {}, # (program, name) -> docname, labelid
|
||||
'objects': {}, # (type, name) -> docname, labelid
|
||||
'citations': {}, # name -> docname, labelid, lineno
|
||||
'citation_refs': {}, # name -> list of docnames
|
||||
'citation_refs': {}, # labelid -> list of docnames
|
||||
'labels': { # labelname -> docname, labelid, sectionname
|
||||
'genindex': ('genindex', '', l_('Index')),
|
||||
'modindex': ('py-modindex', '', l_('Module Index')),
|
||||
@ -589,8 +589,11 @@ class StandardDomain(Domain):
|
||||
def note_citation_refs(self, env, docname, document):
|
||||
# type: (BuildEnvironment, unicode, nodes.Node) -> None
|
||||
for name, refs in iteritems(document.citation_refs):
|
||||
citation_refs = self.data['citation_refs'].setdefault(name, [])
|
||||
citation_refs.append(docname)
|
||||
for ref in refs:
|
||||
labelid = ref.get('refid')
|
||||
if labelid:
|
||||
citation_refs = self.data['citation_refs'].setdefault(labelid, [])
|
||||
citation_refs.append(docname)
|
||||
|
||||
def note_labels(self, env, docname, document):
|
||||
# type: (BuildEnvironment, unicode, nodes.Node) -> None
|
||||
|
@ -23,6 +23,7 @@ citation
|
||||
--------------------
|
||||
|
||||
[bar]_
|
||||
[baz_qux]_
|
||||
|
||||
footnotes in table
|
||||
--------------------
|
||||
@ -50,6 +51,8 @@ footenotes
|
||||
|
||||
.. [bar] cite
|
||||
|
||||
.. [baz_qux] citation including underscore
|
||||
|
||||
.. [#] footnote in table caption
|
||||
|
||||
.. [#] footnote in table header
|
||||
|
@ -422,19 +422,21 @@ def test_static_output(app):
|
||||
(".//li/a", "double"),
|
||||
],
|
||||
'footnote.html': [
|
||||
(".//a[@class='footnote-reference'][@href='#id8'][@id='id1']", r"\[1\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id9'][@id='id2']", r"\[2\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id9'][@id='id1']", r"\[1\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id10'][@id='id2']", r"\[2\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#foo'][@id='id3']", r"\[3\]"),
|
||||
(".//a[@class='reference internal'][@href='#bar'][@id='id4']", r"\[bar\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id10'][@id='id5']", r"\[4\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id11'][@id='id6']", r"\[5\]"),
|
||||
(".//a[@class='reference internal'][@href='#baz-qux'][@id='id5']", r"\[baz_qux\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id11'][@id='id6']", r"\[4\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id12'][@id='id7']", r"\[5\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id1']", r"\[1\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id2']", r"\[2\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id3']", r"\[3\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id4']", r"\[bar\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id5']", r"\[4\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id6']", r"\[5\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id7']", r"\[6\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id5']", r"\[baz_qux\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id6']", r"\[4\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id7']", r"\[5\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id8']", r"\[6\]"),
|
||||
],
|
||||
'otherext.html': [
|
||||
(".//h1", "Generated section"),
|
||||
|
@ -297,19 +297,21 @@ def cached_etree_parse():
|
||||
(".//li/a", "double"),
|
||||
],
|
||||
'footnote.html': [
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id8'][@id='id1']", r"1"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id9'][@id='id2']", r"2"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id9'][@id='id1']", r"1"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id10'][@id='id2']", r"2"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#foo'][@id='id3']", r"3"),
|
||||
(".//a[@class='reference internal'][@href='#bar'][@id='id4']", r"\[bar\]"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id10'][@id='id5']", r"4"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id11'][@id='id6']", r"5"),
|
||||
(".//a[@class='reference internal'][@href='#baz-qux'][@id='id5']", r"\[baz_qux\]"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id11'][@id='id6']", r"4"),
|
||||
(".//a[@class='footnote-reference brackets'][@href='#id12'][@id='id7']", r"5"),
|
||||
(".//a[@class='fn-backref'][@href='#id1']", r"1"),
|
||||
(".//a[@class='fn-backref'][@href='#id2']", r"2"),
|
||||
(".//a[@class='fn-backref'][@href='#id3']", r"3"),
|
||||
(".//a[@class='fn-backref'][@href='#id4']", r"bar"),
|
||||
(".//a[@class='fn-backref'][@href='#id5']", r"4"),
|
||||
(".//a[@class='fn-backref'][@href='#id6']", r"5"),
|
||||
(".//a[@class='fn-backref'][@href='#id7']", r"6"),
|
||||
(".//a[@class='fn-backref'][@href='#id5']", r"baz_qux"),
|
||||
(".//a[@class='fn-backref'][@href='#id6']", r"4"),
|
||||
(".//a[@class='fn-backref'][@href='#id7']", r"5"),
|
||||
(".//a[@class='fn-backref'][@href='#id8']", r"6"),
|
||||
],
|
||||
'otherext.html': [
|
||||
(".//h1", "Generated section"),
|
||||
|
Loading…
Reference in New Issue
Block a user