Skip to content

Commit

Permalink
get back green tests ! (#13)
Browse files Browse the repository at this point in the history
* BUG - Clear alt_text in conf.py (pydata#1471)

* comment out alt_text in conf.py

* set alt_text to empty string

* remove alt_text from conf.py

* fix: use 12rambau fork until it's merged with nikeee repo (pydata#1517)

* deps: drop support for Sphinx 5 (pydata#1516)

* remove ref to myst-nb

* update minimal supported version of sphinx

* Fix: (webpack.config.js) css-loader API change (pydata#1508)

* Fix: (webpack.config.js) css-loader API change

The build was broken in
<https://github.com/pydata/pydata-sphinx-theme/commit/185a37aa36820f77bffa4c87a772092e9e7cc380>/<https://github.com/pydata/pydata-sphinx-theme/pull/1494>.

This change fixes the build, and it seems to be in accordance with the
current API as described at <https://github.com/webpack-contrib/css-loader/blob/c6f36cf91ac61743a70e81cfb077faa0f8730ebe/README.md#boolean>.

Closes <pydata#1507>.

* dedup

* restore version bump

---------

Co-authored-by: Daniel McCloy <dan@mccloy.info>

* Fix duplicate HTML IDs (pydata#1425)

* Fix duplicate HTML IDs

* fix tests

* Do not animate the version admonitions colors. (pydata#1424)

Otherwise a delay has to be added to the accessibility color
contrast checks, to wait for the colors to fully transition.

* BUG - Remove redundant ARIA in breadcrumb navigation (pydata#1426)

* style(i18n): French Typo fixed (pydata#1430)

* Add the ability to add a center section to the footer (pydata#1432)

* Add a center section for the footer

* Add docs for footer_center

* Add a test site for the center footer

* test it in our own docs

* remove new test site

* add footer test

---------

Co-authored-by: Daniel McCloy <dan@mccloy.info>

* Build(deps): Bump actions/checkout from 3 to 4 (pydata#1433)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add dropdown_text argument to generate_header_nav_html (pydata#1423)

* Add dropdown_text argument to generate_header_nav_html

* Add a test, fix typo in theme.conf and remove header_dropdown_text from docs/conf.py

* fixed?

---------

Co-authored-by: Daniel McCloy <dan@mccloy.info>

* fix: rollback ref and Id changes (pydata#1438)

* bump: version 0.13.3 → 0.14.0  (pydata#1440)

* bump version

* update version switcher

* back to dev

* fix: change the z-index of the dropdown (pydata#1442)

In order to be on top of the primary sidebar on small screens.

* fix: set the same background for dark/light (pydata#1443)

* fix: set the same background for dark/light
et the same background color for all state of the search field. It is currently only applied when hovered

* fix: wrong css selector

* Update src/pydata_sphinx_theme/assets/styles/components/_search.scss

* Update src/pydata_sphinx_theme/assets/styles/components/_search.scss

* Fix duplicate HTML IDs

* fix tests

* unique_html_id

* backwards-compat generate_header_nav_html

* feedback review

* update fixture

* ughhhh...caching

* code cleanup

* fix test snapshot

* put comment inside def

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Denis Bitouzé <dbitouze@wanadoo.fr>
Co-authored-by: Stuart Mumford <stuart@cadair.com>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Co-authored-by: Rambaud Pierrick <12rambau@users.noreply.github.com>

* chore: build the devcontainer automatically in codespace (pydata#1483)

* chore: build the devcontainer automaticallyin codespace

* refactor: lint

* add pandoc to the environment

* Fix font color in search input box (pydata#1524)

* Fix color

* Use --pst-color-text-base

* docs: add DecentralChain (pydata#1528)

Co-authored-by: jourlez <josuecr.288@gmail.com>

* Updates for file src/pydata_sphinx_theme/locale/en/LC_MESSAGES/sphinx.po in ru [Manual Sync] (pydata#1527)

i18n: Translate sphinx.po in ru [Manual Sync]

96% of minimum 20% translated source file: 'sphinx.po'
on 'ru'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>

* ignore transient errors in windows build CI (pydata#1520)

* use warning list

* clean up notebook

* refactor to pass on all platforms?

* simplify

* fix logic

* iterate backwards

* fix plaform detection? also don't log unnecessarily�[H

* ignore empty string warnings

* remove notebook metawarning

* Revert "remove notebook metawarning"

This reverts commit 42f4672.

* try again

* debug the mysterious empty warning

* escape color codes

* import

* triage by intermittency, not by platform; better var names

* simplify

* fix list.remove

* undo what I broke

* Update tests/utils/check_warnings.py

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: gabalafou <gabriel@fouasnon.com>
Co-authored-by: Adam Porter <adam@alphapapa.net>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Denis Bitouzé <dbitouze@wanadoo.fr>
Co-authored-by: Stuart Mumford <stuart@cadair.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Co-authored-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Co-authored-by: jourlez <josuecr.288@gmail.com>
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
  • Loading branch information
11 people authored Oct 19, 2023
1 parent 85b91b4 commit 7304115
Show file tree
Hide file tree
Showing 17 changed files with 296 additions and 81 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// container instruction for codespace users
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/nox:2": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"ghcr.io/rocker-org/devcontainer-features/pandoc:1": {}
},
"postCreateCommand": "pre-commit install"
}
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: nikeee/setup-pandoc@v1
# waiting for https://github.com/nikeee/setup-pandoc/pull/8
# using 12rambau fork until then
- uses: 12rambau/setup-pandoc@test
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
"logo": {
"text": "PyData Theme",
"image_dark": "_static/logo-dark.svg",
"alt_text": "PyData Theme",
},
"use_edit_page_button": True,
"show_toc_level": 1,
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/gallery.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ Thanks for your support!
link: https://docs.pyvista.org
- title: Pastas
link: https://pastas.readthedocs.io/
- title: DecentralChain
link: https://docs.decentralchain.io/en/master/
```
19 changes: 0 additions & 19 deletions docs/examples/pydata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@
"## Matplotlib"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"nbsphinx": "hidden"
},
"outputs": [],
"source": [
"import matplotlib\n",
"\n",
"# avoid warnings upon doc build\n",
"matplotlib.set_loglevel(\"critical\")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -69,11 +55,6 @@
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"matplotlib.set_loglevel(\"critical\")\n",
"\n",
"rng = np.random.default_rng()\n",
"data = rng.standard_normal((3, 100))\n",
"fig, ax = plt.subplots()\n",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"devDependencies": {
"axe-core": "^4.6.3",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^3.4.2",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^4.2.2",
"dedent": "^0.7.0",
"html-webpack-plugin": "^4.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

.form-control {
background-color: var(--pst-color-background);
color: var(--pst-color-text-base);

&:focus,
&:focus-visible {
Expand Down
165 changes: 165 additions & 0 deletions src/pydata_sphinx_theme/locale/ru/LC_MESSAGES/sphinx.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# English translations for pydata-sphinx-theme.
# Copyright (C) 2023 PyData developers
# This file is distributed under the same license as the pydata-sphinx-theme project.
#
# Translators:
# Rambaud Pierrick <pierrick.rambaud49@gmail.com>, 2023
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-02-16 14:32-0500\n"
"PO-Revision-Date: 2023-04-14 14:57+0000\n"
"Last-Translator: Rambaud Pierrick <pierrick.rambaud49@gmail.com>, 2023\n"
"Language-Team: Russian (https://app.transifex.com/12rambau/teams/166811/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.11.0\n"
"Language: ru\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html:50
msgid "Skip to main content"
msgstr "Перейти к основному содержанию"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/search-button.html:7
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/search.html:5
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/search.html:28
msgid "Search"
msgstr "Поиск"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/search.html:8
msgid "Error"
msgstr "Ошибка"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/search.html:9
msgid "Please activate JavaScript to enable the search functionality."
msgstr "Активируйте JavaScript, чтобы включить функцию поиска."

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:12
msgid "Breadcrumbs"
msgstr "Навигационная цепочка"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:13
msgid "Breadcrumb"
msgstr "Хлебная крошка"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html:16
msgid "Home"
msgstr "Главная"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/copyright.html:4
#, python-format
msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s."
msgstr "© <a href=\\\"%(path)s\\\">Копирайт</a> %(copyright)s."

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/copyright.html:7
#, python-format
msgid "© Copyright %(copyright)s."
msgstr "© Копирайт %(copyright)s."

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/edit-this-page.html:9
#, python-format
msgid "Edit on %(provider)s"
msgstr "Редактировать на %(provider)s"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/edit-this-page.html:11
msgid "Edit"
msgstr "Редактировать"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:31
msgid "GitHub"
msgstr "GitHub"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:32
msgid "GitLab"
msgstr "GitLab"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:33
msgid "Bitbucket"
msgstr "Bitbucket"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/icon-links.html:34
msgid "Twitter"
msgstr "Twitter"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:2
msgid "Indices"
msgstr ""

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:9
msgid "General Index"
msgstr "Общий указатель"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:13
msgid "Global Module Index"
msgstr "Глобальный индекс модулей"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/indices.html:17
msgid "Python Module Index"
msgstr "Индекс модулей Python"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/last-updated.html:2
#, python-format
msgid "Last updated on %(last_updated)s."
msgstr "Последнее обновление %(last_updated)s."

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html:5
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-nav.html:6
msgid "Site Navigation"
msgstr "Навигация по сайту"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/page-toc.html:4
msgid "On this page"
msgstr "На этой странице"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html:2
#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sidebar-nav-bs.html:3
msgid "Section Navigation"
msgstr "В этом разделе"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sourcelink.html:4
msgid "Show Source"
msgstr "Просмотр исходного кода"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/sphinx-version.html:3
#, python-format
msgid ""
"Created using <a href=\"https://www.sphinx-doc.org/\">Sphinx</a> "
"%(sphinx_version)s."
msgstr ""
"Создано с помощью <a href=\\\"https://www.sphinx-doc.org/\\\">Sphinx</a> "
"%(sphinx_version)s."

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-switcher.html:5
msgid "light/dark"
msgstr "светлая/темная"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-version.html:2
#, python-format
msgid ""
"Built with the <a href=\"https://pydata-sphinx-"
"theme.readthedocs.io/en/stable/index.html\">PyData Sphinx Theme</a> "
"%(theme_version)s."
msgstr ""
"Собрано с использованием темы <a href=\\\"https://pydata-sphinx-"
"theme.readthedocs.io/en/stable/index.html\\\">PyData Sphinx</a> "
"%(theme_version)s."

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:6
msgid "previous page"
msgstr "предыдущая страница"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:9
msgid "previous"
msgstr "назад"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:17
msgid "next page"
msgstr "следующая страница"

#: src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/footer-article/prev-next.html:19
msgid "next"
msgstr "далее"
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
{# As the version switcher will only work when JavaScript is enabled, we add it through JavaScript.
#}
{%- set button_id = unique_html_id("pst-version-switcher-button") -%}
{%- set dropdown_id = unique_html_id("pst-version-switcher-list") -%}
{# As the version switcher will only work when JavaScript is enabled, we add it through JavaScript. #}
<script>
document.write(`
<div class="version-switcher__container dropdown">
<button id="versionswitcherbutton" type="button" role="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="listbox" aria-controls="versionswitcherlist" aria-label="Version switcher list">
<button id="{{ button_id }}"
type="button"
class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle"
data-bs-toggle="dropdown"
aria-haspopup="listbox"
aria-controls="{{ dropdown_id }}"
aria-label="Version switcher list"
>
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="versionswitcherlist" class="version-switcher__menu dropdown-menu list-group-flush py-0" role="listbox" aria-labelledby="versionswitcherbutton">
<!-- dropdown will be populated by javascript on page load -->
<div id="{{ dropdown_id }}"
class="version-switcher__menu dropdown-menu list-group-flush py-0"
role="listbox" aria-labelledby="{{ button_id }}">
<!-- dropdown will be populated by javascript on page load -->
</div>
</div>
`);
Expand Down
69 changes: 48 additions & 21 deletions src/pydata_sphinx_theme/toctree.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Methods to build the toctree used in the html pages."""

from functools import lru_cache
from typing import List, Union
from itertools import count
from typing import Iterator, List, Union
from urllib.parse import urlparse

import sphinx
Expand Down Expand Up @@ -37,27 +38,24 @@ def add_toctree_functions(
"""Add functions so Jinja templates can add toctree objects."""

@lru_cache(maxsize=None)
def generate_header_nav_html(
n_links_before_dropdown: int = 5, dropdown_text: str = "More"
) -> str:
"""Generate top-level links that are meant for the header navigation.
We use this function instead of the TocTree-based one used for the
sidebar because this one is much faster for generating the links and
we don't need the complexity of the full Sphinx TocTree.
This includes two kinds of links:
- Links to pages described listed in the root_doc TocTrees
- External links defined in theme configuration
def get_or_create_id_generator(base_id: str) -> Iterator[str]:
for n in count(start=1):
if n == 1:
yield base_id
else:
yield f"{base_id}-{n}"

Additionally it will create a dropdown list for several links after
a cutoff.
def unique_html_id(base_id: str):
"""Create an id that is unique from other ids created by this function at build time.
Parameters:
n_links_before_dropdown:The number of links to show before nesting the remaining links in a Dropdown element.
dropdown_text:Text of the dropdown element button.
The function works by sequentially returning "<base_id>", "<base_id>-2",
"<base_id>-3", etc. each time it is called.
"""
return next(get_or_create_id_generator(base_id))

@lru_cache(maxsize=None)
def generate_header_nav_before_dropdown(n_links_before_dropdown):
"""The cacheable part."""
try:
n_links_before_dropdown = int(n_links_before_dropdown)
except Exception:
Expand Down Expand Up @@ -148,14 +146,42 @@ def generate_header_nav_html(
for html in links_html[n_links_before_dropdown:]
]

return out, links_dropdown

def generate_header_nav_html(
n_links_before_dropdown: int = 5, dropdown_text: str = "More"
) -> str:
"""Generate top-level links that are meant for the header navigation.
We use this function instead of the TocTree-based one used for the
sidebar because this one is much faster for generating the links and
we don't need the complexity of the full Sphinx TocTree.
This includes two kinds of links:
- Links to pages described listed in the root_doc TocTrees
- External links defined in theme configuration
Additionally it will create a dropdown list for several links after
a cutoff.
Parameters:
n_links_before_dropdown:The number of links to show before nesting the remaining links in a Dropdown element.
dropdown_text:Text of the dropdown element button.
"""
out, links_dropdown = generate_header_nav_before_dropdown(
n_links_before_dropdown
)

if links_dropdown:
dropdown_id = unique_html_id("pst-nav-more-links")
links_dropdown_html = "\n".join(links_dropdown)
out += f"""
<li class="nav-item dropdown">
<button class="btn dropdown-toggle nav-item" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-controls="pst-header-nav-more-links">
<button class="btn dropdown-toggle nav-item" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-controls="{dropdown_id}">
{_(dropdown_text)}
</button>
<ul id="pst-header-nav-more-links" class="dropdown-menu">
<ul id="{dropdown_id}" class="dropdown-menu">
{links_dropdown_html}
</ul>
</li>
Expand Down Expand Up @@ -314,6 +340,7 @@ def navbar_align_class() -> List[str]:
)
return align_options[align]

context["unique_html_id"] = unique_html_id
context["generate_header_nav_html"] = generate_header_nav_html
context["generate_toctree_html"] = generate_toctree_html
context["generate_toc_html"] = generate_toc_html
Expand Down
Loading

0 comments on commit 7304115

Please sign in to comment.