Skip to content

Commit

Permalink
sphinxcontrib-jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Oct 17, 2022
0 parents commit 38c8b44
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*.pyc
*.egg
*.so
*.swp

.dir-locals.el
.cache/
.idea
.mypy_cache/
.pytest_cache/
.ropeproject/
.vscode/
TAGS
.tags
.tox/
.tx/
.venv/
.coverage
htmlcov
.DS_Store
sphinx/pycode/Grammar*pickle
distribute-*

env/
build/
dist/
docker/
Sphinx.egg-info/
doc/_build/
doc/locale/
tests/.coverage
tests/build/
utils/regression_test.js

node_modules/
6 changes: 6 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Maintainers
===========

*Listed alphabetically in forename, surname order*

* Adam Turner <@AA-Turner>
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Release 1.0.0 (in development)
==============================

* Initial release of ``sphinxcontrib-jquery``.
14 changes: 14 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BSD Zero Clause Licence

Copyright 2022, Adam Turner

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
21 changes: 21 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
======================
sphinxcontrib-jquery
======================

.. image:: https://img.shields.io/pypi/v/sphinxcontrib-jquery.svg
:target: https://pypi.org/project/sphinxcontrib-jquery/
:alt: Package on PyPI

``sphinxcontrib-jquery`` ensures that jQuery is always installed for use in
Sphinx themes or extensions.

To use it, add ``sphinxcontrib.jquery`` as a Sphinx extension:

.. code:: python
# conf.py
extensions = [
"sphinxcontrib.jquery",
]
...
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[build-system]
requires = ["setuptools>=65"]
build-backend = "setuptools.build_meta"

# project metadata
[project]
name = "sphinxcontrib-jquery"
version = "1.0.0"
description = "Extension to include jQuery on newer Sphinx releases"
readme = "README.rst"
license.text = "BSD Zero Clause License"
requires-python = ">=3.7"

# Classifiers list: https://pypi.org/classifiers/
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Sphinx",
"Framework :: Sphinx :: Extension",
"Topic :: Documentation",
"Topic :: Documentation :: Sphinx",
]
dependencies = [
"setuptools", # for pkg_resources
]

[[project.authors]]
name = "Adam Turner"
2 changes: 2 additions & 0 deletions sphinxcontrib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
__import__('pkg_resources').declare_namespace(__name__)
20 changes: 20 additions & 0 deletions sphinxcontrib/jquery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sphinx

__version__ = "1.0.0"
version_info = (1, 0, 0)


def setup(app: "sphinx.application.Sphinx"):
jquery_installed = getattr(app, "_sphinxcontrib_jquery_installed", False)
if sphinx.version_info[:2] >= (6, 0) and not jquery_installed:
app.add_js_file(
"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js",
priority=100,
)
app._sphinxcontrib_jquery_installed = True

return {
"parallel_read_safe": True,
"parallel_write_safe": True,
"version": "1.0.0",
}

0 comments on commit 38c8b44

Please sign in to comment.