From 76ff2c01351a02b49b2941ab7c0984b31d051531 Mon Sep 17 00:00:00 2001 From: Yoshiki Shibukawa Date: Fri, 21 Apr 2017 12:48:25 +0900 Subject: [PATCH] fix #2762: change html template for xhtml validation error (for epub) --- sphinx/builders/epub3.py | 9 +++++++++ sphinx/themes/basic/layout.html | 8 ++++++++ 2 files changed, 17 insertions(+) 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 = '''''' +HTML_TAG = ( + u'' +) + 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 %} +{%- endif %} + {%- if use_meta_charset %} + + {%- else %} + {%- endif %} {{ metatags }} {%- block htmltitle %} {{ title|striptags|e }}{{ titlesuffix }}