diff --git a/CHANGES b/CHANGES index 7c09119b1..348f0023b 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,11 @@ Bugs fixed * applehelp: Sphinx crashes if ``hiutil`` or ``codesign`` commands not found * Fix ``make clean`` abort issue when build dir contains regular files like ``DS_Store``. +* Reduce epubcheck warnings/errors: + + * Fix DOCTYPE to html5 + * Change extension from .html to .xhtml. + * Disable search page on epub results Release 1.4.5 (released Jul 13, 2016) ===================================== diff --git a/doc/conf.py b/doc/conf.py index 753ffab4c..f3bf569f8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -47,7 +47,7 @@ epub_fix_images = False epub_max_image_width = 0 epub_show_urls = 'inline' epub_use_index = False -epub_guide = (('toc', 'contents.html', u'Table of Contents'),) +epub_guide = (('toc', 'contents.xhtml', u'Table of Contents'),) latex_documents = [('contents', 'sphinx.tex', 'Sphinx Documentation', 'Georg Brandl', 'manual', 1)] diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py index faa587a17..f0aa97277 100644 --- a/sphinx/builders/epub.py +++ b/sphinx/builders/epub.py @@ -113,7 +113,7 @@ COVER_TEMPLATE = u'''\ ''' -COVERPAGE_NAME = u'epub-cover.html' +COVERPAGE_NAME = u'epub-cover.xhtml' FILE_TEMPLATE = u'''\ +''' + LINK_TARGET_TEMPLATE = u' [%(uri)s]' FOOTNOTE_LABEL_TEMPLATE = u'#%d' @@ -143,7 +147,7 @@ GUIDE_TITLES = { } MEDIA_TYPES = { - '.html': 'application/xhtml+xml', + '.xhtml': 'application/xhtml+xml', '.css': 'text/css', '.png': 'image/png', '.gif': 'image/gif', @@ -185,6 +189,9 @@ class EpubBuilder(StandaloneHTMLBuilder): # don't add sidebar etc. embedded = True + # don't generate search index or include search page + search = False + mimetype_template = MIMETYPE_TEMPLATE container_template = CONTAINER_TEMPLATE toc_template = TOC_TEMPLATE @@ -198,6 +205,7 @@ class EpubBuilder(StandaloneHTMLBuilder): spine_template = SPINE_TEMPLATE guide_template = GUIDE_TEMPLATE toctree_template = TOCTREE_TEMPLATE + doctype = DOCTYPE link_target_template = LINK_TARGET_TEMPLATE css_link_target_class = CSS_LINK_TARGET_CLASS guide_titles = GUIDE_TITLES @@ -207,7 +215,8 @@ class EpubBuilder(StandaloneHTMLBuilder): def init(self): StandaloneHTMLBuilder.init(self) # the output files for epub must be .html only - self.out_suffix = '.html' + self.out_suffix = '.xhtml' + self.link_suffix = '.xhtml' self.playorder = 0 self.tocid = 0 @@ -277,7 +286,7 @@ class EpubBuilder(StandaloneHTMLBuilder): """ refnodes.insert(0, { 'level': 1, - 'refuri': self.esc(self.config.master_doc + '.html'), + 'refuri': self.esc(self.config.master_doc + self.out_suffix), 'text': ssp(self.esc( self.env.titles[self.config.master_doc].astext())) }) @@ -481,6 +490,7 @@ class EpubBuilder(StandaloneHTMLBuilder): """ if pagename.startswith('genindex'): self.fix_genindex(addctx['genindexentries']) + addctx['doctype'] = self.doctype StandaloneHTMLBuilder.handle_page(self, pagename, addctx, templatename, outfilename, event_arg) diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py index 0fd347735..c39d16f78 100644 --- a/sphinx/builders/epub3.py +++ b/sphinx/builders/epub3.py @@ -82,6 +82,9 @@ PACKAGE_DOC_TEMPLATE = u'''\ ''' +DOCTYPE = u''' +''' + # The epub3 publisher @@ -99,6 +102,7 @@ class Epub3Builder(EpubBuilder): navlist_template = NAVLIST_TEMPLATE navlist_indent = NAVLIST_INDENT content_template = PACKAGE_DOC_TEMPLATE + doctype = DOCTYPE # Finish by building the epub file def handle_finish(self): diff --git a/sphinx/themes/epub/layout.html b/sphinx/themes/epub/layout.html index bdbcec21d..541fcdba5 100644 --- a/sphinx/themes/epub/layout.html +++ b/sphinx/themes/epub/layout.html @@ -10,8 +10,7 @@ {%- extends "basic/layout.html" %} {%- block doctype -%} - +{{ doctype }} {%- endblock -%} {# add only basic navigation links #} {% block sidebar1 %}{% endblock %}