Skip to content

Commit 6e10733

Browse files
authored
Jupyter Book v1 compatibility (#5)
* v0.6 prep * Dark mode
1 parent eaf1b7e commit 6e10733

File tree

9 files changed

+42
-25
lines changed

9 files changed

+42
-25
lines changed

.github/workflows/pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ on: push
33
jobs:
44
build-n-publish:
55
name: Build and publish Python 🐍 distributions 📦 to PyPI
6-
runs-on: ubuntu-18.04
6+
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@master
9-
- name: Set up Python 3.7
9+
- name: Set up Python 3.9
1010
uses: actions/setup-python@v1
1111
with:
12-
python-version: 3.7
12+
python-version: 3.9
1313
- name: Install build dependencies
1414
run: pip install wheel
1515
- name: Build a binary wheel and a source tarball distributions 📦

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include README.md
22
include LICENCE
33
include sphinx_prolog/_static/sphinx-prolog.css
4+
include sphinx_prolog/_static/jquery.js
45
include sphinx_prolog/_static/jquery-ui.min.css
56
include sphinx_prolog/_static/jquery-ui.min.js
67
include sphinx_prolog/_static/lpn.css

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
URL = 'https://github.com/simply-logical/{}'.format(DISTNAME)
2121
DOWNLOAD_URL = 'https://pypi.org/project/{}/#files'.format(DISTNAME)
2222
PYTHON_REQUIRES = '~=3.5' # Python 3.5 and up but not yet Python 4
23-
INSTALL_REQUIRES = ['docutils', 'pygments', 'sphinx>=3']
23+
INSTALL_REQUIRES = ['docutils', 'pygments', 'sphinx>=5']
2424
PACKAGES = find_packages(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests'])
2525
INCLUDE_PACKAGE_DATA = True
2626
ZIP_SAFE = False # We are using static files

sphinx_prolog/_static/jquery.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sphinx_prolog/_static/lpn.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
:root {
2+
color-scheme: light dark;
3+
}
4+
15
div.source {
26
position: relative;
37
margin: 10px 2ex;
4-
border: 1px solid #888;
5-
background-color: #eee;
8+
border: 1px solid light-dark(#888, #1d1d1d);
9+
background-color: light-dark(#eee, #242424);
610
padding: 4px 8px;
711
border-radius: 5px;
812
}
@@ -11,8 +15,8 @@ div.source {
1115
div.answer {
1216
position: relative;
1317
margin: 10px 2ex;
14-
border: 1px solid #888;
15-
background-color: #eee;
18+
border: 1px solid light-dark(#888, #1d1d1d);
19+
background-color: light-dark(#eee, #242424);
1620
padding: 4px 8px;
1721
border-radius: 5px;
1822
}

sphinx_prolog/_static/sphinx-prolog.css

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1+
/*
2+
Colours from:
3+
https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/styling.html
4+
https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/variables/_color.scss
5+
*/
6+
7+
:root {
8+
color-scheme: light dark;
9+
}
10+
111
/*Exercise directive*/
212
.admonition.exercise {
3-
border-color:#28a745;
13+
border-color: light-dark(#f66a0a, #ff9245);
414
}
515
.admonition.exercise .admonition-title {
6-
background-color: #f2fdf3;
16+
background-color: light-dark(#f8e3d0, #652a02);
717
}
8-
.admonition.exercise .admonition-title:before {
9-
color:#28a745;
18+
.admonition.exercise .admonition-title:after {
19+
color: light-dark(#f66a0a, #ff9245);
1020
content:"";
1121
}
1222
.admonition.exercise .admonition-title .solution-link {
13-
color:#ffc107;
23+
color: light-dark(#00843f, #5fb488);
1424
float: right;
15-
font-family: Font Awesome\ 5 Free;
25+
font-family: Font Awesome\ 6 Free;
1626
text-decoration: none;
1727
opacity:.3;
1828
}
@@ -23,19 +33,19 @@
2333

2434
/*Exercise solution directive*/
2535
.admonition.solution {
26-
border-color:#ffc107;
36+
border-color: light-dark(#00843f, #5fb488);
2737
}
2838
.admonition.solution .admonition-title {
29-
background-color: #fff6dd;
39+
background-color: light-dark(#d6ece1, #002f17);
3040
}
31-
.admonition.solution .admonition-title:before {
32-
color:#ffc107;
41+
.admonition.solution .admonition-title:after {
42+
color: light-dark(#00843f, #5fb488);
3343
content:"";
3444
}
3545
.admonition.solution .admonition-title .exercise-link {
36-
color:#28a745;
46+
color: light-dark(#f66a0a, #ff9245);
3747
float: right;
38-
font-family: Font Awesome\ 5 Free;
48+
font-family: Font Awesome\ 6 Free;
3949
text-decoration: none;
4050
opacity:.3;
4151
}

sphinx_prolog/infobox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def depart_infobox_title_node(self, node):
5050
5151
Overrides `Sphinx's HTML5 generator <https://github.com/sphinx-doc/sphinx/blob/68cc0f7e94f360a2c62ebcb761f8096e04ebf07f/sphinx/writers/html5.py#L362>`_.
5252
"""
53-
if (self.permalink_text and self.builder.add_permalinks
53+
if (self.config.html_permalinks and self.builder.add_permalinks
5454
and node.parent.hasattr('ids') and node.parent['ids']):
5555
self.add_permalink_ref(node.parent, 'Permalink to this infobox')
5656
else:

sphinx_prolog/solex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def depart_exercise_title_node(self, node):
221221
222222
Overrides `Sphinx's HTML5 generator <https://github.com/sphinx-doc/sphinx/blob/68cc0f7e94f360a2c62ebcb761f8096e04ebf07f/sphinx/writers/html5.py#L362>`_.
223223
"""
224-
if (self.permalink_text and self.builder.add_permalinks
224+
if (self.config.html_permalinks and self.builder.add_permalinks
225225
and node.parent.hasattr('ids') and node.parent['ids']):
226226
self.add_permalink_ref(node.parent, 'Permalink to this exercise')
227227
else:
@@ -496,7 +496,7 @@ def visit_solution_title_node(self, node):
496496

497497
def depart_solution_title_node(self, node):
498498
"""See the corresponding exercise function."""
499-
if (self.permalink_text and self.builder.add_permalinks
499+
if (self.config.html_permalinks and self.builder.add_permalinks
500500
and node.parent.hasattr('ids') and node.parent['ids']):
501501
self.add_permalink_ref(node.parent, 'Permalink to this solution')
502502
else:

sphinx_prolog/swish.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import sphinx_prolog
1818

19-
STATIC_CSS_FILES = ['sphinx-prolog.css', 'lpn.css', 'jquery-ui.min.css']
20-
STATIC_JS_FILES = ['lpn.js', 'jquery-ui.min.js']
19+
STATIC_CSS_FILES = ['jquery-ui.min.css', 'lpn.css', 'sphinx-prolog.css']
20+
STATIC_JS_FILES = ['jquery.js', 'jquery-ui.min.js', 'lpn.js']
2121
STATIC_FILES = (STATIC_CSS_FILES + STATIC_JS_FILES
2222
+ ['lpn/lpn-run.png', 'lpn/lpn-close.png'])
2323

0 commit comments

Comments
 (0)