|
7 | 7 | {%- set titlesuffix = "" %} |
8 | 8 | {%- endif %} |
9 | 9 | {%- set lang_attr = 'en' if language == None else (language | replace('_', '-')) %} |
10 | | -{%- set sphinx_writer = 'writer-html5' if html5_doctype else 'writer-html4' -%} |
11 | 10 |
|
12 | 11 | {# Build sphinx_version_info tuple from sphinx_version string in pure Jinja #} |
13 | 12 | {%- set (_ver_major, _ver_minor) = (sphinx_version.split('.') | list)[:2] | map('int') -%} |
14 | 13 | {%- set sphinx_version_info = (_ver_major, _ver_minor, -1) -%} |
15 | 14 |
|
16 | 15 | <!DOCTYPE html> |
17 | | -<html class="{{ sphinx_writer }}" lang="{{ lang_attr }}"{% if sphinx_version_info >= (7, 2) %} data-content_root="{{ content_root }}"{% endif %}> |
| 16 | +<html class="writer-html5" lang="{{ lang_attr }}"{% if sphinx_version_info >= (7, 2) %} data-content_root="{{ content_root }}"{% endif %}> |
18 | 17 | <head> |
19 | 18 | <meta charset="utf-8" /> |
20 | 19 | {{- metatags }} |
|
24 | 23 | {%- endblock -%} |
25 | 24 |
|
26 | 25 | {#- CSS #} |
27 | | - {%- if sphinx_version_info < (4, 0) -%} |
28 | | - <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" /> |
29 | | - <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> |
30 | | - {%- endif %} |
31 | 26 | {%- for css_file in css_files %} |
32 | 27 | {%- if css_file|attr("filename") %} |
33 | 28 | {{ css_tag(css_file) }} |
|
36 | 31 | {%- endif %} |
37 | 32 | {%- endfor %} |
38 | 33 |
|
39 | | - {# "extra_css_files" is a theme option and it's always a string #} |
| 34 | + {# |
| 35 | + "extra_css_files" is an undocumented Read the Docs theme specific option. |
| 36 | + There is no need to check for ``|attr("filename")`` here because it's always a string. |
| 37 | + Note that this option should be removed in favor of regular ``html_css_files``: |
| 38 | + https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files |
| 39 | + #} |
40 | 40 | {%- for css_file in extra_css_files %} |
41 | 41 | <link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" /> |
42 | 42 | {%- endfor -%} |
43 | 43 |
|
44 | | - {#- FAVICON |
45 | | - favicon_url is the only context var necessary since Sphinx 4. |
46 | | - In Sphinx<4, we use favicon but need to prepend path info. |
47 | | - #} |
48 | | - {%- set _favicon_url = favicon_url | default(pathto('_static/' + (favicon or ""), 1)) %} |
49 | | - {%- if favicon_url or favicon %} |
50 | | - <link rel="shortcut icon" href="{{ _favicon_url }}"/> |
| 44 | + {#- FAVICON #} |
| 45 | + {%- if favicon_url %} |
| 46 | + <link rel="shortcut icon" href="{{ favicon_url }}"/> |
51 | 47 | {%- endif %} |
52 | 48 |
|
53 | 49 | {#- CANONICAL URL (deprecated) #} |
|
66 | 62 | <script src="{{ pathto('_static/js/html5shiv.min.js', 1) }}"></script> |
67 | 63 | <![endif]--> |
68 | 64 | {%- if not embedded %} |
69 | | - {# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #} |
70 | | - {%- if sphinx_version_info >= (1, 8) -%} |
71 | | - {%- if sphinx_version_info < (4, 0) -%} |
72 | | - <script id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script> |
73 | | - {%- endif -%} |
74 | | - {%- for scriptfile in script_files %} |
75 | | - {{ js_tag(scriptfile) }} |
76 | | - {%- endfor %} |
77 | | - {%- else %} |
78 | | - <script> |
79 | | - var DOCUMENTATION_OPTIONS = { |
80 | | - URL_ROOT:'{{ url_root }}', |
81 | | - VERSION:'{{ release|e }}', |
82 | | - LANGUAGE:'{{ language }}', |
83 | | - COLLAPSE_INDEX:false, |
84 | | - FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}', |
85 | | - HAS_SOURCE: {{ has_source|lower }}, |
86 | | - SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}' |
87 | | - }; |
88 | | - </script> |
89 | | - {%- for scriptfile in script_files %} |
90 | | - <script src="{{ pathto(scriptfile, 1) }}"></script> |
91 | | - {%- endfor %} |
92 | | - {%- endif %} |
| 65 | + {%- for scriptfile in script_files %} |
| 66 | + {{ js_tag(scriptfile) }} |
| 67 | + {%- endfor %} |
93 | 68 | <script src="{{ pathto('_static/js/theme.js', 1) }}"></script> |
94 | 69 |
|
95 | 70 | {#- OPENSEARCH #} |
|
0 commit comments