forked from mgeier/insipid-sphinx-theme
/
layout.html
231 lines (199 loc) · 6.96 KB
/
layout.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
{%- extends "basic/layout.html" %}
{# Turn comma-separated list into proper list #}
{% if theme_left_buttons is string and theme_left_buttons %}
{% set theme_left_buttons = theme_left_buttons.split(',')|map('trim') %}
{% endif %}
{% if theme_right_buttons is string and theme_right_buttons %}
{% set theme_right_buttons = theme_right_buttons.split(',')|map('trim') %}
{% endif %}
{% macro stripsectionnumber(title) %}
{%- if title.startswith('<span class="section-number">') %}
{{- title.split('</span>', 1)|last }}
{%- else %}
{{- title }}
{%- endif %}
{%- endmacro %}
{# Remove section numbers from title/next/previous/up/breadcrumbs links #}
{% if theme_strip_section_numbers %}
{% set title = stripsectionnumber(title) %}
{% if next %}
{% set next = namespace(next) %}
{% set next.title = stripsectionnumber(next.title) %}
{% endif %}
{% if prev %}
{% set prev = namespace(prev) %}
{% set prev.title = stripsectionnumber(prev.title) %}
{% endif %}
{% set new_parents = [] %}
{% for parent in parents %}
{% set parent = namespace(parent) %}
{% set parent.title = stripsectionnumber(parent.title) %}
{# Dummy assignment to be able to call append() #}
{% set _dummy = new_parents.append(parent) %}
{% endfor %}
{% set parents = new_parents %}
{% endif %}
{% if sidebars and 'ethical-ad.html' not in sidebars %}
{# Dummy assignment to be able to call append() #}
{% set _dummy = sidebars.append('ethical-ad.html') %}
{% endif %}
{% block css %}
<link rel="stylesheet" href="{{ pathto('_static/basic.css', 1) }}" type="text/css" />
{{- super() }}
{%- if READTHEDOCS|tobool and render_sidebar %}
<link rel="stylesheet" href="{{ pathto('_static/insipid-sidebar-readthedocs.css', 1) }}" type="text/css" />
{%- endif %}
{%- endblock %}
{% block scripts %}
{{ super() }}
<script defer src="{{ pathto('_static/insipid.js', 1) }}"></script>
{%- if render_sidebar %}
<script defer src="{{ pathto('_static/insipid-sidebar.js', 1) }}"></script>
{%- endif %}
{%- endblock %}
{% block extrahead %}
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
{%- endblock %}
{% block body_tag %}
<body{% if render_sidebar %} class="sidebar-visible"{% endif %}>
{%- endblock %}
{% block header %}
<script type="text/javascript">
(function() {
var $body = $(document.body);
$body.addClass('js');
{%- if render_sidebar %}
$body.addClass('sidebar-resizing'); // avoid transitions on load
$body.removeClass('sidebar-visible');
try {
var sidebar = localStorage.getItem('sphinx-sidebar');
if (sidebar === 'visible') {
$body.addClass('sidebar-visible');
}
var sidebar_width = localStorage.getItem('sphinx-sidebar-width');
if (sidebar_width) {
$(':root').css('--sidebar-width', sidebar_width);
}
} catch(e) {
}
{%- if pagename == "search" %}
// hide sidebar on narrow screen
if ($body.css('overflow') === 'hidden') {
$body.removeClass('sidebar-visible');
}
{%- endif %}
{%- endif %}
})();
</script>
<header id="topbar-placeholder">
<div id="topbar">
<div id="titlebar">
<div class="buttons">
{%- if not theme_rightsidebar|tobool %}
{%- include 'sidebar-button.html' %}
{%- endif %}
{%- for buttontemplate in theme_left_buttons %}
{%- include buttontemplate %}
{%- endfor %}
</div>
<div class="title">
{%- if parents %}
<a class="parent" href="{{ parents[-1].link|e }}" {{ accesskey('U') }}>{{ parents[-1].title }}</a>
{%- elif pagename == master_doc %}
{#- NB: In the "singlehtml" builder docstitle is None #}
<span class="parent">{{ docstitle|e if docstitle != None else title|e }}</span>
{%- else %}
<a class="parent" href="{{ pathto(master_doc)|e }}" {{ accesskey('U') }}>{{ docstitle|e }}</a>
{%- endif %}
<a class="top" href="#">{{ title }}</a>
</div>
<div class="buttons">
{%- for buttontemplate in theme_right_buttons %}
{%- include buttontemplate %}
{%- endfor %}
{%- if theme_rightsidebar|tobool %}
{%- include 'sidebar-button.html' %}
{%- endif %}
</div>
</div>
{%- if pagename != "search" and 'searchbox.html' not in sidebars %}
<div id="searchbox" role="search">
<form id="search-form" class="search" style="display: none" action="{{ pathto('search') }}" method="get">
<input type="search" name="q" placeholder="{{ _('Search') + ' ...' }}" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
<button>{{ _('Go') }}</button>
</form>
</div>
{%- endif %}
</div>
</header>
{%- if theme_body_max_width != None %}
<nav>
{%- if prev %}
<a href="{{ prev.link|e }}" class="nav-icon previous" title="{{ _('previous') }}: {{ prev.title|striptags|e }}" aria-label="{{ _('Previous topic') }}" {{ accesskey('P') }} tabindex="-1">
{% include 'icons/angle-left.svg' %}
</a>
{%- endif %}
{%- if next %}
<a href="{{ next.link|e }}" class="nav-icon next" title="{{ _('next') }}: {{ next.title|striptags|e }}" aria-label="{{ _('Next topic') }}" {{ accesskey('N') }} tabindex="-1">
{% include 'icons/angle-right.svg' %}
</a>
{%- endif %}
</nav>
{%- endif %}
{%- endblock %}
{% macro insipid_relbar() %}
<nav class="relbar">
{%- if prev %}
<a class="previous" href="{{ prev.link|e }}" aria-label="{{ _('Previous topic') }}" {{ accesskey('P') }}>
<div class="icon">
{% include 'icons/arrow-left.svg' %}
</div>
<div class="title">
<span class="text">
<span class="direction">{{ _('previous') }}</span>
{{ prev.title }}
</span>
</div>
</a>
{%- endif %}
{%- if next %}
<a class="next" href="{{ next.link|e }}" aria-label="{{ _('Next topic') }}" {{ accesskey('N') }}>
<div class="title">
<span class="text">
<span class="direction">{{ _('next') }}</span>
{{ next.title }}
</span>
</div>
<div class="icon">
{% include 'icons/arrow-right.svg' %}
</div>
</a>
{%- endif %}
</nav>
{%- endmacro %}
{% block relbar1 %}
{{ insipid_relbar() }}
{%- endblock %}
{% block sidebar1 %}{% endblock %}
{% block sidebar2 %}{% endblock %}
{% block relbar2 %}
{{ insipid_relbar() }}
{%- endblock %}
{% block footer %}
{% if self.comments()|trim %}
<div class="articleComments">
{% block comments %}{% endblock %}
</div>
{% endif%}
{{ sidebar() }}
{% include 'footer.html' %}
{%- if render_sidebar %}
<div class="sidebar-resize-handle"></div>
<div id="overlay"></div>
{%- endif %}
{%- endblock %}
{% block sidebarlogo %}
{{ super() }}
<div class="sidebar-resize-handle"></div>
{% endblock %}