From 094337506972b9c9a827b67cbe919e77857f5a6b Mon Sep 17 00:00:00 2001 From: tk0miya Date: Tue, 12 Aug 2014 12:12:10 +0900 Subject: [PATCH] Fix #1476 replace tag by --- sphinx/themes/basic/domainindex.html | 2 +- sphinx/themes/basic/static/basic.css_t | 10 +++++----- sphinx/themes/basic/static/websupport.js | 4 ++-- sphinx/themes/default/static/default.css_t | 6 +++--- sphinx/themes/epub/static/epub.css | 12 +++++------ sphinx/themes/haiku/static/haiku.css_t | 2 +- sphinx/themes/nature/static/nature.css_t | 2 +- sphinx/themes/pyramid/static/epub.css | 6 +++--- sphinx/themes/pyramid/static/pyramid.css_t | 4 ++-- sphinx/themes/scrolls/static/scrolls.css_t | 4 ++-- .../themes/sphinxdoc/static/sphinxdoc.css_t | 10 +++++----- .../traditional/static/traditional.css_t | 12 +++++------ sphinx/writers/html.py | 14 ++++++------- tests/test_build_html.py | 20 +++++++++---------- tests/test_markup.py | 12 +++++------ 15 files changed, 60 insertions(+), 60 deletions(-) diff --git a/sphinx/themes/basic/domainindex.html b/sphinx/themes/basic/domainindex.html index ac5aed9fd..4ee62d55b 100644 --- a/sphinx/themes/basic/domainindex.html +++ b/sphinx/themes/basic/domainindex.html @@ -44,7 +44,7 @@ {%- endif %} {% if grouptype == 2 %}   {% endif %} {% if page %}{% endif -%} - {{ name|e }} + {{ name|e }} {%- if page %}{% endif %} {%- if extra %} ({{ extra|e }}){% endif -%} {% if qualifier %}{{ qualifier|e }}:{% endif %} diff --git a/sphinx/themes/basic/static/basic.css_t b/sphinx/themes/basic/static/basic.css_t index d4561bfa1..cb1a923ce 100644 --- a/sphinx/themes/basic/static/basic.css_t +++ b/sphinx/themes/basic/static/basic.css_t @@ -480,7 +480,7 @@ div.code-block-filename { font-size: small; } -div.code-block-filename tt { +div.code-block-filename code { background-color: transparent; } @@ -489,22 +489,22 @@ div.code-block-filename + div.highlight > pre { margin-top: 0; } -tt.descname { +code.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } -tt.descclassname { +code.descclassname { background-color: transparent; } -tt.xref, a tt { +code.xref, a code { background-color: transparent; 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; } diff --git a/sphinx/themes/basic/static/websupport.js b/sphinx/themes/basic/static/websupport.js index 71c0a1364..9932afb99 100644 --- a/sphinx/themes/basic/static/websupport.js +++ b/sphinx/themes/basic/static/websupport.js @@ -700,8 +700,8 @@ (markup):

\
\ reStructured text markup: *emph*, **strong**, \ - ``code``, \ - code blocks: :: and an indented block after blank line
\ + ``code``, \ + code blocks: :: and an indented block after blank line\
\ \

