Skip to content

Commit 0711d15

Browse files
authored
Up/down chevrons and "expand"/"collapse" for Sphinx-togglebutton (#1605)
* Up/down chevrons and "expand"/"collapse" text for Sphinx-togglebutton * Add translation strings
1 parent 78e4b5b commit 0711d15

File tree

9 files changed

+438
-350
lines changed

9 files changed

+438
-350
lines changed

babel.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# See https://github.com/sphinx-doc/sphinx/blob/6.1.x/babel.cfg
1+
# See https://github.com/python-babel/babel/blob/2a1709a7768f6f07c3d2dbfdb03d3c8a6bd80aef/docs/messages.rst#extraction-method-mapping-and-configuration
2+
[python: **.py]
23
[jinja2: **.html]
34
encoding = utf-8
45
ignore_tags = script,style

docs/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import pydata_sphinx_theme
1515
from sphinx.application import Sphinx
16+
from sphinx.locale import _
1617

1718
sys.path.append(str(Path(".").resolve()))
1819

@@ -89,6 +90,11 @@
8990
"jupyter": ("Jupyter", "https://jupyter.org"),
9091
}
9192

93+
# -- sphinx_togglebutton options ---------------------------------------------
94+
togglebutton_hint = str(_("Click to expand"))
95+
togglebutton_hint_hide = str(_("Click to collapse"))
96+
97+
9298
# -- Options for HTML output -------------------------------------------------
9399

94100
html_theme = "pydata_sphinx_theme"

src/pydata_sphinx_theme/assets/styles/extensions/_togglebutton.scss

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,32 @@
33
*/
44

