Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danirus committed Sep 1, 2023
0 parents commit 2aed6e4
Show file tree
Hide file tree
Showing 229 changed files with 33,876 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
loose: true,
bugfixes: true,
modules: false
}
]
]
};
36 changes: 36 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"root": true,
"extends": [
"plugin:import/errors",
"plugin:import/warnings",
"plugin:unicorn/recommended"
],
"ignorePatterns": [
"build/*"
],
"rules": {
"indent": [
"error",
2,
{
"MemberExpression": "off",
"SwitchCase": 1
}
],
"max-len": [
"error",
{
"code": 80,
"comments": 72,
"ignoreUrls": true,
"ignoreRegExpLiterals": true,
"tabWidth": 2
}
],
"object-curly-spacing": "off",
"unicorn/expiring-todo-comments": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prevent-abbreviations": "off"
}
}
39 changes: 39 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: lint
on:
push:
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run lint

- uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install Python dependencies
run: |
python -m pip install -U pip
python -m pip install black
- name: Lint python code
run: black --check sphinx_nefertiti
22 changes: 22 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: publish
on:
release:
types: [published]

jobs:
publish:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install build
run: pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: tests
on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run js-test
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*.egg
*.egg-info
*.pyc
*.sass-cache
.coverage
.eggs/
.tox
build/
venv/
dist/
docs/_build
docs/build
docs/source/_static/nftt-pygments*
node_modules
.cache
js/coverage/
site/css/sphinx-nefertiti*
site/css/nftt-pygments*
site/js/
site/karma/
sphinx_nefertiti/static/*.min.js*
sphinx_nefertiti/colorsets/sphinx-nefertiti*.min.css*
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
hooks:
- id: black
- 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]
18 changes: 18 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "stylelint-config-twbs-bootstrap",
"customSyntax": "postcss-scss",
"overrides": [
{
"files": "scss/*.scss",
"rules": {
"declaration-no-important": null,
"scss/at-function-named-arguments": [
"never", { "ignoreFunctions": ["color.scale"] }
],
"color-named": [
"always-where-possible", { "ignoreProperties": "/./" }
]
}
}
]
}
19 changes: 19 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2023 Daniela Rus Morales

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include README.md
include requirements.txt

recursive-include sphinx_nefertiti *.*

recursive-exclude sphinx_nefertiti *.pyc
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.DEFAULT_GOAL := help

.PHONY: help build docs

clean: ## Clean up built files.
rm -rf build/
rm -rf site/css/nftt-pygments*.*
rm -rf site/css/sphinx-nefertiti*.*
rm -rf site/js/sphinx-nefertiti*.*
# rm -f sphinx_nefertiti/static/img/*.svg
# rm -f sphinx_nefertiti/static/assets/*
rm -f sphinx_nefertiti/static/snftt-*.*
make -C docs clean

build-ext: ## Build Sphinx extension.
npm run build
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
python -m build

build-docs: ## Create sphinx-nefertiti documentation.
make -C docs clean
make -C docs html

debug-docs: ## Create sphinx-nefertiti documentation with debug enabled.
make -C docs clean
python debug_sphinx.py docs/source docs/build -T

serve-site: ## Web server for content from directory site.
python -m http.server -d site/ 8192

serve-lcov: ## Web server for content from lcov-report directory.
python -m http.server -d js/coverage/lcov-report 8193

serve-docs: build-docs ## Web server for the sphinx-nefertiti documentation.
python -m http.server -d docs/build/html 8194

help: ## Show help message.
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%s\n\n" "Usage: make [task]"; \
printf "%-20s %s\n" "task" "help" ; \
printf "%-20s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-20s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Nefertiti for Sphinx

Nefertiti for Sphinx is yet another Sphinx theme.

An image is worth a thousand words, but do not miss the [documentation site](https://sphinx-nefertiti.readthedocs.io/en/latest/).

![screenshot](/docs/source/_static/img/screenshot.png)

## To use it

Install the package from PyPI:

```shell
pip install sphinx-nefertiti
```

Edit the `conf.py` file of your Sphinx project and change the `html_theme` setting:

```python
html_theme = "sphinx_nefertiti"
```

Now rebuild the docs and serve them to get a first glimpse of your site made up with Nefertiti for Sphinx. It has many customizable options worth to explore. You might want to continue reading the [customization](https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/customization/index.html) section of the docs.

## To develop it

Clone the Git repository, create a Python virtual environment, and install the NodeJS packages:

```shell
git clone [email protected]:danirus/sphinx-nefertiti.git
cd sphinx-nefertiti
python3.11 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
nvm use --lts
npm install
```

There are a comprehensive number of scripts in the package.json. Beyond them there is a Makefile that saves time when building the CSS and JavaScript bundles to deliver them within the Python package of the theme.

Further read the following sections:

* For [Style development](https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/development.html#style-development)
* For [JavaScript development](https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/development.html#javascript-development)
* For [Sphinx theme development](https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/development.html##python-development)


## License

Project distributed under the MIT License.
31 changes: 31 additions & 0 deletions config/bootstrap-rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

const path = require('node:path');
const { babel } = require('@rollup/plugin-babel');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const replace = require('@rollup/plugin-replace');

const plugins = [
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled'
}),
replace({
'process.env.NODE_ENV': '"production"',
preventAssignment: true
}),
nodeResolve()
];

module.exports = {
input: path.resolve(__dirname, `../js/src/bootstrap.js`),
output: {
file: path.resolve(__dirname, "../site/js/bootstrap.bundle.js"),
name: 'bootstrap',
format: 'umd',
generatedCode: 'es2015',
globals: {}
},
external: [],
plugins
};
Loading

0 comments on commit 2aed6e4

Please sign in to comment.