Fix #1476 replace <tt> tag by <code>

This commit is contained in:
tk0miya 2014-08-12 12:12:10 +09:00
parent caf687d379
commit 0943375069
15 changed files with 60 additions and 60 deletions

View File

@ -44,7 +44,7 @@
{%- endif %}</td> {%- endif %}</td>
<td>{% if grouptype == 2 %}&nbsp;&nbsp;&nbsp;{% endif %} <td>{% if grouptype == 2 %}&nbsp;&nbsp;&nbsp;{% endif %}
{% if page %}<a href="{{ pathto(page) }}#{{ anchor }}">{% endif -%} {% if page %}<a href="{{ pathto(page) }}#{{ anchor }}">{% endif -%}
<tt class="xref">{{ name|e }}</tt> <code class="xref">{{ name|e }}</code>
{%- if page %}</a>{% endif %} {%- if page %}</a>{% endif %}
{%- if extra %} <em>({{ extra|e }})</em>{% endif -%} {%- if extra %} <em>({{ extra|e }})</em>{% endif -%}
</td><td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong>{% endif %} </td><td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong>{% endif %}

View File

@ -480,7 +480,7 @@ div.code-block-filename {
font-size: small; font-size: small;
} }
div.code-block-filename tt { div.code-block-filename code {
background-color: transparent; background-color: transparent;
} }
@ -489,22 +489,22 @@ div.code-block-filename + div.highlight > pre {
margin-top: 0; margin-top: 0;
} }
tt.descname { code.descname {
background-color: transparent; background-color: transparent;
font-weight: bold; font-weight: bold;
font-size: 1.2em; font-size: 1.2em;
} }
tt.descclassname { code.descclassname {
background-color: transparent; background-color: transparent;
} }
tt.xref, a tt { code.xref, a code {
background-color: transparent; background-color: transparent;
font-weight: bold; font-weight: bold;
} }
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent; background-color: transparent;
} }

View File

@ -700,8 +700,8 @@
(<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\ (<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
<div class="comment-markup-box" id="mb<%id%>">\ <div class="comment-markup-box" id="mb<%id%>">\
reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \ reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
<tt>``code``</tt>, \ <code>``code``</code>, \
code blocks: <tt>::</tt> and an indented block after blank line</div>\ code blocks: <code>::</code> and an indented block after blank line</div>\
<form method="post" id="cf<%id%>" class="comment-form" action="">\ <form method="post" id="cf<%id%>" class="comment-form" action="">\
<textarea name="comment" cols="80"></textarea>\ <textarea name="comment" cols="80"></textarea>\
<p class="propose-button">\ <p class="propose-button">\

View File

@ -281,7 +281,7 @@ pre {
border-right: none; border-right: none;
} }
tt { code {
background-color: #ecf0f3; background-color: #ecf0f3;
padding: 0 1px 0 1px; padding: 0 1px 0 1px;
font-size: 0.95em; font-size: 0.95em;
@ -291,11 +291,11 @@ th {
background-color: #ede; background-color: #ede;
} }
.warning tt { .warning code {
background: #efc2c2; background: #efc2c2;
} }
.note tt { .note code {
background: #d6d6d6; background: #d6d6d6;
} }

View File

@ -433,26 +433,26 @@ table.highlighttable td {
padding: 0 0.5em 0 0.5em; padding: 0 0.5em 0 0.5em;
} }
tt { code {
font-family: monospace; font-family: monospace;
} }
tt.descname { code.descname {
background-color: transparent; background-color: transparent;
font-weight: bold; font-weight: bold;
font-size: 1.2em; font-size: 1.2em;
} }
tt.descclassname { code.descclassname {
background-color: transparent; background-color: transparent;
} }
tt.xref, a tt { code.xref, a code {
background-color: transparent; background-color: transparent;
font-weight: bold; font-weight: bold;
} }
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent; background-color: transparent;
} }

View File

