Skip to content

Commit bf63e8d

Browse files
Jon Wayne Parrottned-deily
Jon Wayne Parrott
authored andcommitted
bpo-30607: Use external python-doc-theme (GH-2017)
1 parent 5da8cfb commit bf63e8d

File tree

12 files changed

+80
-585
lines changed

12 files changed

+80
-585
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ matrix:
4949
- cd Doc
5050
# Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures.
5151
# (Updating the version is fine as long as no warnings are raised by doing so.)
52-
- python -m pip install sphinx~=1.6.1 blurb
52+
# The theme used by the docs is stored seperately, so we need to install that as well.
53+
- python -m pip install sphinx~=1.6.1 blurb python-docs-theme
5354
script:
5455
- make check suspicious html SPHINXOPTS="-q -W -j4"
5556
- os: osx

Doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ clean:
123123

124124
venv:
125125
$(PYTHON) -m venv $(VENVDIR)
126-
$(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb
126+
$(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb python-docs-theme
127127
@echo "The venv has been created in the $(VENVDIR) directory"
128128

129129
dist:

Doc/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ tree but are maintained separately and are available from
2020

2121
* `Sphinx <https://pypi.org/project/Sphinx/>`_
2222
* `blurb <https://pypi.org/project/blurb/>`_
23+
* `python-docs-theme <https://pypi.org/project/python-docs-theme/>`_
2324

2425
The easiest way to install these tools is to create a virtual environment and
2526
install the tools into there.
2627

27-
2828
Using make
2929
----------
3030

Doc/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@
4646
# -----------------------
4747

4848
# Use our custom theme.
49-
html_theme = 'pydoctheme'
49+
html_theme = 'python_docs_theme'
5050
html_theme_path = ['tools']
51-
html_theme_options = {'collapsiblesidebar': True}
51+
html_theme_options = {
52+
'collapsiblesidebar': True,
53+
'issues_url': 'https://docs.python.org/3/bugs.html',
54+
'root_include_title': False # We use the version switcher instead.
55+
}
5256

5357
# Short title used e.g. for <title> HTML tags.
5458
html_short_title = '%s Documentation' % release

Doc/tools/pydoctheme/static/pydoctheme.css

Lines changed: 0 additions & 194 deletions
This file was deleted.

Doc/tools/pydoctheme/theme.conf

Lines changed: 0 additions & 23 deletions
This file was deleted.

Doc/tools/static/changelog_search.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
$(document).ready(function() {
2+
// add the search form and bind the events
3+
$('h1').after([
4+
'<p>Filter entries by content:',
5+
'<input type="text" value="" id="searchbox" style="width: 50%">',
6+
'<input type="submit" id="searchbox-submit" value="Filter"></p>'
7+
].join('\n'));
8+
9+
function dofilter() {
10+
try {
11+
var query = new RegExp($('#searchbox').val(), 'i');
12+
}
13+
catch (e) {
14+
return; // not a valid regex (yet)
15+
}
16+
// find headers for the versions (What's new in Python X.Y.Z?)
17+
$('#changelog h2').each(function(index1, h2) {
18+
var h2_parent = $(h2).parent();
19+
var sections_found = 0;
20+
// find headers for the sections (Core, Library, etc.)
21+
h2_parent.find('h3').each(function(index2, h3) {
22+
var h3_parent = $(h3).parent();
23+
var entries_found = 0;
24+
// find all the entries
25+
h3_parent.find('li').each(function(index3, li) {
26+
var li = $(li);
27+
// check if the query matches the entry
28+
if (query.test(li.text())) {
29+
li.show();
30+
entries_found++;
31+
}
32+
else {
33+
li.hide();
34+
}
35+
});
36+
// if there are entries, show the section, otherwise hide it
37+
if (entries_found > 0) {
38+
h3_parent.show();
39+
sections_found++;
40+
}
41+
else {
42+
h3_parent.hide();
43+
}
44+
});
45+
if (sections_found > 0)
46+
h2_parent.show();
47+
else
48+
h2_parent.hide();
49+
});
50+
}
51+
$('#searchbox').keyup(dofilter);
52+
$('#searchbox-submit').click(dofilter);
53+
});

Doc/tools/static/copybutton.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

Doc/tools/static/py.png

-695 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)