From 6c556df79380418667651b8011fc91dedc700a95 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 19:24:24 +0200 Subject: Adding upstream version 4.1. Signed-off-by: Daniel Baumann --- AUTHORS | 6 + CHANGES.rst | 38 + LICENCE | 14 + PKG-INFO | 76 + README.rst | 45 + pyproject.toml | 57 + sphinxcontrib/jquery/__init__.py | 53 + .../jquery/_sphinx_javascript_frameworks_compat.js | 123 + sphinxcontrib/jquery/jquery-3.6.0.js | 10881 +++++++++++++++++++ sphinxcontrib/jquery/jquery.js | 2 + tests/test_jquery_installed.py | 93 + 11 files changed, 11388 insertions(+) create mode 100644 AUTHORS create mode 100644 CHANGES.rst create mode 100644 LICENCE create mode 100644 PKG-INFO create mode 100644 README.rst create mode 100644 pyproject.toml create mode 100644 sphinxcontrib/jquery/__init__.py create mode 100644 sphinxcontrib/jquery/_sphinx_javascript_frameworks_compat.js create mode 100644 sphinxcontrib/jquery/jquery-3.6.0.js create mode 100644 sphinxcontrib/jquery/jquery.js create mode 100644 tests/test_jquery_installed.py diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..f6ee9e0 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +Maintainers +=========== + +*Listed alphabetically in forename, surname order* + +* Adam Turner <@AA-Turner> diff --git a/CHANGES.rst b/CHANGES.rst new file mode 100644 index 0000000..27b4d11 --- /dev/null +++ b/CHANGES.rst @@ -0,0 +1,38 @@ +Release 4.1 (14/03/2023) +========================== + +* Include ``tests/``, ``AUTHORS``, ``CHANGES.rst``, and ``LICENCE`` in the + source distribution ('sdist') file. No changes to functionality. + +Release 4.0 (14/03/2023) +========================== + +* Enforcing `subresource integrity`_ (SRI) checks breaks loading rendered + documentation from local filesystem (``file:///`` URIs). + SRI checks may now be configured by the boolean configuration option + ``jquery_use_sri``, which defaults to ``False``. + See `sphinx_rtd_theme#1420`_ for further details. + +.. _sphinx_rtd_theme#1420: https://github.com/readthedocs/sphinx_rtd_theme/issues/1420 + +Release 3.0.0 (03/11/2022) +========================== + +* Vendor jQuery within the extension and copy the files to the documentation's + ``_static`` directory. +* Include the ``_sphinx_javascript_frameworks_compat.js`` compatibility file + from Sphinx 5. +* Include `subresource integrity`_ checksums in generated ``') in text + assert ('') in text + + static_dir = out_dir / '_static' + assert static_dir.joinpath('jquery.js').is_file() + assert static_dir.joinpath('_sphinx_javascript_frameworks_compat.js').is_file() + + +@pytest.mark.skipif(sphinx.version_info[:2] < (6, 0), + reason="Requires Sphinx 6.0 or greater") +def test_jquery_installed_sphinx_ge_60(blank_app): + out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]}) + + text = out_dir.joinpath("index.html").read_text(encoding="utf-8") + assert ('') in text + assert ('') in text + + static_dir = out_dir / '_static' + assert static_dir.joinpath('jquery.js').is_file() + assert static_dir.joinpath('_sphinx_javascript_frameworks_compat.js').is_file() + + +@pytest.mark.skipif(sphinx.version_info[:2] >= (6, 0), + reason="Requires Sphinx older than 6.0") +def test_jquery_installed_sphinx_lt_60(blank_app): + out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]}) + + if sphinx.version_info[:2] >= (2, 0): + text = out_dir.joinpath("index.html").read_text(encoding="utf-8") + assert '' in text + else: + text = out_dir.joinpath("contents.html").read_text(encoding="utf-8") + assert '' in text + if sphinx.version_info[:1] == (5,): + assert '' in text + + static_dir = out_dir / '_static' + assert static_dir.joinpath('jquery.js').is_file() + if sphinx.version_info[:1] == (5,): + assert static_dir.joinpath('_sphinx_javascript_frameworks_compat.js').is_file() + + +@pytest.mark.parametrize(('filename', 'integrity'), _FILES, ids=[*dict(_FILES)]) +def test_integrity(filename, integrity): + checksum = hashlib.sha384(Path(_ROOT_DIR, filename).read_bytes()) + encoded = base64.b64encode(checksum.digest()).decode(encoding='ascii') + assert f"sha384-{encoded}" == integrity -- cgit v1.2.3