[MERGE] Forward port of 11.0 to 12.0
This commit is contained in:
commit
9ce3eedc65
@ -1,4 +1,6 @@
|
|||||||
{% extends "basic/layout.html" %}
|
{% extends "basic/layout.html" %}
|
||||||
|
{% set html5_doctype = True %}
|
||||||
|
|
||||||
{%- block scripts %}
|
{%- block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script type="text/javascript" src="{{ pathto('_static/jquery.min.js', 1) }}"></script>
|
<script type="text/javascript" src="{{ pathto('_static/jquery.min.js', 1) }}"></script>
|
||||||
@ -20,15 +22,6 @@
|
|||||||
{% set classes = classes + meta['classes'].split() %}
|
{% set classes = classes + meta['classes'].split() %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- block doctype -%}
|
|
||||||
<!doctype html>
|
|
||||||
{%- endblock -%}
|
|
||||||
{%- block htmltitle -%}
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
{{ super() }}
|
|
||||||
{%- endblock -%}
|
|
||||||
|
|
||||||
{%- block linktags -%}
|
{%- block linktags -%}
|
||||||
{% for code, url in language_codes %}
|
{% for code, url in language_codes %}
|
||||||
<link rel="alternate" hreflang="{{ code }}" href="{{ url }}" />
|
<link rel="alternate" hreflang="{{ code }}" href="{{ url }}" />
|
||||||
|
@ -32,10 +32,6 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
|
|||||||
html_subtitle = 'html_subtitle'
|
html_subtitle = 'html_subtitle'
|
||||||
|
|
||||||
# <meta> tags
|
# <meta> tags
|
||||||
meta = [
|
|
||||||
'<meta http-equiv="X-UA-Compatible" content="IE=edge">',
|
|
||||||
'<meta name="viewport" content="width=device-width, initial-scale=1">'
|
|
||||||
]
|
|
||||||
|
|
||||||
def __init__(self, builder, document):
|
def __init__(self, builder, document):
|
||||||
# order of parameter swapped between Sphinx 1.x and 2.x, check if
|
# 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)
|
super(BootstrapTranslator, self).__init__(document)
|
||||||
self.builder = builder
|
self.builder = builder
|
||||||
|
self.meta = [
|
||||||
|
'', '',
|
||||||
|
'\n <meta http-equiv="X-UA-Compatible" content="IE=edge">',
|
||||||
|
'\n <meta name="viewport" content="width=device-width, initial-scale=1">'
|
||||||
|
]
|
||||||
self.body = []
|
self.body = []
|
||||||
self.fragment = self.body
|
self.fragment = self.body
|
||||||
self.html_body = self.body
|
self.html_body = self.body
|
||||||
@ -74,6 +75,9 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
|
|||||||
0xa0: u' '
|
0xa0: u' '
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def add_meta(self, meta):
|
||||||
|
self.meta.append('\n ' + meta)
|
||||||
|
|
||||||
def starttag(self, node, tagname, **attributes):
|
def starttag(self, node, tagname, **attributes):
|
||||||
tagname = tagname.lower()
|
tagname = tagname.lower()
|
||||||
|
|
||||||
@ -130,6 +134,14 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
|
|||||||
def depart_document(self, node):
|
def depart_document(self, node):
|
||||||
pass
|
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):
|
def visit_section(self, node):
|
||||||
# close "parent" or preceding section, unless this is the opening of
|
# close "parent" or preceding section, unless this is the opening of
|
||||||
# the first section
|
# the first section
|
||||||
|
Loading…
Reference in New Issue
Block a user