fix html entity to fix epub error

This commit is contained in:
Yoshiki Shibukawa 2016-07-21 10:09:01 +09:00
parent 8f162a132e
commit 90b3c79895
10 changed files with 17 additions and 17 deletions

View File

@ -5,8 +5,8 @@
<div class="quotebar">
<p><em>{%trans%}What users say:{%endtrans%}</em></p>
<p>{%trans%}&ldquo;Cheers for a great tool that actually makes programmers <b>want</b>
to write documentation!&rdquo;{%endtrans%}</p>
<p>{%trans%}&#8220;Cheers for a great tool that actually makes programmers <b>want</b>
to write documentation!&#8220;{%endtrans%}</p>
</div>
<p>{%trans%}

View File

@ -57,8 +57,8 @@
{% endblock %}
{% block rootrellink %}
<li><a href="{{ pathto('index') }}">Sphinx home</a>&nbsp;|</li>
<li><a href="{{ pathto('contents') }}">Documentation</a> &raquo;</li>
<li><a href="{{ pathto('index') }}">Sphinx home</a>&#160;|</li>
<li><a href="{{ pathto('contents') }}">Documentation</a> &#187;</li>
{% endblock %}
{% block header %}

View File

@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/frameset.dtd">
<html{% if language is not none %} lang="{{ language }}"{% endif %}>
<head>
<title>{% trans version=version|e, docstitle=docstitle|e %}Changes in Version {{ version }} &mdash; {{ docstitle }}{% endtrans %}</title>
<title>{% trans version=version|e, docstitle=docstitle|e %}Changes in Version {{ version }} &#8212; {{ docstitle }}{% endtrans %}</title>
</head>
<frameset cols="45%,*">
<frame name="main" src="changes.html">

View File

@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/loose.dtd">
<html{% if language is not none %} lang="{{ language }}"{% endif %}>
<head>
<title>{% trans filename=filename, docstitle=docstitle|e %}{{ filename }} &mdash; {{ docstitle }}{% endtrans %}</title>
<title>{% trans filename=filename, docstitle=docstitle|e %}{{ filename }} &#8212; {{ docstitle }}{% endtrans %}</title>
<style type="text/css">
.hl { background-color: yellow }
</style>

View File

@ -9,7 +9,7 @@
<head>
<link rel="stylesheet" href="default.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{% trans version=version|e, docstitle=docstitle|e %}Changes in Version {{ version }} &mdash; {{ docstitle }}{% endtrans %}</title>
<title>{% trans version=version|e, docstitle=docstitle|e %}Changes in Version {{ version }} &#8212; {{ docstitle }}{% endtrans %}</title>
</head>
<body>
<div class="document">

View File

@ -32,7 +32,7 @@
<table class="indextable modindextable" cellspacing="0" cellpadding="2">
{%- for letter, entries in content %}
<tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
<tr class="pcap"><td></td><td>&#160;</td><td></td></tr>
<tr class="cap" id="cap-{{ letter }}"><td></td><td>
<strong>{{ letter }}</strong></td><td></td></tr>
{%- for (name, grouptype, page, anchor, extra, qualifier, description)
@ -42,7 +42,7 @@
<img src="{{ pathto('_static/minus.png', 1) }}" class="toggler"
id="toggle-{{ groupid.next() }}" style="display: none" alt="-" />
{%- endif %}</td>
<td>{% if grouptype == 2 %}&nbsp;&nbsp;&nbsp;{% endif %}
<td>{% if grouptype == 2 %}&#160;&#160;&#160;{% endif %}
{% if page %}<a href="{{ pathto(page) }}#{{ anchor }}">{% endif -%}
<code class="xref">{{ name|e }}</code>
{%- if page %}</a>{% endif %}

View File

@ -11,7 +11,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{%- endblock %}
{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
{%- set reldelim1 = reldelim1 is not defined and ' &#187;' or reldelim1 %}
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
(sidebars != []) %}
@ -19,7 +19,7 @@
{# XXX necessary? #}
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
{%- if not embedded and docstitle %}
{%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
{%- set titlesuffix = " &#8212; "|safe + docstitle|e %}
{%- else %}
{%- set titlesuffix = "" %}
{%- endif %}
@ -186,9 +186,9 @@
<div class="footer" role="contentinfo">
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}
{%- if last_updated %}

View File

@ -105,7 +105,7 @@ decade_abbr_re = re.compile(r"""\b'(?=\d{2}s)""")
opening_double_quotes_regex = re.compile(r"""
(
\s | # a whitespace char, or
&nbsp; | # a non-breaking space entity, or
&#160; | # a non-breaking space entity, or
-- | # dashes, or
&[mn]dash; | # named dash entities
%s | # or decimal entities
@ -131,7 +131,7 @@ closing_double_quotes_regex_2 = re.compile(r"""
opening_single_quotes_regex = re.compile(r"""
(
\s | # a whitespace char, or
&nbsp; | # a non-breaking space entity, or
&#160; | # a non-breaking space entity, or
-- | # dashes, or
&[mn]dash; | # named dash entities
%s | # or decimal entities

View File

@ -545,7 +545,7 @@ class HTMLTranslator(BaseTranslator):
self.body.append(token)
else:
# protect runs of multiple spaces; the last one can wrap
self.body.append('&nbsp;' * (len(token)-1) + ' ')
self.body.append('&#160;' * (len(token)-1) + ' ')
else:
if self.in_mailto and self.settings.cloak_email_addresses:
encoded = self.cloak_email(encoded)

View File

@ -92,7 +92,7 @@ def verify(rst, html_expected, latex_expected):
def test_inline():
# correct interpretation of code with whitespace
_html = ('<p><code class="(samp )?docutils literal"><span class="pre">'
'code</span>&nbsp;&nbsp; <span class="pre">sample</span></code></p>')
'code</span>&#160;&#160; <span class="pre">sample</span></code></p>')
yield verify_re, '``code sample``', _html, r'\\sphinxcode{code sample}'
yield verify_re, ':samp:`code sample`', _html, r'\\sphinxcode{code sample}'