Skip to content

Commit b28b022

Browse files
bpo-41028: Doc: Move switchers to docsbuild-scripts. (GH-20969) (GH-30343)
(cherry picked from commit ee2549c) Co-authored-by: Julien Palard <[email protected]>
1 parent 17c858e commit b28b022

File tree

6 files changed

+16
-173
lines changed

6 files changed

+16
-173
lines changed

Doc/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ serve:
223223

224224
# for development releases: always build
225225
autobuild-dev:
226-
make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A switchers=1'
226+
make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
227227
-make suspicious
228228

229229
# for quick rebuilds (HTML only)
230230
autobuild-dev-html:
231-
make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A switchers=1'
231+
make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
232232

233233
# for stable releases: only build if not in pre-release stage (alpha, beta)
234234
# release candidate downloads are okay, since the stable tree can be in that stage

Doc/tools/static/switchers.js

-156
This file was deleted.

Doc/tools/templates/dummy.html

+9
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@
66
{% trans %}CPython implementation detail:{% endtrans %}
77
{% trans %}Deprecated since version {deprecated}, will be removed in version {removed}{% endtrans %}
88
{% trans %}Deprecated since version {deprecated}, removed in version {removed}{% endtrans %}
9+
10+
11+
In docsbuild-scripts, when rewriting indexsidebar.html with actual versions:
12+
13+
{% trans %}in development{% endtrans %}
14+
{% trans %}pre-release{% endtrans %}
15+
{% trans %}stable{% endtrans %}
16+
{% trans %}security-fixes{% endtrans %}
17+
{% trans %}EOL{% endtrans %}

Doc/tools/templates/indexsidebar.html

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ <h3>{% trans %}Download{% endtrans %}</h3>
22
<p><a href="{{ pathto('download') }}">{% trans %}Download these documents{% endtrans %}</a></p>
33
<h3>{% trans %}Docs by version{% endtrans %}</h3>
44
<ul>
5-
<li><a href="https://docs.python.org/3.10/">{% trans %}Python 3.10 (in development){% endtrans %}</a></li>
6-
<li><a href="https://docs.python.org/3.9/">{% trans %}Python 3.9 (pre-release){% endtrans %}</a></li>
7-
<li><a href="https://docs.python.org/3.8/">{% trans %}Python 3.8 (stable){% endtrans %}</a></li>
8-
<li><a href="https://docs.python.org/3.7/">{% trans %}Python 3.7 (stable){% endtrans %}</a></li>
9-
<li><a href="https://docs.python.org/3.6/">{% trans %}Python 3.6 (security-fixes){% endtrans %}</a></li>
10-
<li><a href="https://docs.python.org/2.7/">{% trans %}Python 2.7 (EOL){% endtrans %}</a></li>
5+
<li><a href="https://docs.python.org/">{% trans %}Stable{% endtrans %}</a></li>
6+
<li><a href="https://docs.python.org/dev/">{% trans %}In development{% endtrans %}</a></li>
117
<li><a href="https://www.python.org/doc/versions/">{% trans %}All versions{% endtrans %}</a></li>
128
</ul>
139

Doc/tools/templates/layout.html

+1-9
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,14 @@
1212

1313
{% block rootrellink %}
1414
{{ super() }}
15-
<li>
16-
{%- if switchers is defined %}
17-
<span class="language_switcher_placeholder">{{ language or 'en' }}</span>
18-
<span class="version_switcher_placeholder">{{ release }}</span>
19-
<a href="{{ pathto('index') }}">{% trans %}Documentation {% endtrans %}</a>{{ reldelim1 }}
20-
{%- else %}
15+
<li id="cpython-language-and-version">
2116
<a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
22-
{%- endif %}
2317
</li>
2418
{% endblock %}
2519

2620
{% block extrahead %}
2721
<link rel="canonical" href="https://docs.python.org/3/{{pagename}}.html" />
2822
{% if builder != "htmlhelp" %}
29-
{% if switchers is defined and not embedded %}
30-
<script type="text/javascript" src="{{ pathto('_static/switchers.js', 1) }}"></script>{% endif %}
3123
{% if pagename == 'whatsnew/changelog' and not embedded %}
3224
<script type="text/javascript" src="{{ pathto('_static/changelog_search.js', 1) }}"></script>{% endif %}
3325
{% endif %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Language and version switchers, previously maintained in every cpython
2+
branches, are now handled by docsbuild-script.

0 commit comments

Comments
 (0)