diff --git a/_extensions/odoo/layout.html b/_extensions/odoo/layout.html index a61c2eef9..5d79ea08f 100644 --- a/_extensions/odoo/layout.html +++ b/_extensions/odoo/layout.html @@ -1,4 +1,6 @@ {% extends "basic/layout.html" %} +{% set html5_doctype = True %} + {%- block scripts %} {{ super() }} @@ -20,15 +22,6 @@ {% set classes = classes + meta['classes'].split() %} {% endif %} -{%- block doctype -%} - -{%- endblock -%} -{%- block htmltitle -%} - - - {{ super() }} -{%- endblock -%} - {%- block linktags -%} {% for code, url in language_codes %} diff --git a/_extensions/odoo/translator.py b/_extensions/odoo/translator.py index beac304ff..b2579ec4c 100644 --- a/_extensions/odoo/translator.py +++ b/_extensions/odoo/translator.py @@ -32,10 +32,6 @@ class BootstrapTranslator(nodes.NodeVisitor, object): html_subtitle = 'html_subtitle' # tags - meta = [ - '', - '' - ] def __init__(self, builder, document): # order of parameter swapped between Sphinx 1.x and 2.x, check if @@ -45,6 +41,11 @@ class BootstrapTranslator(nodes.NodeVisitor, object): super(BootstrapTranslator, self).__init__(document) self.builder = builder + self.meta = [ + '', '', + '\n ', + '\n ' + ] self.body = [] self.fragment = self.body self.html_body = self.body @@ -74,6 +75,9 @@ class BootstrapTranslator(nodes.NodeVisitor, object): 0xa0: u' ' }) + def add_meta(self, meta): + self.meta.append('\n ' + meta) + def starttag(self, node, tagname, **attributes): tagname = tagname.lower() @@ -130,6 +134,14 @@ class BootstrapTranslator(nodes.NodeVisitor, object): def depart_document(self, node): pass + def visit_meta(self, node): + if node.hasattr('lang'): + node['xml:lang'] = node['lang'] + meta = self.starttag(node, 'meta', **node.non_default_attributes()) + self.add_meta(meta) + def depart_meta(self, node): + pass + def visit_section(self, node): # close "parent" or preceding section, unless this is the opening of # the first section