|
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 }}" > |
| 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" />
|
| 19 | + {%- if READTHEDOCS and not embedded %} |
| 20 | + <meta name="readthedocs-addons-api-version" content="1"> |
| 21 | + {%- endif %} |
20 | 22 | {{- metatags }}
|
21 | 23 | <meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
22 | 24 | {%- block htmltitle %}
|
23 | 25 | <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
|
24 | 26 | {%- endblock -%}
|
25 | 27 |
|
26 | 28 | {#- 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 |
| - {%- for css in css_files %} |
32 |
| - {%- if css|attr("rel") %} |
33 |
| - <link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} /> |
| 29 | + {%- for css_file in css_files %} |
| 30 | + {%- if css_file|attr("filename") %} |
| 31 | + {{ css_tag(css_file) }} |
34 | 32 | {%- else %}
|
35 |
| - <link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" /> |
| 33 | + <link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" /> |
36 | 34 | {%- endif %}
|
37 | 35 | {%- endfor %}
|
38 | 36 |
|
39 |
| - {%- for cssfile in extra_css_files %} |
40 |
| - <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" /> |
| 37 | + {# |
| 38 | + "extra_css_files" is an undocumented Read the Docs theme specific option. |
| 39 | + There is no need to check for ``|attr("filename")`` here because it's always a string. |
| 40 | + Note that this option should be removed in favor of regular ``html_css_files``: |
| 41 | + https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files |
| 42 | + #} |
| 43 | + {%- for css_file in extra_css_files %} |
| 44 | + <link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" /> |
41 | 45 | {%- endfor -%}
|
42 | 46 |
|
43 | 47 | {#- FAVICON #}
|
44 |
| - {%- if favicon %} |
45 |
| - {%- if sphinx_version_info < (4, 0) -%} |
46 |
| - <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/> |
47 |
| - {%- else %} |
| 48 | + {%- if favicon_url %} |
48 | 49 | <link rel="shortcut icon" href="{{ favicon_url }}"/>
|
49 |
| - {%- endif %} |
50 |
| - {%- endif -%} |
| 50 | + {%- endif %} |
51 | 51 |
|
52 | 52 | {#- CANONICAL URL (deprecated) #}
|
53 | 53 | {%- if theme_canonical_url and not pageurl %}
|
|
61 | 61 |
|
62 | 62 | {#- JAVASCRIPTS #}
|
63 | 63 | {%- block scripts %}
|
64 |
| - <!--[if lt IE 9]> |
65 |
| - <script src="{{ pathto('_static/js/html5shiv.min.js', 1) }}"></script> |
66 |
| - <![endif]--> |
67 | 64 | {%- if not embedded %}
|
68 |
| - {# 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 #} |
69 |
| - {%- if sphinx_version_info >= (1, 8) -%} |
70 |
| - {%- if sphinx_version_info < (4, 0) -%} |
71 |
| - <script id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script> |
72 |
| - {%- endif -%} |
73 |
| - {%- for scriptfile in script_files %} |
74 |
| - {{ js_tag(scriptfile) }} |
75 |
| - {%- endfor %} |
76 |
| - {%- else %} |
77 |
| - <script> |
78 |
| - var DOCUMENTATION_OPTIONS = { |
79 |
| - URL_ROOT:'{{ url_root }}', |
80 |
| - VERSION:'{{ release|e }}', |
81 |
| - LANGUAGE:'{{ language }}', |
82 |
| - COLLAPSE_INDEX:false, |
83 |
| - FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}', |
84 |
| - HAS_SOURCE: {{ has_source|lower }}, |
85 |
| - SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}' |
86 |
| - }; |
87 |
| - </script> |
88 |
| - {%- for scriptfile in script_files %} |
89 |
| - <script src="{{ pathto(scriptfile, 1) }}"></script> |
90 |
| - {%- endfor %} |
91 |
| - {%- endif %} |
| 65 | + {%- for scriptfile in script_files %} |
| 66 | + {{ js_tag(scriptfile) }} |
| 67 | + {%- endfor %} |
92 | 68 | <script src="{{ pathto('_static/js/theme.js', 1) }}"></script>
|
93 | 69 |
|
| 70 | + {%- if READTHEDOCS or DEBUG %} |
| 71 | + <script src="{{ pathto('_static/js/versions.js', 1) }}"></script> |
| 72 | + {%- endif %} |
| 73 | + |
94 | 74 | {#- OPENSEARCH #}
|
95 | 75 | {%- if use_opensearch %}
|
96 | 76 | <link rel="search" type="application/opensearchdescription+xml"
|
|
133 | 113 | <div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
|
134 | 114 | {%- block sidebartitle %}
|
135 | 115 |
|
136 |
| - {%- if logo and theme_logo_only %} |
137 |
| - <a href="{{ pathto(master_doc) }}"> |
138 |
| - {%- else %} |
139 |
| - <a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }} |
140 |
| - {%- endif %} |
141 |
| - |
142 |
| - {%- if logo %} |
143 |
| - {#- Not strictly valid HTML, but it's the only way to display/scale |
144 |
| - it properly, without weird scripting or heaps of work |
145 |
| - #} |
146 |
| - {%- if sphinx_version_info < (4, 0) -%} |
147 |
| - <img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/> |
148 |
| - {%- else %} |
149 |
| - <img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/> |
| 116 | + {# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #} |
| 117 | + {# the master_doc variable was renamed to root_doc in Sphinx 4 (master_doc still exists in later Sphinx versions) #} |
| 118 | + {%- set _logo_url = logo_url|default(pathto('_static/' + (logo or ""), 1)) %} |
| 119 | + {%- set _root_doc = root_doc|default(master_doc) %} |
| 120 | + <a href="{{ pathto(_root_doc) }}"{% if not theme_logo_only %} class="icon icon-home"{% endif %}> |
| 121 | + {% if not theme_logo_only %}{{ project }}{% endif %} |
| 122 | + {%- if logo or logo_url %} |
| 123 | + <img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}"/> |
150 | 124 | {%- endif %}
|
151 |
| - {%- endif %} |
152 | 125 | </a>
|
153 | 126 |
|
154 |
| - {%- if theme_display_version %} |
155 |
| - {%- set nav_version = version %} |
156 |
| - {%- if READTHEDOCS and current_version %} |
157 |
| - {%- set nav_version = current_version %} |
158 |
| - {%- endif %} |
159 |
| - {%- if nav_version %} |
160 |
| - <div class="version"> |
161 |
| - {{ nav_version }} |
| 127 | + {%- if READTHEDOCS or DEBUG %} |
| 128 | + {%- if theme_version_selector or theme_language_selector %} |
| 129 | + <div class="switch-menus"> |
| 130 | + <div class="version-switch"></div> |
| 131 | + <div class="language-switch"></div> |
162 | 132 | </div>
|
163 | 133 | {%- endif %}
|
164 | 134 | {%- endif %}
|
|
0 commit comments