Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/dedent-1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf authored Dec 23, 2024
2 parents 69c40f9 + 2732526 commit 734a5ff
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import os
from urllib.request import urlopen
from pathlib import Path
from datetime import datetime

project = "Sphinx Book Theme"
copyright = "2023"
copyright = str(datetime.now().year)
author = "the Executable Book Project"
# language = "fr" # For testing language translations

Expand Down
7 changes: 4 additions & 3 deletions docs/content/notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ print("this works for code cells too, if you add a `margin` tag to them")
```{code-cell} ipython3
# You can also include enriched outputs like Math
from IPython.display import Math
Math("\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}")
Math(r"\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}")
```

## Removing content before publishing
Expand Down Expand Up @@ -171,6 +171,7 @@ See [the Pandas Styling docs](https://pandas.pydata.org/pandas-docs/stable/user_
:tags: [hide-input]
import pandas as pd
from pandas.io.formats.style import Styler
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
Expand All @@ -195,8 +196,8 @@ def highlight_max(s):
is_max = s == s.max()
return ['background-color: yellow' if v else '' for v in is_max]
df.style.\
applymap(color_negative_red).\
Styler(df, uuid="1").\
map(color_negative_red).\
apply(highlight_max).\
set_table_attributes('style="font-size: 10px"')
```
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/kitchen-sink/generic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Licensed under Creative Commons Attribution-ShareAlike 4.0 International License
SPDX-License-Identifier: CC-BY-SA-4.0
.. |EXAMPLE| image:: https://source.unsplash.com/32x32/daily?icon
.. |EXAMPLE| image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:width: 1em

=============
Expand Down Expand Up @@ -110,7 +110,7 @@ Sidebar

Lorem ipsum dolor sit amet consectetur adipisicing elit.

.. image:: https://source.unsplash.com/200x200/daily?cute+puppy
.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg

Lorem ipsum dolor sit amet consectetur adipisicing elit.

Expand Down Expand Up @@ -268,4 +268,4 @@ voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam.
Download Links
==============

:download:`This long long long long long long long long long long long long long long long download link should wrap white-spaces <https://source.unsplash.com/200x200/daily?cute+puppy>`
:download:`This long long long long long long long long long long long long long long long download link should wrap white-spaces <https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg>`
14 changes: 7 additions & 7 deletions docs/reference/kitchen-sink/images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ Images

An image:

.. image:: https://source.unsplash.com/200x200/daily?cute+puppy
.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:height: 200
:width: 200

A clickable image:

.. image:: https://source.unsplash.com/200x200/daily?cute+puppy
:target: https://unsplash.com/
.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:target: https://jupyter.org/
:height: 200
:width: 200

.. image:: https://source.unsplash.com/200x200/daily?cute+puppy
.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:align: right
:height: 200
:width: 200
Expand All @@ -43,7 +43,7 @@ sapiente veritatis doloribus accusantium molestiae modi recusandae
excepturi facere, corrupti expedita sit nihil temporibus eius sequi
animi, illo libero labore fuga.

.. image:: https://source.unsplash.com/200x200/daily?cute+puppy
.. image:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:align: left
:height: 200
:width: 200
Expand All @@ -66,7 +66,7 @@ animi, illo libero labore fuga.
Figures
-------

.. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
.. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:alt: reStructuredText, the markup syntax

A figure is an image with a caption and/or a legend:
Expand All @@ -83,7 +83,7 @@ Figures

A figure directive with center alignment

.. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
.. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:align: center

This caption should be centered.
4 changes: 2 additions & 2 deletions docs/reference/kitchen-sink/lists.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ Hlists
.. hlist::
:columns: 2

- .. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
- .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg

This is a short caption for a figure.

- .. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
- .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg

This is a long caption for a figure. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec porttitor dolor in odio posuere, vitae ornare libero mattis. In lobortis justo vestibulum nibh aliquet, non.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/kitchen-sink/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ luctus efficitur arcu. Cras ut dictum mi. Nulla congue interdum lorem, semper se
Document Subsection
-------------------

.. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
.. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg
:align: right
:figwidth: 200px

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/kitchen-sink/tables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ List Tables

.. list-table:: This is a list table with images in it.

* - .. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
* - .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg

This is a short caption for a figure.

- .. figure:: https://source.unsplash.com/200x200/daily?cute+puppy
- .. figure:: https://jupyter.org/assets/logos/rectanglelogo-greytext-orangebody-greymoons.svg

This is a long caption for a figure. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec porttitor dolor in odio posuere, vitae ornare libero mattis. In lobortis justo vestibulum nibh aliquet, non.
13 changes: 10 additions & 3 deletions docs/reference/notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ It also has a `thebe-init` tag which means it will be executed when you initiali
# Generate some code that we'll use later on in the page
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
```

### Hide inputs
Expand All @@ -45,6 +47,7 @@ ax.imshow(square)
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

### Hide outputs
Expand All @@ -61,6 +64,7 @@ ax.imshow(square)
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

### Hide markdown
Expand Down Expand Up @@ -93,6 +97,7 @@ ax.imshow(square)
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

### Hide the whole cell
Expand All @@ -108,6 +113,7 @@ ax.imshow(square)
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

## Enriched outputs
Expand All @@ -117,7 +123,7 @@ ax.imshow(wide)
```{code-cell} ipython3
# You can also include enriched outputs like Math
from IPython.display import Math
Math("\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}")
Math(r"\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}")
```

### Pandas DataFrames
Expand All @@ -136,6 +142,7 @@ Styled DataFrames (see [the Pandas Styling docs](https://pandas.pydata.org/panda
:tags: [hide-input]
import pandas as pd
from pandas.io.formats.style import Styler
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
Expand All @@ -160,8 +167,8 @@ def highlight_max(s):
is_max = s == s.max()
return ['background-color: yellow' if v else '' for v in is_max]
df.style.\
applymap(color_negative_red).\
Styler(df, uuid="1").\
map(color_negative_red).\
apply(highlight_max).\
set_table_attributes('style="font-size: 10px"')
```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/special-theme-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ through and see how things look!
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
square = np.random.randn(100, 100)
wide = np.random.randn(100, 1000)
```
Expand All @@ -41,6 +43,7 @@ wide = np.random.randn(100, 1000)
## A full-width square figure
fig, ax = plt.subplots()
ax.imshow(square)
plt.show()
```

```{code-cell} ipython3
Expand All @@ -49,12 +52,14 @@ ax.imshow(square)
## A full-width wide figure
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

```{code-cell} ipython3
# Now here's the same figure at regular width
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

### Markdown
Expand Down Expand Up @@ -194,6 +199,7 @@ Let's see what happens
## code cell in the margin with output
fig, ax = plt.subplots()
ax.imshow(wide)
plt.show()
```

````{margin}
Expand Down
2 changes: 1 addition & 1 deletion src/sphinx_book_theme/_compile_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def convert_json(folder=None):
out_folder = folder / ".." / ".." / "theme" / "sphinx_book_theme" / "static"

# compile po
for path in (folder / "jsons").glob("*.json"):
for path in sorted((folder / "jsons").glob("*.json")):
data = json.loads(path.read_text("utf8"))
assert data[0]["symbol"] == "en"
english = data[0]["text"]
Expand Down
2 changes: 1 addition & 1 deletion src/sphinx_book_theme/assets/translations/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Translation workflow

This folder contains code and translations for supporting multiple languages with Sphinx.
See [the Sphinx internationalization documentation](https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-internationalization) for more details.
See [the Sphinx internationalization documentation](https://www.sphinx-doc.org/en/master/usage/configuration.html) for more details.

## Structure of translation files

Expand Down

0 comments on commit 734a5ff

Please sign in to comment.