diff options
-rw-r--r-- | sphinx/builders/epub3.py | 9 | ||||
-rw-r--r-- | sphinx/themes/basic/layout.html | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py index a64493552..2ffc0ed7a 100644 --- a/sphinx/builders/epub3.py +++ b/sphinx/builders/epub3.py @@ -47,6 +47,11 @@ THEME_WRITING_MODES = { DOCTYPE = '''<!DOCTYPE html>''' +HTML_TAG = ( + u'<html xmlns="http://www.w3.org/1999/xhtml" ' + u'xmlns:epub="http://www.idpf.org/2007/ops">' +) + class Epub3Builder(_epub_base.EpubBuilder): """ @@ -60,6 +65,8 @@ class Epub3Builder(_epub_base.EpubBuilder): template_dir = path.join(package_dir, 'templates', 'epub3') doctype = DOCTYPE + html_tag = HTML_TAG + use_meta_charset = True # Finish by building the epub file def handle_finish(self): @@ -134,6 +141,8 @@ class Epub3Builder(_epub_base.EpubBuilder): writing_mode = self.config.epub_writing_mode self.globalcontext['theme_writing_mode'] = THEME_WRITING_MODES.get(writing_mode) + self.globalcontext['html_tag'] = self.html_tag + self.globalcontext['use_meta_charset'] = self.use_meta_charset def build_navlist(self, navnodes): # type: (List[nodes.Node]) -> List[NavPoint] diff --git a/sphinx/themes/basic/layout.html b/sphinx/themes/basic/layout.html index 4f1d71202..c7807b1cd 100644 --- a/sphinx/themes/basic/layout.html +++ b/sphinx/themes/basic/layout.html @@ -110,9 +110,17 @@ {%- endfor %} {%- endmacro %} +{%- if html_tag %} +{{ html_tag }} +{%- else %} <html xmlns="http://www.w3.org/1999/xhtml"{% if language is not none %} lang="{{ language }}"{% endif %}> +{%- endif %} <head> + {%- if use_meta_charset %} + <meta charset="{{ encoding }}" /> + {%- else %} <meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" /> + {%- endif %} {{ metatags }} {%- block htmltitle %} <title>{{ title|striptags|e }}{{ titlesuffix }}</title> |