mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
fix #2762: change html template for xhtml validation error (for epub)
This commit is contained in:
parent
868bb4b2a9
commit
76ff2c0135
@ -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]
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user