Skip to content

Commit

Permalink
Multiple features (#40)
Browse files Browse the repository at this point in the history
* Back-to-top button
* Working on multiple features
* Add python tests, extend JavaScript tests
* Add tox, update tests.yml GHA workflow
* Update some docs (wip)
* Call s/js-test/test from package.json
* Add theme assets
* Cosmetics changes
* Fix var name for dynamic multi-versions docs
* Hint for matrix in GHA Workflow
* Update docs
* Update bundles
* Update README
* Stylelint changes
* JS Lint changes
  • Loading branch information
danirus authored Nov 25, 2024
1 parent 275e52b commit 70635f7
Show file tree
Hide file tree
Showing 206 changed files with 7,397 additions and 9,972 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"plugin:unicorn/recommended"
],
"ignorePatterns": [
"build/*"
"build/*",
"**/*.min.js"
],
"rules": {
"indent": [
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/lint.yaml

This file was deleted.

62 changes: 50 additions & 12 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,59 @@ on:
- main
pull_request:

env:
FORCE_COLOR: true
NODE: 20
PYTHON: 3.13

permissions:
contents: read

jobs:
tests:
syntax-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE }}"
cache: npm
- name: Install npm dependencies
run: npm ci
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON }}"
cache: pip
- name: Install pip dependencies
run: pip install .[dev]
- name: Run make lint
run: make lint

python-sphinx:
runs-on: ubuntu-latest
strategy:
matrix:
sphinx: ["7.3", "7.4", "8.0", "8.1"]
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
- uses: actions/setup-python@v5
with:
node-version: '18'
- name: Cache dependencies
uses: actions/cache@v4
python-version: "${{ env.PYTHON }}"
cache: pip
- name: Install deps
run: pip install tox
- name: Run unit tests
run: tox -e py3.13-sphinx${{ matrix.sphinx }}

