Merge pull request #2918 from shibukawa/fix/epub/errors

Fix resulting xhtml styles to improve epub-validator result.
This commit is contained in:
Takeshi KOMIYA 2016-09-02 00:22:12 +09:00 committed by GitHub
commit 7951909506
12 changed files with 59 additions and 7 deletions

View File

@ -41,7 +41,7 @@ Incompatible changes
* ``sphinx.ext.viewcode`` disabled on singlehtml builder. * ``sphinx.ext.viewcode`` disabled on singlehtml builder.
* Use make-mode of ``sphinx-quickstart`` by default. To disable this, use * Use make-mode of ``sphinx-quickstart`` by default. To disable this, use
``-M`` option ``-M`` option
* Fix ``genindex.html`` to satisfy xhtml standard. * Fix ``genindex.html``, Sphinx's document template, link address to itself to satisfy xhtml standard.
* Use epub3 builder by default. And the old epub builder is renamed to epub2. * Use epub3 builder by default. And the old epub builder is renamed to epub2.
* Fix ``epub`` and ``epub3`` builders that contained links to ``genindex`` even if ``epub_use_index = False``. * Fix ``epub`` and ``epub3`` builders that contained links to ``genindex`` even if ``epub_use_index = False``.
* `html_translator_class` is now deprecated. * `html_translator_class` is now deprecated.

View File

@ -46,15 +46,15 @@
<h2 style="margin-bottom: 0">{%trans%}Documentation{%endtrans%}</h2> <h2 style="margin-bottom: 0">{%trans%}Documentation{%endtrans%}</h2>
<table class="contentstable" align="center" style="margin-left: 30px"><tr> <table class="contentstable"><tr>
<td width="50%"> <td>
<p class="biglink"><a class="biglink" href="{{ pathto("tutorial") }}">{%trans%}First steps with Sphinx{%endtrans%}</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("tutorial") }}">{%trans%}First steps with Sphinx{%endtrans%}</a><br/>
<span class="linkdescr">{%trans%}overview of basic tasks{%endtrans%}</span></p> <span class="linkdescr">{%trans%}overview of basic tasks{%endtrans%}</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">{%trans%}Contents{%endtrans%}</a><br/> <p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">{%trans%}Contents{%endtrans%}</a><br/>
<span class="linkdescr">{%trans%}for a complete overview{%endtrans%}</span></p> <span class="linkdescr">{%trans%}for a complete overview{%endtrans%}</span></p>
</td><td width="50%"> </td><td>
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">{%trans%}Search page{%endtrans%}</a><br/> {%- if hasdoc('search') %}<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">{%trans%}Search page{%endtrans%}</a><br/>
<span class="linkdescr">{%trans%}search the documentation{%endtrans%}</span></p> <span class="linkdescr">{%trans%}search the documentation{%endtrans%}</span></p>{%- endif %}
{%- if hasdoc('genindex') %}<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">{%trans%}General Index{%endtrans%}</a><br/> {%- if hasdoc('genindex') %}<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">{%trans%}General Index{%endtrans%}</a><br/>
<span class="linkdescr">{%trans%}all functions, classes, terms{%endtrans%}</span></p>{%- endif %} <span class="linkdescr">{%trans%}all functions, classes, terms{%endtrans%}</span></p>{%- endif %}
</td></tr> </td></tr>

View File

@ -394,3 +394,9 @@ div.viewcode-block:target {
border-top: 1px solid #ac9; border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9; border-bottom: 1px solid #ac9;
} }
.contentstable {
margin-left: 30px;
margin: 0 auto;
table-layout: fixed;
}

View File

