mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #4983: productionlist directive generates invalid IDs for the tokens
This commit is contained in:
parent
506d4c87ef
commit
d62a274709
2
CHANGES
2
CHANGES
@ -33,6 +33,7 @@ Incompatible changes
|
||||
:confval:`viewcode_follow_imported_members` (refs: #4035)
|
||||
* #1857: latex: :confval:`latex_show_pagerefs` does not add pagerefs for
|
||||
citations
|
||||
* #4983: html: The URL for the productionlist has been changed
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
@ -120,6 +121,7 @@ Bugs fixed
|
||||
* #4850: latex: footnote inside footnote was not rendered
|
||||
* #4945: i18n: fix lang_COUNTRY not fallback correctly for IndexBuilder. Thanks
|
||||
to Shengjing Zhu.
|
||||
* #4983: productionlist directive generates invalid IDs for the tokens
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -432,7 +432,7 @@ class ProductionList(SphinxDirective):
|
||||
subnode = addnodes.production()
|
||||
subnode['tokenname'] = name.strip()
|
||||
if subnode['tokenname']:
|
||||
idname = 'grammar-token-%s' % subnode['tokenname']
|
||||
idname = nodes.make_id('grammar-token-%s' % subnode['tokenname'])
|
||||
if idname not in self.state.document.ids:
|
||||
subnode['ids'].append(idname)
|
||||
self.state.document.note_implicit_target(subnode, subnode)
|
||||
|
@ -227,7 +227,7 @@ def test_html_warnings(app, warning):
|
||||
"[@class='reference internal']/code/span[@class='pre']", 'HOME'),
|
||||
(".//a[@href='#with']"
|
||||
"[@class='reference internal']/code/span[@class='pre']", '^with$'),
|
||||
(".//a[@href='#grammar-token-try_stmt']"
|
||||
(".//a[@href='#grammar-token-try-stmt']"
|
||||
"[@class='reference internal']/code/span", '^statement$'),
|
||||
(".//a[@href='#some-label'][@class='reference internal']/span", '^here$'),
|
||||
(".//a[@href='#some-label'][@class='reference internal']/span", '^there$'),
|
||||
@ -259,7 +259,7 @@ def test_html_warnings(app, warning):
|
||||
(".//dl/dt[@id='term-boson']", 'boson'),
|
||||
# a production list
|
||||
(".//pre/strong", 'try_stmt'),
|
||||
(".//pre/a[@href='#grammar-token-try1_stmt']/code/span", 'try1_stmt'),
|
||||
(".//pre/a[@href='#grammar-token-try1-stmt']/code/span", 'try1_stmt'),
|
||||
# tests for ``only`` directive
|
||||
(".//p", 'A global substitution.'),
|
||||
(".//p", 'In HTML.'),
|
||||
|
@ -135,7 +135,7 @@ def cached_etree_parse():
|
||||
"[@class='reference internal']/code/span[@class='pre']", 'HOME'),
|
||||
(".//a[@href='#with']"
|
||||
"[@class='reference internal']/code/span[@class='pre']", '^with$'),
|
||||
(".//a[@href='#grammar-token-try_stmt']"
|
||||
(".//a[@href='#grammar-token-try-stmt']"
|
||||
"[@class='reference internal']/code/span", '^statement$'),
|
||||
(".//a[@href='#some-label'][@class='reference internal']/span", '^here$'),
|
||||
(".//a[@href='#some-label'][@class='reference internal']/span", '^there$'),
|
||||
@ -167,7 +167,7 @@ def cached_etree_parse():
|
||||
(".//dl/dt[@id='term-boson']", 'boson'),
|
||||
# a production list
|
||||
(".//pre/strong", 'try_stmt'),
|
||||
(".//pre/a[@href='#grammar-token-try1_stmt']/code/span", 'try1_stmt'),
|
||||
(".//pre/a[@href='#grammar-token-try1-stmt']/code/span", 'try1_stmt'),
|
||||
# tests for ``only`` directive
|
||||
(".//p", 'A global substitution.'),
|
||||
(".//p", 'In HTML.'),
|
||||
|
Loading…
Reference in New Issue
Block a user