javascript-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run js-test
node-version: "${{ env.NODE }}"
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Run unit tests
run: npm run test
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ site/css/sphinx-nefertiti*
site/css/nftt-pygments*
site/js/
site/karma/
sphinx_nefertiti/static/*.min.js*
sphinx_nefertiti/colorsets/sphinx-nefertiti*.min.css*
tests/sample_prj_?/_build/
docs/source/_static/sphinx-nefertiti-*.css
docs/source/_static/sphinx-nefertiti-*.css.map
53 changes: 34 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
---
exclude: |
(?x)(
^dist|
^sphinx_nefertiti/colorsets|
^sphinx_nefertiti/static|
^docs/source/static/
)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.7.0
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-yaml
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: black
- id: ruff
args:
- "--fix"
- id: ruff-format

- repo: local
hooks:
- id: css-lint-stylelint
name: local-css-lint-stylelint
entry: npm run css-lint-stylelint --
language: node
types: [scss]
- id: js-lint
name: local-js-lint
entry: npm run js-lint --
language: node
types: [javascript]
- id: js-lint
name: local-js-lint
entry: npm run js-lint --
language: node
types: [javascript]
- id: css-lint-stylelint
name: local-css-lint-stylelint
entry: npm run css-lint-stylelint --
language: node
types: [scss]
10 changes: 7 additions & 3 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"extends": "stylelint-config-twbs-bootstrap",
"customSyntax": "postcss-scss",
"ignoreFiles": ["**.*.min.css*"],
"rules": {
"selector-max-type": [2, {"ignore": ["descendant"]}]
},
"overrides": [
{
"files": "scss/*.scss",
"rules": {
"color-named": [
"always-where-possible", { "ignoreProperties": "/./" }
],
"declaration-no-important": null,
"scss/at-function-named-arguments": [
"never", { "ignoreFunctions": ["color.scale"] }
],
"color-named": [
"always-where-possible", { "ignoreProperties": "/./" }
]
}
}
Expand Down
13 changes: 13 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## [0.5.0] - Unreleased

- Add breadcrumbs.
- Use smooth scrolling.
- Add **back-to-top** button.
- Add customizable header links.
- Limit height of version dropdown.
- Use compact notation to display number of stars, and forks, in header's repository widget.
- Scroll the left sidebar to show the link corresponding to the current page.
- In the sphinx-nefertiti documentation website, reset the colorset selected by the user 24 hours after it has been selected.
- Migrate from `setup.py` and multiple requirements files, to `pyproject.toml`.
- Use tox to run verify that tests pass against multiple versions of Sphinx.

## [0.4.2] - 2024-10-15

- Remove version constrain for Sphinx 8 in Nefertiti's dependencies.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
IN THE SOFTWARE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include README.md
include requirements.txt
include version.txt

recursive-include sphinx_nefertiti *.*
recursive-include sphinx_nefertiti/colorsets *.*
Expand Down
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,31 @@ clean: ## Clean up built files.
rm -f sphinx_nefertiti/static/snftt-*.*
make -C docs clean

lint: ## Run pre-commit hook checks.
npm run css-lint-vars
pre-commit run --all-files --show-diff-on-failure

py-tests: ## Run Python tests with coverage.
coverage erase
coverage run --source=sphinx_nefertiti -m pytest -ra
coverage report -m
@sh ./ccsvg.sh ||:

js-tests: ## Run JavaScript tests.
npm run test

build-ext: ## Build Sphinx extension.
npm run build
mkdir -p sphinx_nefertiti/static/
mkdir -p sphinx_nefertiti/colorsets/
cp site/css/bootstrap-icons.css sphinx_nefertiti/static/
cp site/css/bootstrap-icons.woff2 sphinx_nefertiti/static/
cp site/js/*.min.js sphinx_nefertiti/static/
cp site/js/*.min.js.map sphinx_nefertiti/static/
cp site/css/sphinx-nefertiti*.min.css sphinx_nefertiti/colorsets/
cp site/css/sphinx-nefertiti*.min.css.map sphinx_nefertiti/colorsets/
cp site/css/nftt-pygments.min.css docs/source/_static
cp site/css/nftt-pygments.min.css.map docs/source/_static
cp site/css/nftt-pygments.min.css docs/source/static
cp site/css/nftt-pygments.min.css.map docs/source/static
python -m build

build-docs: ## Create sphinx-nefertiti documentation.
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Nefertiti for Sphinx
# Nefertiti for Sphinx [![tests](https://github.com/danirus/sphinx-nefertiti/workflows/tests/badge.svg)](https://github.com/danirus/sphinx-nefertiti/actions/workflows/tests.yml)

Nefertiti is a theme for [Sphinx](https://www.sphinx-doc.org/en/master/) that features:

Expand All @@ -7,13 +7,20 @@ Nefertiti is a theme for [Sphinx](https://www.sphinx-doc.org/en/master/) that fe
* Font configuration compliant with [EU's GDPR](https://gdpr.eu/).
* Different fonts can be used for different elements.
* Light and dark color schemes, for normal text and code highlighted with Pygments styles.
* Images that switch between color schemes. Released as [sphinx-colorschemed-images](https://pypi.org/project/sphinx-colorschemed-images/).
* Diverse color sets are available: blue, indigo, purple, pink, red, orange, yellow, ...
* Header and footer links. Header links can be grouped in dropdown elements.
* Optional highlighting of the project repository in the header.
* Optional project version selector in the header.
* Customizable footer links.
* Back-to-top button.

See it in action in [sphinx-themes.org](https://sphinx-themes.org/#theme-sphinx-nefertiti).

## Tested

* [Tested against Sphinx 7.3, 7.4, 8.0 and 8.1](https://github.com/danirus/sphinx-nefertiti/actions/workflows/tests.yml), see matrix python-sphinx.
* [Tested with NodeJS v20](https://github.com/danirus/sphinx-nefertiti/actions/workflows/tests.yml), see javascript-tests.

## Index filtering

<p align="center"><img align="center" width="315" height="417" src="https://github.com/danirus/sphinx-nefertiti/raw/main/docs/source/_static/img/index-filtering-1.png"></p>
Expand Down
5 changes: 5 additions & 0 deletions ccsvg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

if [ "${ENV}" != "testing" ]; then
coverage-badge > coverage.svg
fi
21 changes: 21 additions & 0 deletions coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 70635f7

Please sign in to comment.