8000 Do not append asset hashes on Sphinx 7.1+ by pradyunsg · Pull Request #137 · python/python-docs-theme · GitHub
[go: up one dir, main page]

Skip to content

Do not append asset hashes on Sphinx 7.1+ #137

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python_docs_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from typing import Any, Dict, List

import sphinx
import sphinx.application
from sphinx.builders.html import StandaloneHTMLBuilder

Expand All @@ -20,6 +21,11 @@ def _asset_hash(path: str) -> str:


def _add_asset_hashes(static: List[str], add_digest_to: List[str]) -> None:
if sphinx.version_info >= (7, 1):
# https://github.com/sphinx-doc/sphinx/pull/11415 added the relevant
# functionality to Sphinx, so we don't need to do anything.
return

for asset in add_digest_to:
index = static.index(asset)
static[index].filename = _asset_hash(asset) # type: ignore
Expand Down
0