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..67b349fc7 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',
@@ -198,6 +202,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 +212,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 +283,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 +487,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 %}