mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Close #1638: html: Add permalink icons to glossary terms
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -43,6 +43,7 @@ Features added
|
|||||||
:event:`html-page-context` event
|
:event:`html-page-context` event
|
||||||
* #6550: html: Allow to use HTML permalink texts via
|
* #6550: html: Allow to use HTML permalink texts via
|
||||||
:confval:`html_permalinks_icon`
|
:confval:`html_permalinks_icon`
|
||||||
|
* #1638: html: Add permalink icons to glossary terms
|
||||||
* #8649: imgconverter: Skip availability check if builder supports the image
|
* #8649: imgconverter: Skip availability check if builder supports the image
|
||||||
type
|
type
|
||||||
* #8573: napoleon: Allow to change the style of custom sections using
|
* #8573: napoleon: Allow to change the style of custom sections using
|
||||||
|
|||||||
@@ -394,6 +394,10 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
|
|||||||
# there's a classifier.
|
# there's a classifier.
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
if isinstance(node.parent.parent.parent, addnodes.glossary):
|
||||||
|
# add permalink if glossary terms
|
||||||
|
self.add_permalink_ref(node, _('Permalink to this term'))
|
||||||
|
|
||||||
self.body.append('</dt>')
|
self.body.append('</dt>')
|
||||||
|
|
||||||
# overwritten
|
# overwritten
|
||||||
|
|||||||
@@ -345,6 +345,10 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
|
|||||||
# there's a classifier.
|
# there's a classifier.
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
if isinstance(node.parent.parent.parent, addnodes.glossary):
|
||||||
|
# add permalink if glossary terms
|
||||||
|
self.add_permalink_ref(node, _('Permalink to this term'))
|
||||||
|
|
||||||
self.body.append('</dt>')
|
self.body.append('</dt>')
|
||||||
|
|
||||||
# overwritten
|
# overwritten
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ def test_html4_output(app, status, warning):
|
|||||||
(".//p[@class='centered']/strong", 'LICENSE'),
|
(".//p[@class='centered']/strong", 'LICENSE'),
|
||||||
# a glossary
|
# a glossary
|
||||||
(".//dl/dt[@id='term-boson']", 'boson'),
|
(".//dl/dt[@id='term-boson']", 'boson'),
|
||||||
|
(".//dl/dt[@id='term-boson']/a", '¶'),
|
||||||
# a production list
|
# a production list
|
||||||
(".//pre/strong", 'try_stmt'),
|
(".//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'),
|
||||||
|
|||||||
@@ -363,8 +363,12 @@ def get_verifier(verify, verify_re):
|
|||||||
# glossary (description list): multiple terms
|
# glossary (description list): multiple terms
|
||||||
'verify',
|
'verify',
|
||||||
'.. glossary::\n\n term1\n term2\n description',
|
'.. glossary::\n\n term1\n term2\n description',
|
||||||
('<dl class="glossary docutils">\n<dt id="term-term1">term1</dt>'
|
('<dl class="glossary docutils">\n'
|
||||||
'<dt id="term-term2">term2</dt><dd>description</dd>\n</dl>'),
|
'<dt id="term-term1">term1<a class="headerlink" href="#term-term1"'
|
||||||
|
' title="Permalink to this term">¶</a></dt>'
|
||||||
|
'<dt id="term-term2">term2<a class="headerlink" href="#term-term2"'
|
||||||
|
' title="Permalink to this term">¶</a></dt>'
|
||||||
|
'<dd>description</dd>\n</dl>'),
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user