mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8472 from tk0miya/8446_escape_spaces_inside_desc_signatures
Fix #8446: html: consecutive spaces are displayed as single space
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -87,6 +87,7 @@ Bugs fixed
|
||||
* #8123: html search: fix searching for terms containing + (Requires a custom
|
||||
search language that does not split on +)
|
||||
* #8665: html theme: Could not override globaltoc_maxdepth in theme.conf
|
||||
* #8446: html: consecutive spaces are displayed as single space
|
||||
* #8745: i18n: crashes with KeyError when translation message adds a new auto
|
||||
footnote reference
|
||||
* #4304: linkcheck: Fix race condition that could lead to checking the
|
||||
|
||||
@@ -124,8 +124,10 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
|
||||
def visit_desc_signature(self, node: Element) -> None:
|
||||
# the id is set automatically
|
||||
self.body.append(self.starttag(node, 'dt'))
|
||||
self.protect_literal_text += 1
|
||||
|
||||
def depart_desc_signature(self, node: Element) -> None:
|
||||
self.protect_literal_text -= 1
|
||||
if not node.get('is_multiline'):
|
||||
self.add_permalink_ref(node, _('Permalink to this definition'))
|
||||
self.body.append('</dt>\n')
|
||||
|
||||
@@ -95,8 +95,10 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
|
||||
def visit_desc_signature(self, node: Element) -> None:
|
||||
# the id is set automatically
|
||||
self.body.append(self.starttag(node, 'dt'))
|
||||
self.protect_literal_text += 1
|
||||
|
||||
def depart_desc_signature(self, node: Element) -> None:
|
||||
self.protect_literal_text -= 1
|
||||
if not node.get('is_multiline'):
|
||||
self.add_permalink_ref(node, _('Permalink to this definition'))
|
||||
self.body.append('</dt>\n')
|
||||
|
||||
@@ -178,8 +178,8 @@ def test_html4_output(app, status, warning):
|
||||
],
|
||||
'autodoc.html': [
|
||||
(".//dl[@class='py class']/dt[@id='autodoc_target.Class']", ''),
|
||||
(".//dl[@class='py function']/dt[@id='autodoc_target.function']/em/span", r'\*\*'),
|
||||
(".//dl[@class='py function']/dt[@id='autodoc_target.function']/em/span", r'kwds'),
|
||||
(".//dl[@class='py function']/dt[@id='autodoc_target.function']/em/span/span", r'\*\*'),
|
||||
(".//dl[@class='py function']/dt[@id='autodoc_target.function']/em/span/span", r'kwds'),
|
||||
(".//dd/p", r'Return spam\.'),
|
||||
],
|
||||
'extapi.html': [
|
||||
@@ -279,8 +279,10 @@ def test_html4_output(app, status, warning):
|
||||
'objects.html': [
|
||||
(".//dt[@id='mod.Cls.meth1']", ''),
|
||||
(".//dt[@id='errmod.Error']", ''),
|
||||
(".//dt/code", r'long\(parameter,\s* list\)'),
|
||||
(".//dt/code", 'another one'),
|
||||
(".//dt/code/span", r'long\(parameter,'),
|
||||
(".//dt/code/span", r'list\)'),
|
||||
(".//dt/code/span", 'another'),
|
||||
(".//dt/code/span", 'one'),
|
||||
(".//a[@href='#mod.Cls'][@class='reference internal']", ''),
|
||||
(".//dl[@class='std userdesc']", ''),
|
||||
(".//dt[@id='userdesc-myobj']", ''),
|
||||
|
||||
@@ -250,10 +250,10 @@ def test_missing_reference_cppdomain(tempdir, app, status, warning):
|
||||
'<span class="pre">Bar</span></code></a>' in html)
|
||||
assert ('<a class="reference external"'
|
||||
' href="https://docs.python.org/index.html#foons"'
|
||||
' title="(in foo v2.0)">foons</a>' in html)
|
||||
' title="(in foo v2.0)"><span class="pre">foons</span></a>' in html)
|
||||
assert ('<a class="reference external"'
|
||||
' href="https://docs.python.org/index.html#foons_bartype"'
|
||||
' title="(in foo v2.0)">bartype</a>' in html)
|
||||
' title="(in foo v2.0)"><span class="pre">bartype</span></a>' in html)
|
||||
|
||||
|
||||
def test_missing_reference_jsdomain(tempdir, app, status, warning):
|
||||
|
||||
Reference in New Issue
Block a user