@ -188,6 +188,8 @@ class EpubBuilder(StandaloneHTMLBuilder):
# don't add links # don't add links
add_permalinks = False add_permalinks = False
# don't use # as current path. ePub check reject it.
allow_sharp_as_current_path = False
# don't add sidebar etc. # don't add sidebar etc.
embedded = True embedded = True
# disable download role # disable download role
@ -567,6 +569,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
self.files = [] self.files = []
self.ignored_files = ['.buildinfo', 'mimetype', 'content.opf', self.ignored_files = ['.buildinfo', 'mimetype', 'content.opf',
'toc.ncx', 'META-INF/container.xml', 'toc.ncx', 'META-INF/container.xml',
'Thumbs.db', 'ehthumbs.db', '.DS_Store',
self.config.epub_basename + '.epub'] + \ self.config.epub_basename + '.epub'] + \
self.config.epub_exclude_files self.config.epub_exclude_files
if not self.use_index: if not self.use_index:

View File

@ -82,6 +82,7 @@ class StandaloneHTMLBuilder(Builder):
'image/gif', 'image/jpeg'] 'image/gif', 'image/jpeg']
searchindex_filename = 'searchindex.js' searchindex_filename = 'searchindex.js'
add_permalinks = True add_permalinks = True
allow_sharp_as_current_path = True
embedded = False # for things like HTML help or Qt help: suppresses sidebar embedded = False # for things like HTML help or Qt help: suppresses sidebar
search = True # for things like HTML help and Apple help: suppress search search = True # for things like HTML help and Apple help: suppress search
download_support = True # enable download role download_support = True # enable download role
@ -786,6 +787,8 @@ class StandaloneHTMLBuilder(Builder):
elif not resource: elif not resource:
otheruri = self.get_target_uri(otheruri) otheruri = self.get_target_uri(otheruri)
uri = relative_uri(baseuri, otheruri) or '#' uri = relative_uri(baseuri, otheruri) or '#'
if uri == '#' and not self.allow_sharp_as_current_path:
uri = baseuri
return uri return uri
ctx['pathto'] = pathto ctx['pathto'] = pathto

View File

@ -487,6 +487,13 @@ img.toggler {
cursor: pointer; cursor: pointer;
} }
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- viewcode extension ---------------------------------------------------- */ /* -- viewcode extension ---------------------------------------------------- */
.viewcode-link { .viewcode-link {

View File

@ -30,7 +30,7 @@
{%- endfor %} {%- endfor %}
</div> </div>
<table class="indextable modindextable" cellspacing="0" cellpadding="2"> <table class="indextable modindextable">
{%- for letter, entries in content %} {%- for letter, entries in content %}
<tr class="pcap"><td></td><td>&#160;</td><td></td></tr> <tr class="pcap"><td></td><td>&#160;</td><td></td></tr>
<tr class="cap" id="cap-{{ letter }}"><td></td><td> <tr class="cap" id="cap-{{ letter }}"><td></td><td>

View File

@ -188,6 +188,13 @@ div.genindex-jumpbox {
padding: 0.4em; padding: 0.4em;
} }
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */ /* -- general body styles --------------------------------------------------- */
div.body p, div.body dd, div.body li, div.body blockquote { div.body p, div.body dd, div.body li, div.body blockquote {

View File

@ -175,6 +175,13 @@ img.toggler {
cursor: pointer; cursor: pointer;
} }
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */ /* -- general body styles --------------------------------------------------- */
a.headerlink { a.headerlink {

View File

@ -175,6 +175,13 @@ img.toggler {
cursor: pointer; cursor: pointer;
} }
/* -- domain module index --------------------------------------------------- */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* -- general body styles --------------------------------------------------- */ /* -- general body styles --------------------------------------------------- */
a.headerlink { a.headerlink {

View File

@ -326,6 +326,11 @@ table.modindextable {
border: none; border: none;
} }
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
table.modindextable img.toggler { table.modindextable img.toggler {
margin-right: 10px; margin-right: 10px;
} }

View File

@ -415,6 +415,13 @@ img.toggler {
cursor: pointer; cursor: pointer;
} }
/* :::: DOMAIN MODULE INDEX STYLES :::: */
table.modindextable td {
padding: 2px;
border-collapse: collapse;
}
/* :::: GLOBAL STYLES :::: */ /* :::: GLOBAL STYLES :::: */
p.subhead { p.subhead {