\ diff --git a/sphinx/themes/default/static/default.css_t b/sphinx/themes/default/static/default.css_t index ae4012d0f..c0fbdd8c8 100644 --- a/sphinx/themes/default/static/default.css_t +++ b/sphinx/themes/default/static/default.css_t @@ -281,7 +281,7 @@ pre { border-right: none; } -tt { +code { background-color: #ecf0f3; padding: 0 1px 0 1px; font-size: 0.95em; @@ -291,11 +291,11 @@ th { background-color: #ede; } -.warning tt { +.warning code { background: #efc2c2; } -.note tt { +.note code { background: #d6d6d6; } diff --git a/sphinx/themes/epub/static/epub.css b/sphinx/themes/epub/static/epub.css index 2e90481d7..a03c0627f 100644 --- a/sphinx/themes/epub/static/epub.css +++ b/sphinx/themes/epub/static/epub.css @@ -433,26 +433,26 @@ table.highlighttable td { padding: 0 0.5em 0 0.5em; } -tt { +code { font-family: monospace; } -tt.descname { +code.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } -tt.descclassname { +code.descclassname { background-color: transparent; } -tt.xref, a tt { +code.xref, a code { background-color: transparent; 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; } @@ -535,4 +535,4 @@ table .link-target { src: url("res:///Data/fonts/LiberationNarrow-BoldItalic.otf") format("opentype"); } -*/ \ No newline at end of file +*/ diff --git a/sphinx/themes/haiku/static/haiku.css_t b/sphinx/themes/haiku/static/haiku.css_t index bd81db0a3..c6cb42d85 100644 --- a/sphinx/themes/haiku/static/haiku.css_t +++ b/sphinx/themes/haiku/static/haiku.css_t @@ -307,7 +307,7 @@ td { vertical-align: top; } -tt { +code { background-color: #e2e2e2; font-size: 1.0em; font-family: monospace; diff --git a/sphinx/themes/nature/static/nature.css_t b/sphinx/themes/nature/static/nature.css_t index 7909e8132..84b37517a 100644 --- a/sphinx/themes/nature/static/nature.css_t +++ b/sphinx/themes/nature/static/nature.css_t @@ -226,7 +226,7 @@ pre { -moz-box-shadow: 1px 1px 1px #d8d8d8; } -tt { +code { background-color: #ecf0f3; color: #222; /* padding: 1px 2px; */ diff --git a/sphinx/themes/pyramid/static/epub.css b/sphinx/themes/pyramid/static/epub.css index 7465a421c..603837557 100644 --- a/sphinx/themes/pyramid/static/epub.css +++ b/sphinx/themes/pyramid/static/epub.css @@ -281,7 +281,7 @@ pre { border-right: none; } -tt { +code { background-color: #ecf0f3; padding: 0 1px 0 1px; font-size: 0.95em; @@ -291,11 +291,11 @@ th { background-color: #ede; } -.warning tt { +.warning code { background: #efc2c2; } -.note tt { +.note code { background: #d6d6d6; } diff --git a/sphinx/themes/pyramid/static/pyramid.css_t b/sphinx/themes/pyramid/static/pyramid.css_t index 053f61fa0..6ffdb7142 100644 --- a/sphinx/themes/pyramid/static/pyramid.css_t +++ b/sphinx/themes/pyramid/static/pyramid.css_t @@ -295,7 +295,7 @@ pre { border-left-style: none; } -tt { +code { background-color: transparent; color: #222; font-size: 1.1em; @@ -336,7 +336,7 @@ a:hover em.std-term { font-style: normal; } -tt.xref { +code.xref { font-weight: normal; font-style: normal; } diff --git a/sphinx/themes/scrolls/static/scrolls.css_t b/sphinx/themes/scrolls/static/scrolls.css_t index 65b250422..9591f045f 100644 --- a/sphinx/themes/scrolls/static/scrolls.css_t +++ b/sphinx/themes/scrolls/static/scrolls.css_t @@ -195,7 +195,7 @@ pre { font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; } -tt { +code { font-size: 13px; font-family: 'Bitstream Vera Sans Mono', 'Monaco', monospace; color: black; @@ -204,7 +204,7 @@ tt { border-bottom: 1px solid #eee; } -a.reference:hover tt { +a.reference:hover code { border-bottom-color: #aaa; } diff --git a/sphinx/themes/sphinxdoc/static/sphinxdoc.css_t b/sphinx/themes/sphinxdoc/static/sphinxdoc.css_t index 9f90d56fc..174b5950d 100644 --- a/sphinx/themes/sphinxdoc/static/sphinxdoc.css_t +++ b/sphinx/themes/sphinxdoc/static/sphinxdoc.css_t @@ -204,20 +204,20 @@ a.headerlink:hover { color: white!important; } -cite, code, tt { +cite, code, code { font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; letter-spacing: 0.01em; } -tt { +code { background-color: #f2f2f2; border-bottom: 1px solid #ddd; color: #333; } -tt.descname, tt.descclassname, tt.xref { +code.descname, code.descclassname, code.xref { border: 0; } @@ -226,12 +226,12 @@ hr { margin: 2em; } -a tt { +a code { border: 0; color: #CA7900; } -a tt:hover { +a code:hover { color: #2491CF; } diff --git a/sphinx/themes/traditional/static/traditional.css_t b/sphinx/themes/traditional/static/traditional.css_t index 4b6e5c413..a82ef53ca 100644 --- a/sphinx/themes/traditional/static/traditional.css_t +++ b/sphinx/themes/traditional/static/traditional.css_t @@ -318,7 +318,7 @@ div#comments div.comment h4 { } div#comments div.comment pre, -div#comments div.comment tt { +div#comments div.comment code { background-color: #ddd; color: #111; border: none; @@ -616,23 +616,23 @@ pre { border-right: none; } -tt { +code { font-family: monospace; background-color: #ecf0f3; padding: 0 1px 0 1px; } -tt.descname { +code.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } -tt.descclassname { +code.descclassname { background-color: transparent; } -tt.xref, a tt { +code.xref, a code { background-color: transparent; font-weight: bold; } @@ -651,7 +651,7 @@ tt.xref, a tt { 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; } diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py index 2d3366924..a653cc98f 100644 --- a/sphinx/writers/html.py +++ b/sphinx/writers/html.py @@ -111,9 +111,9 @@ class HTMLTranslator(BaseTranslator): self.body.append('\n') 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): - self.body.append('') + self.body.append('') def visit_desc_type(self, node): pass @@ -126,9 +126,9 @@ class HTMLTranslator(BaseTranslator): pass 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): - self.body.append('') + self.body.append('') def visit_desc_parameterlist(self, node): self.body.append('(') @@ -276,7 +276,7 @@ class HTMLTranslator(BaseTranslator): starttag = self.starttag(node, 'div', suffix='', CLASS='highlight-%s' % lang) if 'filename' in node: - starttag += '

%s
' % ( + starttag += '
%s
' % ( node['filename'],) self.body.append(starttag + highlighted + '\n') raise nodes.SkipNode @@ -292,12 +292,12 @@ class HTMLTranslator(BaseTranslator): # overwritten def visit_literal(self, node): - self.body.append(self.starttag(node, 'tt', '', + self.body.append(self.starttag(node, 'code', '', CLASS='docutils literal')) self.protect_literal_text += 1 def depart_literal(self, node): self.protect_literal_text -= 1 - self.body.append('') + self.body.append('') def visit_productionlist(self, node): self.body.append(self.starttag(node, 'pre')) diff --git a/tests/test_build_html.py b/tests/test_build_html.py index a9ee4524c..115223e6c 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -122,21 +122,21 @@ HTML_XPATH = { (".//li/strong", r'^command\\n$'), (".//li/strong", r'^program\\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/tt/span[@class='pre']", '^a/$'), - (".//li/tt/em/span[@class='pre']", '^varpart$'), - (".//li/tt/em/span[@class='pre']", '^i$'), + (".//li/code/span[@class='pre']", '^a/$'), + (".//li/code/em/span[@class='pre']", '^varpart$'), + (".//li/code/em/span[@class='pre']", '^i$'), (".//a[@href='http://www.python.org/dev/peps/pep-0008']" "[@class='pep reference external']/strong", 'PEP 8'), (".//a[@href='http://tools.ietf.org/html/rfc1.html']" "[@class='rfc reference external']/strong", 'RFC 1'), (".//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']" - "[@class='reference internal']/tt/span[@class='pre']", '^with$'), + "[@class='reference internal']/code/span[@class='pre']", '^with$'), (".//a[@href='#grammar-token-try_stmt']" - "[@class='reference internal']/tt/span", '^statement$'), + "[@class='reference internal']/code/span", '^statement$'), (".//a[@href='subdir/includes.html']" "[@class='reference internal']/em", 'Including in subdir'), (".//a[@href='objects.html#cmdoption-python-c']" @@ -165,7 +165,7 @@ HTML_XPATH = { (".//dl/dt[@id='term-boson']", 'boson'), # a production list (".//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 (".//p", 'A global substitution.'), (".//p", 'In HTML.'), @@ -175,8 +175,8 @@ HTML_XPATH = { 'objects.html': [ (".//dt[@id='mod.Cls.meth1']", ''), (".//dt[@id='errmod.Error']", ''), - (".//dt/tt", r'long\(parameter,\s* list\)'), - (".//dt/tt", 'another one'), + (".//dt/code", r'long\(parameter,\s* list\)'), + (".//dt/code", 'another one'), (".//a[@href='#mod.Cls'][@class='reference internal']", ''), (".//dl[@class='userdesc']", ''), (".//dt[@id='userdesc-myobj']", ''), diff --git a/tests/test_markup.py b/tests/test_markup.py index e58cfe688..81ade641d 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -83,16 +83,16 @@ def verify(rst, html_expected, latex_expected): def test_inline(): # correct interpretation of code with whitespace - _html = ('

' - 'code   sample

') + _html = ('

' + 'code   sample

') yield verify_re, '``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) yield (verify, ':samp:`a{b}c`', - '

a' + '

a' 'b' - 'c

', + 'c

', '\\code{a\\emph{b}c}') # interpolation of arrows in menuselection @@ -115,8 +115,8 @@ def test_inline(): yield verify, '"John"', '

“John”

', "``John''" # ... but not in literal text yield (verify, '``"John"``', - '

' - '"John"

', + '

' + '"John"

', '\\code{"John"}') # verify classes for inline roles