mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #3455 from shibukawa/fix-again/epub-nbsp-issue
Fix   is appeared in EPUB docs #3450 again
This commit is contained in:
commit
64041636d6
@ -595,6 +595,10 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
def depart_hlistcol(self, node):
|
def depart_hlistcol(self, node):
|
||||||
self.body.append('</td>')
|
self.body.append('</td>')
|
||||||
|
|
||||||
|
def visit_option_group(self, node):
|
||||||
|
BaseTranslator.visit_option_group(self, node)
|
||||||
|
self.context[-2] = self.context[-2].replace(' ', ' ')
|
||||||
|
|
||||||
def bulk_text_processor(self, text):
|
def bulk_text_processor(self, text):
|
||||||
return text
|
return text
|
||||||
|
|
||||||
@ -832,10 +836,6 @@ class SmartyPantsHTMLTranslator(HTMLTranslator):
|
|||||||
self.no_smarty -= 1
|
self.no_smarty -= 1
|
||||||
HTMLTranslator.depart_option(self, node)
|
HTMLTranslator.depart_option(self, node)
|
||||||
|
|
||||||
def visit_option_group(self, node):
|
|
||||||
HTMLTranslator.visit_option_group(self, node)
|
|
||||||
self.context[-2] = self.context[-2].replace(' ', ' ')
|
|
||||||
|
|
||||||
def bulk_text_processor(self, text):
|
def bulk_text_processor(self, text):
|
||||||
if self.no_smarty <= 0:
|
if self.no_smarty <= 0:
|
||||||
return sphinx_smarty_pants(text)
|
return sphinx_smarty_pants(text)
|
||||||
|
5
tests/roots/test-html_entity/conf.py
Normal file
5
tests/roots/test-html_entity/conf.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
master_doc = 'index'
|
||||||
|
html_theme = 'classic'
|
||||||
|
exclude_patterns = ['_build']
|
31
tests/roots/test-html_entity/index.rst
Normal file
31
tests/roots/test-html_entity/index.rst
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
.. _index:
|
||||||
|
|
||||||
|
test-html_entity (#3450)
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Empty cell
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:header-rows: 1
|
||||||
|
- * un
|
||||||
|
*
|
||||||
|
* trois
|
||||||
|
|
||||||
|
Return description in function signature
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
.. py:function:: test() -> string
|
||||||
|
|
||||||
|
rarr
|
||||||
|
|
||||||
|
Field list that has long name (over 14 characters)
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
:abcdefghijklmnopqrstuvwxyz: fieldlist
|
||||||
|
|
||||||
|
Option list that has long name (over 14 characters)
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-a all
|
||||||
|
-b long_long_file use file
|
@ -1139,3 +1139,12 @@ def test_html_sourcelink_suffix(app):
|
|||||||
assert '<a href="_sources/images.txt"' in content_images
|
assert '<a href="_sources/images.txt"' in content_images
|
||||||
assert (app.outdir / '_sources' / 'otherext.foo').exists()
|
assert (app.outdir / '_sources' / 'otherext.foo').exists()
|
||||||
assert (app.outdir / '_sources' / 'images.txt').exists()
|
assert (app.outdir / '_sources' / 'images.txt').exists()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('html', testroot='html_entity')
|
||||||
|
def test_html_entity(app):
|
||||||
|
app.builder.build_all()
|
||||||
|
valid_entities = {'amp', 'lt', 'gt', 'quot', 'apos'}
|
||||||
|
content = (app.outdir / 'index.html').text()
|
||||||
|
for entity in re.findall(r'&([a-z]+);', content, re.M):
|
||||||
|
assert entity not in valid_entities
|
||||||
|
Loading…
Reference in New Issue
Block a user