Merge pull request #2853 from shibukawa/fix/genindex

Fix genindex.html to satisfy xhtml standard
This commit is contained in:
Takeshi KOMIYA
2016-08-20 12:52:23 +09:00
committed by GitHub
11 changed files with 61 additions and 29 deletions

View File

@@ -41,6 +41,7 @@ Incompatible changes
* ``sphinx.ext.viewcode`` disabled on singlehtml builder.
* Use make-mode of ``sphinx-quickstart`` by default. To disable this, use
``-M`` option
* Fix ``genindex.html`` to satisfy xhtml standard.
Features added
--------------

View File

@@ -462,9 +462,14 @@ table.indextable td {
vertical-align: top;
}
table.indextable dl, table.indextable dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {

View File

@@ -8,7 +8,6 @@
:license: BSD, see LICENSE for details.
#}
{% macro indexentries(firstname, links) %}
<dt>
{%- if links -%}
<a href="{{ links[0][1] }}">
{%- if links[0][0] %}<strong>{% endif -%}
@@ -25,7 +24,6 @@
{%- else %}
{{ firstname|e }}
{%- endif %}
</dt>
{% endmacro %}
{%- extends "layout.html" %}
@@ -36,18 +34,18 @@
<table style="width: 100%" class="indextable"><tr>
{%- for column in entries|slice(2) if column %}
<td style="width: 33%" valign="top"><dl>
<td style="width: 33%; vertical-align: top;"><ul>
{%- for entryname, (links, subitems, _) in column %}
{{ indexentries(entryname, links) }}
<li>{{ indexentries(entryname, links) }}</li>
{%- if subitems %}
<dd><dl>
<ul>
{%- for subentryname, subentrylinks in subitems %}
{{ indexentries(subentryname, subentrylinks) }}
<li>{{ indexentries(subentryname, subentrylinks) }}</li>
{%- endfor %}
</dl></dd>
{%- endif -%}
</ul>
{%- endif -%}</li>
{%- endfor %}
</dl></td>
</ul></td>
{%- endfor %}
</tr></table>

View File

@@ -8,7 +8,6 @@
:license: BSD, see LICENSE for details.
#}
{% macro indexentries(firstname, links) %}
<dt>
{%- if links -%}
<a href="{{ links[0][1] }}">
{%- if links[0][0] %}<strong>{% endif -%}
@@ -25,7 +24,6 @@
{%- else %}
{{ firstname|e }}
{%- endif %}
</dt>
{% endmacro %}
{%- extends "layout.html" %}
@@ -45,18 +43,18 @@
<h2 id="{{ key }}">{{ key }}</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
{%- for column in entries|slice(2) if column %}
<td style="width: 33%" valign="top"><dl>
<td style="width: 33%; vertical-align: top;"><ul>
{%- for entryname, (links, subitems, _) in column %}
{{ indexentries(entryname, links) }}
<li>{{ indexentries(entryname, links) }}
{%- if subitems %}
<dd><dl>
<ul>
{%- for subentryname, subentrylinks in subitems %}
{{ indexentries(subentryname, subentrylinks) }}
<li>{{ indexentries(subentryname, subentrylinks) }}</li>
{%- endfor %}
</dl></dd>
{%- endif -%}
</ul>
{%- endif -%}</li>
{%- endfor %}
</dl></td>
</ul></td>
{%- endfor %}
</tr></table>
{% endfor %}

View File

@@ -149,9 +149,14 @@ table.indextable td {
vertical-align: top;
}
table.indextable dl, table.indextable dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {

View File

@@ -150,9 +150,14 @@ table.indextable td {
vertical-align: top;
}
table.indextable dl, table.indextable dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {

View File

@@ -150,9 +150,14 @@ table.indextable td {
vertical-align: top;
}
table.indextable dl, table.indextable dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {

View File

@@ -299,14 +299,21 @@ table.genindextable td {
width: 50%;
}
table.indextable dl dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
font-size: 11px;
}
table.indextable dl dd a {
table.indextable ul a {
color: #000;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
div.modindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;

View File

@@ -390,9 +390,14 @@ table.indextable td {
vertical-align: top;
}
table.indextable dl, table.indextable dd {
table.indextable ul {
margin-top: 0;
margin-bottom: 0;
list-style-type: none;
}
table.indextable > tbody > tr > td > ul {
padding-left: 0em;
}
table.indextable tr.pcap {

View File

@@ -302,7 +302,7 @@ HTML_XPATH = {
(".//a/strong", "[1]"),
(".//a/strong", "Other"),
(".//a", "entry"),
(".//dt/a", "double"),
(".//li/a", "double"),
],
'footnote.html': [
(".//a[@class='footnote-reference'][@href='#id7'][@id='id1']", r"\[1\]"),

View File

@@ -373,7 +373,10 @@ def test_html_builder(app, status, warning):
start_tag = "<%s[^>]*>" % tag
end_tag = "</%s>" % tag
return r"%s\s*%s\s*%s" % (start_tag, keyword, end_tag)
def wrap_nest(parenttag, childtag, keyword):
start_tag1 = "<%s[^>]*>" % parenttag
start_tag2 = "<%s[^>]*>" % childtag
return r"%s\s*%s\s*%s" % (start_tag1, keyword, start_tag2)
expected_exprs = [
wrap('a', 'NEWSLETTER'),
wrap('a', 'MAILING LIST'),
@@ -381,8 +384,8 @@ def test_html_builder(app, status, warning):
wrap('a', 'FIRST SECOND'),
wrap('a', 'SECOND THIRD'),
wrap('a', 'THIRD, FIRST'),
wrap('dt', 'ENTRY'),
wrap('dt', 'SEE'),
wrap_nest('li', 'ul', 'ENTRY'),
wrap_nest('li', 'ul', 'SEE'),
wrap('a', 'MODULE'),
wrap('a', 'KEYWORD'),
wrap('a', 'OPERATOR'),