layout.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. {# TEMPLATE VAR SETTINGS #}
  2. {%- set url_root = pathto('', 1) %}
  3. {%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
  4. {%- if not embedded and docstitle %}
  5. {%- set titlesuffix = " — "|safe + docstitle|e %}
  6. {%- else %}
  7. {%- set titlesuffix = "" %}
  8. {%- endif %}
  9. {%- set lang_attr = 'en' if language == None else (language | replace('_', '-')) %}
  10. {%- set sphinx_writer = 'writer-html5' if html5_doctype else 'writer-html4' -%}
  11. {# Build sphinx_version_info tuple from sphinx_version string in pure Jinja #}
  12. {%- set (_ver_major, _ver_minor, _ver_bugfix) = sphinx_version.split('.') | map('int') -%}
  13. {%- set sphinx_version_info = (_ver_major, _ver_minor, _ver_bugfix) -%}
  14. <!DOCTYPE html>
  15. <html class="{{ sphinx_writer }}" lang="{{ lang_attr }}" >
  16. <head>
  17. <meta charset="utf-8" />
  18. {{- metatags }}
  19. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  20. {%- block htmltitle %}
  21. <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
  22. {%- endblock -%}
  23. {#- CSS #}
  24. {%- if sphinx_version_info < (4, 0) -%}
  25. <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
  26. <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
  27. {%- endif %}
  28. {%- for css in css_files %}
  29. {%- if css|attr("rel") %}
  30. <link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
  31. {%- else %}
  32. <link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" />
  33. {%- endif %}
  34. {%- endfor %}
  35. {%- for cssfile in extra_css_files %}
  36. <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
  37. {%- endfor -%}
  38. {#- FAVICON #}
  39. {%- if favicon %}
  40. {%- if sphinx_version_info < (4, 0) -%}
  41. <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
  42. {%- else %}
  43. <link rel="shortcut icon" href="{{ favicon_url }}"/>
  44. {%- endif %}
  45. {%- endif -%}
  46. {#- CANONICAL URL (deprecated) #}
  47. {%- if theme_canonical_url and not pageurl %}
  48. <link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
  49. {%- endif -%}
  50. {#- CANONICAL URL #}
  51. {%- if pageurl %}
  52. <link rel="canonical" href="{{ pageurl|e }}" />
  53. {%- endif -%}
  54. {#- JAVASCRIPTS #}
  55. {%- block scripts %}
  56. <!--[if lt IE 9]>
  57. <script src="{{ pathto('_static/js/html5shiv.min.js', 1) }}"></script>
  58. <![endif]-->
  59. {%- if not embedded %}
  60. {# 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 #}
  61. {%- if sphinx_version_info >= (1, 8) -%}
  62. {%- if sphinx_version_info < (4, 0) -%}
  63. <script id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
  64. {%- endif -%}
  65. {%- for scriptfile in script_files %}
  66. {{ js_tag(scriptfile) }}
  67. {%- endfor %}
  68. {%- else %}
  69. <script>
  70. var DOCUMENTATION_OPTIONS = {
  71. URL_ROOT:'{{ url_root }}',
  72. VERSION:'{{ release|e }}',
  73. LANGUAGE:'{{ language }}',
  74. COLLAPSE_INDEX:false,
  75. FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
  76. HAS_SOURCE: {{ has_source|lower }},
  77. SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
  78. };
  79. </script>
  80. {%- for scriptfile in script_files %}
  81. <script src="{{ pathto(scriptfile, 1) }}"></script>
  82. {%- endfor %}
  83. {%- endif %}
  84. <script src="{{ pathto('_static/js/theme.js', 1) }}"></script>
  85. {#- OPENSEARCH #}
  86. {%- if use_opensearch %}
  87. <link rel="search" type="application/opensearchdescription+xml"
  88. title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
  89. href="{{ pathto('_static/opensearch.xml', 1) }}"/>
  90. {%- endif %}
  91. {%- endif %}
  92. {%- endblock %}
  93. {%- block linktags %}
  94. {%- if hasdoc('about') %}
  95. <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
  96. {%- endif %}
  97. {%- if hasdoc('genindex') %}
  98. <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
  99. {%- endif %}
  100. {%- if hasdoc('search') %}
  101. <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
  102. {%- endif %}
  103. {%- if hasdoc('copyright') %}
  104. <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
  105. {%- endif %}
  106. {%- if next %}
  107. <link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
  108. {%- endif %}
  109. {%- if prev %}
  110. <link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
  111. {%- endif %}
  112. {%- endblock %}
  113. {%- block extrahead %} {% endblock %}
  114. </head>
  115. <body class="wy-body-for-nav">
  116. {%- block extrabody %} {% endblock %}
  117. <div class="wy-grid-for-nav">
  118. {#- SIDE NAV, TOGGLES ON MOBILE #}
  119. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  120. <div class="wy-side-scroll">
  121. <div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
  122. {%- block sidebartitle %}
  123. {%- if logo and theme_logo_only %}
  124. <a href="{{ pathto(master_doc) }}">
  125. {%- else %}
  126. <a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}
  127. {%- endif %}
  128. {%- if logo %}
  129. {#- Not strictly valid HTML, but it's the only way to display/scale
  130. it properly, without weird scripting or heaps of work
  131. #}
  132. {%- if sphinx_version_info < (4, 0) -%}
  133. <img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
  134. {%- else %}
  135. <img src="{{ logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
  136. {%- endif %}
  137. {%- endif %}
  138. </a>
  139. {%- if theme_display_version %}
  140. {%- set nav_version = version %}
  141. {%- if READTHEDOCS and current_version %}
  142. {%- set nav_version = current_version %}
  143. {%- endif %}
  144. {%- if nav_version %}
  145. <div class="version">
  146. {{ nav_version }}
  147. </div>
  148. {%- endif %}
  149. {%- endif %}
  150. {%- include "searchbox.html" %}
  151. {%- endblock %}
  152. </div>
  153. {%- block navigation %}
  154. {#- Translators: This is an ARIA section label for the main navigation menu -#}
  155. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="{{ _('Navigation menu') }}">
  156. {%- block menu %}
  157. {%- set toctree = toctree(maxdepth=theme_navigation_depth|int,
  158. collapse=theme_collapse_navigation|tobool,
  159. includehidden=theme_includehidden|tobool,
  160. titles_only=theme_titles_only|tobool) %}
  161. {%- if toctree %}
  162. {{ toctree }}
  163. {%- else %}
  164. <!-- Local TOC -->
  165. <div class="local-toc">{{ toc }}</div>
  166. {%- endif %}
  167. {%- endblock %}
  168. </div>
  169. {%- endblock %}
  170. </div>
  171. </nav>
  172. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  173. {#- MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
  174. {#- Translators: This is an ARIA section label for the navigation menu that is visible when viewing the page on mobile devices -#}
  175. <nav class="wy-nav-top" aria-label="{{ _('Mobile navigation menu') }}" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
  176. {%- block mobile_nav %}
  177. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  178. <a href="{{ pathto(master_doc) }}">{{ project }}</a>
  179. {%- endblock %}
  180. </nav>
  181. <div class="wy-nav-content">
  182. {%- block content %}
  183. {%- if theme_style_external_links|tobool %}
  184. <div class="rst-content style-external-links">
  185. {%- else %}
  186. <div class="rst-content">
  187. {%- endif %}
  188. {% include "breadcrumbs.html" %}
  189. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  190. {%- block document %}
  191. <div itemprop="articleBody">
  192. {% block body %}{% endblock %}
  193. </div>
  194. {%- if self.comments()|trim %}
  195. <div class="articleComments">
  196. {%- block comments %}{% endblock %}
  197. </div>
  198. {%- endif%}
  199. </div>
  200. {%- endblock %}
  201. {% include "footer.html" %}
  202. </div>
  203. {%- endblock %}
  204. </div>
  205. </section>
  206. </div>
  207. {% include "versions.html" -%}
  208. <script>
  209. jQuery(function () {
  210. SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
  211. });
  212. </script>
  213. {#- Do not conflict with RTD insertion of analytics script #}
  214. {%- if not READTHEDOCS %}
  215. {%- if theme_analytics_id %}
  216. <!-- Theme Analytics -->
  217. <script async src="https://www.googletagmanager.com/gtag/js?id={{ theme_analytics_id }}"></script>
  218. <script>
  219. window.dataLayer = window.dataLayer || [];
  220. function gtag(){dataLayer.push(arguments);}
  221. gtag('js', new Date());
  222. gtag('config', '{{ theme_analytics_id }}', {
  223. 'anonymize_ip': {{ 'true' if theme_analytics_anonymize_ip|tobool else 'false' }},
  224. });
  225. </script>
  226. {%- endif %}
  227. {%- endif %}
  228. {%- block footer %} {% endblock %}
  229. </body>
  230. </html>