@ -307,7 +307,7 @@ td {
vertical-align: top; vertical-align: top;
} }
tt { code {
background-color: #e2e2e2; background-color: #e2e2e2;
font-size: 1.0em; font-size: 1.0em;
font-family: monospace; font-family: monospace;

View File

@ -226,7 +226,7 @@ pre {
-moz-box-shadow: 1px 1px 1px #d8d8d8; -moz-box-shadow: 1px 1px 1px #d8d8d8;
} }
tt { code {
background-color: #ecf0f3; background-color: #ecf0f3;
color: #222; color: #222;
/* padding: 1px 2px; */ /* padding: 1px 2px; */

View File

@ -281,7 +281,7 @@ pre {
border-right: none; border-right: none;
} }
tt { code {
background-color: #ecf0f3; background-color: #ecf0f3;
padding: 0 1px 0 1px; padding: 0 1px 0 1px;
font-size: 0.95em; font-size: 0.95em;
@ -291,11 +291,11 @@ th {
background-color: #ede; background-color: #ede;
} }
.warning tt { .warning code {
background: #efc2c2; background: #efc2c2;
} }
.note tt { .note code {
background: #d6d6d6; background: #d6d6d6;
} }

View File

@ -295,7 +295,7 @@ pre {
border-left-style: none; border-left-style: none;
} }
tt { code {
background-color: transparent; background-color: transparent;
color: #222; color: #222;
font-size: 1.1em; font-size: 1.1em;
@ -336,7 +336,7 @@ a:hover em.std-term {
font-style: normal; font-style: normal;
} }
tt.xref { code.xref {
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }

View File

@ -195,7 +195,7 @@ pre {
font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace;
} }
tt { code {
font-size: 13px; font-size: 13px;
font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace;
color: black; color: black;
@ -204,7 +204,7 @@ tt {
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
a.reference:hover tt { a.reference:hover code {
border-bottom-color: #aaa; border-bottom-color: #aaa;
} }

View File

@ -204,20 +204,20 @@ a.headerlink:hover {
color: white!important; color: white!important;
} }
cite, code, tt { cite, code, code {
font-family: 'Consolas', 'Deja Vu Sans Mono', font-family: 'Consolas', 'Deja Vu Sans Mono',
'Bitstream Vera Sans Mono', monospace; 'Bitstream Vera Sans Mono', monospace;
font-size: 0.95em; font-size: 0.95em;
letter-spacing: 0.01em; letter-spacing: 0.01em;
} }
tt { code {
background-color: #f2f2f2; background-color: #f2f2f2;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
color: #333; color: #333;
} }
tt.descname, tt.descclassname, tt.xref { code.descname, code.descclassname, code.xref {
border: 0; border: 0;
} }
@ -226,12 +226,12 @@ hr {
margin: 2em; margin: 2em;
} }
a tt { a code {
border: 0; border: 0;
color: #CA7900; color: #CA7900;
} }
a tt:hover { a code:hover {
color: #2491CF; color: #2491CF;
} }

View File

@ -318,7 +318,7 @@ div#comments div.comment h4 {
} }
div#comments div.comment pre, div#comments div.comment pre,
div#comments div.comment tt { div#comments div.comment code {
background-color: #ddd; background-color: #ddd;
color: #111; color: #111;
border: none; border: none;
@ -616,23 +616,23 @@ pre {
border-right: none; border-right: none;
} }
tt { code {
font-family: monospace; font-family: monospace;
background-color: #ecf0f3; background-color: #ecf0f3;
padding: 0 1px 0 1px; padding: 0 1px 0 1px;
} }
tt.descname { code.descname {
background-color: transparent; background-color: transparent;
font-weight: bold; font-weight: bold;
font-size: 1.2em; font-size: 1.2em;
} }
tt.descclassname { code.descclassname {
background-color: transparent; background-color: transparent;
} }
tt.xref, a tt { code.xref, a code {
background-color: transparent; background-color: transparent;
font-weight: bold; font-weight: bold;
} }
@ -651,7 +651,7 @@ tt.xref, a tt {
margin-left: 1.5em; margin-left: 1.5em;
} }
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
background-color: transparent; background-color: transparent;
} }

View File