55
.bd-content {
6+
@mixin chevron-down {
7+
.toggle-chevron-right {
8+
transform: rotate(90deg); // point chevron down
9+
transition: none; // match non-animated behavior of other chevrons on site
10+
}
11+
}
12+
13+
@mixin chevron-up {
14+
.toggle-chevron-right {
15+
transform: rotate(-90deg); // point chevron down
16+
transition: none; // match non-animated behavior of other chevrons on site
17+
}
18+
}
19+
620
// Admonition toggles
721
.admonition {
822
button.toggle-button {
923
color: inherit;
24+
25+
// When disclosure widget is closed
26+
&.toggle-button-hidden {
27+
@include chevron-down;
28+
}
29+
30+
// When open
31+
@include chevron-up;
1032
}
1133

1234
// Focus ring
@@ -52,12 +74,18 @@
5274
// Over-ride border color to re-use our primary color
5375
summary {
5476
border-left: 3px solid var(--pst-color-primary);
77+
78+
@include chevron-down;
5579
}
5680

5781
// When expanded, sharpen the bottom left and right corners of the focus ring
58-
&[open] :focus-visible {
59-
border-bottom-left-radius: 0;
60-
border-bottom-right-radius: 0;
82+
&[open] {
83+
@include chevron-up;
84+
85+
:focus-visible {
86+
border-bottom-left-radius: 0;
87+
border-bottom-right-radius: 0;
88+
}
6189
}
6290
}
6391
}

src/pydata_sphinx_theme/locale/ca/LC_MESSAGES/sphinx.po

Lines changed: 70 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
11
# English translations for pydata-sphinx-theme.
22
# Copyright (C) 2023 PyData developers
3-
# This file is distributed under the same license as the pydata-sphinx-theme project.
4-
#
3+
# This file is distributed under the same license as the pydata-sphinx-theme
4+
# project.
5+
#
56
# Translators:
67
# Oriol Abril-Pla <[email protected]>, 2023
7-
#
88
msgid ""
99
msgstr ""
1010
"Project-Id-Version: PROJECT VERSION\n"
1111
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
12-
"POT-Creation-Date: 2023-02-16 14:32-0500\n"
12+
"POT-Creation-Date: 2023-12-21 08:09-0700\n"
1313
"PO-Revision-Date: 2023-04-14 14:57+0000\n"
1414
"Last-Translator: Oriol Abril-Pla <[email protected]>, 2023\n"
15-
"Language-Team: Catalan (https://app.transifex.com/12rambau/teams/166811/ca/)\n"
16-
"MIME-Version: 1.0\n"
17-
"Content-Type: text/plain; charset=UTF-8\n"
18-
"Content-Transfer-Encoding: 8bit\n"
19-
"Generated-By: Babel 2.11.0\n"
2015
"Language: ca\n"
16+
"Language-Team: Catalan "
17+
"(https://app.transifex.com/12rambau/teams/166811/ca/)\n"
2118
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19+
"MIME-Version: 1.0\n"
20+
"Content-Type: text/plain; charset=utf-8\n"
21+
"Content-Transfer-Encoding: 8bit\n"
22+
"Generated-By: Babel 2.13.0\n"
23+
24+
#: docs/conf.py:94
25+
msgid "Click to expand"
26+
msgstr ""
27+
28+
#: docs/conf.py:95
29+
msgid "Click to collapse"
30+
msgstr ""
2231

23-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html:50
32+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html:53
2433
msgid "Skip to main content"
2534
msgstr "Salta al contingut principal"
2635

27-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html:7
36+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html:64
37+
msgid "Back to top"
38+
msgstr ""
39+
40+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button-field.html:5
41+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button-field.html:7
42+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html:5
2843
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/search.html:5
2944
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/search.html:28
3045
msgid "Search"
@@ -38,93 +53,89 @@ msgstr "Error"
3853
msgid "Please activate JavaScript to enable the search functionality."
3954
msgstr "Activeu JavaScript per habilitar la funcionalitat de cerca."
4055

41-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:12
42-
msgid "Breadcrumbs"
43-
msgstr "Rutes de navegació"
44-
4556
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:13
4657
msgid "Breadcrumb"
4758
msgstr "Ruta de navegació"
4859

49-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:16
60+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:17
5061
msgid "Home"
5162
msgstr "Inici"
5263

53-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/copyright.html:4
64+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/copyright.html:5
5465
#, python-format
5566
msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s."
5667
msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s."
5768

58-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/copyright.html:7
69+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/copyright.html:8
5970
#, python-format
6071
msgid "© Copyright %(copyright)s."
6172
msgstr "© Copyright %(copyright)s."
6273

63-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/edit-this-page.html:9
74+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/edit-this-page.html:10
6475
#, python-format
6576
msgid "Edit on %(provider)s"
6677
msgstr "Edita a %(provider)s"
6778

68-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/edit-this-page.html:11
79+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/edit-this-page.html:12
6980
msgid "Edit"
7081
msgstr "Edita"
7182

72-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:31
73-
msgid "GitHub"
74-
msgstr "GitHub"
75-
76-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:32
77-
msgid "GitLab"
78-
msgstr "GitLab"
79-
80-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:33
81-
msgid "Bitbucket"
82-
msgstr "Bitbucket"
83-
84-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:34
85-
msgid "Twitter"
86-
msgstr "Twitter"
87-
88-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:2
83+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:4
8984
msgid "Indices"
9085
msgstr "Índexs"
9186

92-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:9
87+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:11
9388
msgid "General Index"
9489
msgstr "Índex general"
9590

96-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:13
91+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:15
9792
msgid "Global Module Index"
9893
msgstr "Índex Global de Mòduls"
9994

100-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:17
95+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:19
10196
msgid "Python Module Index"
10297
msgstr "Índex de Mòduls Python"
10398

104-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/last-updated.html:2
99+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/last-updated.html:4
105100
#, python-format
106101
msgid "Last updated on %(last_updated)s."
107102
msgstr "Última actualització el %(last_updated)s."
108103

109-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html:5
110104
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html:6
105+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html:7
111106
msgid "Site Navigation"
112107
msgstr "Navegació del lloc"
113108

114-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/page-toc.html:4
109+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/page-toc.html:8
115110
msgid "On this page"
116111
msgstr "Continguts de la pàgina"
117112

118-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html:2
113+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/prev-next.html:6
114+
msgid "previous page"
115+
msgstr "pàgina anterior"
116+
117+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/prev-next.html:9
118+
msgid "previous"
119+
msgstr "anterior"
120+
121+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/prev-next.html:17
122+
msgid "next page"
123+
msgstr "pàgina següent"
124+
125+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/prev-next.html:19
126+
msgid "next"
127+
msgstr "següent"
128+
119129
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html:3
130+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html:4
120131
msgid "Section Navigation"
121132
msgstr "Navegació de la Secció"
122133

123-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sourcelink.html:4
134+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sourcelink.html:5
124135
msgid "Show Source"
125136
msgstr "Mostra el fitxer d'origen"
126137

127-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sphinx-version.html:3
138+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sphinx-version.html:4
128139
#, python-format
129140
msgid ""
130141
"Created using <a href=\"https://www.sphinx-doc.org/\">Sphinx</a> "
@@ -137,7 +148,7 @@ msgstr ""
137148
msgid "light/dark"
138149
msgstr "clar/fosc"
139150

140-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-version.html:2
151+
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-version.html:3
141152
#, python-format
142153
msgid ""
143154
"Built with the <a href=\"https://pydata-sphinx-"
@@ -148,18 +159,18 @@ msgstr ""
148159
"theme.readthedocs.io/en/stable/index.html\">Tema PyData Sphinx</a> "
149160
"%(theme_version)s."
150161

151-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:6
152-
msgid "previous page"
153-
msgstr "pàgina anterior"
162+
#~ msgid "Breadcrumbs"
163+
#~ msgstr "Rutes de navegació"
154164

155-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:9
156-
msgid "previous"
157-
msgstr "anterior"
165+
#~ msgid "GitHub"
166+
#~ msgstr "GitHub"
158167

159-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:17
160-
msgid "next page"
161-
msgstr "pàgina següent"
168+
#~ msgid "GitLab"
169+
#~ msgstr "GitLab"
170+
171+
#~ msgid "Bitbucket"
172+
#~ msgstr "Bitbucket"
173+
174+
#~ msgid "Twitter"
175+
#~ msgstr "Twitter"
162176

163-
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:19
164-
msgid "next"
165-
msgstr "següent"

0 commit comments

Comments
 (0)