@ -111,9 +111,9 @@ class HTMLTranslator(BaseTranslator):
self.body.append('</dt>\n') self.body.append('</dt>\n')
def visit_desc_addname(self, node): def visit_desc_addname(self, node):
self.body.append(self.starttag(node, 'tt', '', CLASS='descclassname')) self.body.append(self.starttag(node, 'code', '', CLASS='descclassname'))
def depart_desc_addname(self, node): def depart_desc_addname(self, node):
self.body.append('</tt>') self.body.append('</code>')
def visit_desc_type(self, node): def visit_desc_type(self, node):
pass pass
@ -126,9 +126,9 @@ class HTMLTranslator(BaseTranslator):
pass pass
def visit_desc_name(self, node): def visit_desc_name(self, node):
self.body.append(self.starttag(node, 'tt', '', CLASS='descname')) self.body.append(self.starttag(node, 'code', '', CLASS='descname'))
def depart_desc_name(self, node): def depart_desc_name(self, node):
self.body.append('</tt>') self.body.append('</code>')
def visit_desc_parameterlist(self, node): def visit_desc_parameterlist(self, node):
self.body.append('<span class="sig-paren">(</span>') self.body.append('<span class="sig-paren">(</span>')
@ -276,7 +276,7 @@ class HTMLTranslator(BaseTranslator):
starttag = self.starttag(node, 'div', suffix='', starttag = self.starttag(node, 'div', suffix='',
CLASS='highlight-%s' % lang) CLASS='highlight-%s' % lang)
if 'filename' in node: if 'filename' in node:
starttag += '<div class="code-block-filename"><tt>%s</tt></div>' % ( starttag += '<div class="code-block-filename"><code>%s</code></div>' % (
node['filename'],) node['filename'],)
self.body.append(starttag + highlighted + '</div>\n') self.body.append(starttag + highlighted + '</div>\n')
raise nodes.SkipNode raise nodes.SkipNode
@ -292,12 +292,12 @@ class HTMLTranslator(BaseTranslator):
# overwritten # overwritten
def visit_literal(self, node): def visit_literal(self, node):
self.body.append(self.starttag(node, 'tt', '', self.body.append(self.starttag(node, 'code', '',
CLASS='docutils literal')) CLASS='docutils literal'))
self.protect_literal_text += 1 self.protect_literal_text += 1
def depart_literal(self, node): def depart_literal(self, node):
self.protect_literal_text -= 1 self.protect_literal_text -= 1
self.body.append('</tt>') self.body.append('</code>')
def visit_productionlist(self, node): def visit_productionlist(self, node):
self.body.append(self.starttag(node, 'pre')) self.body.append(self.starttag(node, 'pre'))

View File

@ -122,21 +122,21 @@ HTML_XPATH = {
(".//li/strong", r'^command\\n$'), (".//li/strong", r'^command\\n$'),
(".//li/strong", r'^program\\n$'), (".//li/strong", r'^program\\n$'),
(".//li/em", r'^dfn\\n$'), (".//li/em", r'^dfn\\n$'),
(".//li/tt/span[@class='pre']", r'^kbd\\n$'), (".//li/code/span[@class='pre']", r'^kbd\\n$'),
(".//li/em", u'File \N{TRIANGULAR BULLET} Close'), (".//li/em", u'File \N{TRIANGULAR BULLET} Close'),
(".//li/tt/span[@class='pre']", '^a/$'), (".//li/code/span[@class='pre']", '^a/$'),
(".//li/tt/em/span[@class='pre']", '^varpart$'), (".//li/code/em/span[@class='pre']", '^varpart$'),
(".//li/tt/em/span[@class='pre']", '^i$'), (".//li/code/em/span[@class='pre']", '^i$'),
(".//a[@href='http://www.python.org/dev/peps/pep-0008']" (".//a[@href='http://www.python.org/dev/peps/pep-0008']"
"[@class='pep reference external']/strong", 'PEP 8'), "[@class='pep reference external']/strong", 'PEP 8'),
(".//a[@href='http://tools.ietf.org/html/rfc1.html']" (".//a[@href='http://tools.ietf.org/html/rfc1.html']"
"[@class='rfc reference external']/strong", 'RFC 1'), "[@class='rfc reference external']/strong", 'RFC 1'),
(".//a[@href='objects.html#envvar-HOME']" (".//a[@href='objects.html#envvar-HOME']"
"[@class='reference internal']/tt/span[@class='pre']", 'HOME'), "[@class='reference internal']/code/span[@class='pre']", 'HOME'),
(".//a[@href='#with']" (".//a[@href='#with']"
"[@class='reference internal']/tt/span[@class='pre']", '^with$'), "[@class='reference internal']/code/span[@class='pre']", '^with$'),
(".//a[@href='#grammar-token-try_stmt']" (".//a[@href='#grammar-token-try_stmt']"
"[@class='reference internal']/tt/span", '^statement$'), "[@class='reference internal']/code/span", '^statement$'),
(".//a[@href='subdir/includes.html']" (".//a[@href='subdir/includes.html']"
"[@class='reference internal']/em", 'Including in subdir'), "[@class='reference internal']/em", 'Including in subdir'),
(".//a[@href='objects.html#cmdoption-python-c']" (".//a[@href='objects.html#cmdoption-python-c']"
@ -165,7 +165,7 @@ HTML_XPATH = {
(".//dl/dt[@id='term-boson']", 'boson'), (".//dl/dt[@id='term-boson']", 'boson'),
# a production list # a production list
(".//pre/strong", 'try_stmt'), (".//pre/strong", 'try_stmt'),
(".//pre/a[@href='#grammar-token-try1_stmt']/tt/span", 'try1_stmt'), (".//pre/a[@href='#grammar-token-try1_stmt']/code/span", 'try1_stmt'),
# tests for ``only`` directive # tests for ``only`` directive
(".//p", 'A global substitution.'), (".//p", 'A global substitution.'),
(".//p", 'In HTML.'), (".//p", 'In HTML.'),
@ -175,8 +175,8 @@ HTML_XPATH = {
'objects.html': [ 'objects.html': [
(".//dt[@id='mod.Cls.meth1']", ''), (".//dt[@id='mod.Cls.meth1']", ''),
(".//dt[@id='errmod.Error']", ''), (".//dt[@id='errmod.Error']", ''),
(".//dt/tt", r'long\(parameter,\s* list\)'), (".//dt/code", r'long\(parameter,\s* list\)'),
(".//dt/tt", 'another one'), (".//dt/code", 'another one'),
(".//a[@href='#mod.Cls'][@class='reference internal']", ''), (".//a[@href='#mod.Cls'][@class='reference internal']", ''),
(".//dl[@class='userdesc']", ''), (".//dl[@class='userdesc']", ''),
(".//dt[@id='userdesc-myobj']", ''), (".//dt[@id='userdesc-myobj']", ''),

View File

@ -83,16 +83,16 @@ def verify(rst, html_expected, latex_expected):
def test_inline(): def test_inline():
# correct interpretation of code with whitespace # correct interpretation of code with whitespace
_html = ('<p><tt class="(samp )?docutils literal"><span class="pre">' _html = ('<p><code class="(samp )?docutils literal"><span class="pre">'
'code</span>&nbsp;&nbsp; <span class="pre">sample</span></tt></p>') 'code</span>&nbsp;&nbsp; <span class="pre">sample</span></code></p>')
yield verify_re, '``code sample``', _html, r'\\code{code sample}' yield verify_re, '``code sample``', _html, r'\\code{code sample}'
yield verify_re, ':samp:`code sample`', _html, r'\\code{code sample}' yield verify_re, ':samp:`code sample`', _html, r'\\code{code sample}'
# interpolation of braces in samp and file roles (HTML only) # interpolation of braces in samp and file roles (HTML only)
yield (verify, ':samp:`a{b}c`', yield (verify, ':samp:`a{b}c`',
'<p><tt class="samp docutils literal"><span class="pre">a</span>' '<p><code class="samp docutils literal"><span class="pre">a</span>'
'<em><span class="pre">b</span></em>' '<em><span class="pre">b</span></em>'
'<span class="pre">c</span></tt></p>', '<span class="pre">c</span></code></p>',
'\\code{a\\emph{b}c}') '\\code{a\\emph{b}c}')
# interpolation of arrows in menuselection # interpolation of arrows in menuselection
@ -115,8 +115,8 @@ def test_inline():
yield verify, '"John"', '<p>&#8220;John&#8221;</p>', "``John''" yield verify, '"John"', '<p>&#8220;John&#8221;</p>', "``John''"
# ... but not in literal text # ... but not in literal text
yield (verify, '``"John"``', yield (verify, '``"John"``',
'<p><tt class="docutils literal"><span class="pre">' '<p><code class="docutils literal"><span class="pre">'
'&quot;John&quot;</span></tt></p>', '&quot;John&quot;</span></code></p>',
'\\code{"John"}') '\\code{"John"}')
# verify classes for inline roles # verify classes for inline roles