Skip to content

Commit

Permalink
Backport fix for broken documentation search (#1969)
Browse files Browse the repository at this point in the history
  • Loading branch information
darcymason committed Dec 3, 2023
1 parent f86e0df commit 1fab60e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/Makefile
Expand Up @@ -59,6 +59,7 @@ html:
rm -rf $(BUILDDIR)/html/_images
#rm -rf _build/doctrees/
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
python3 fix_search.py # TODO remove when sphinx_rtd_theme fixes upstream
touch $(BUILDDIR)/html/.nojekyll
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
Expand Down
22 changes: 22 additions & 0 deletions doc/fix_search.py
@@ -0,0 +1,22 @@
"""
A temporary fix for https://github.com/pydicom/pydicom/issues/1965
while waiting for upstream sphinx_rtd_theme to fix/remove their
dependency on jQuery.
"""
from pathlib import Path
import re


search_html = Path("./_build/html/search.html")
assert search_html.exists()

with open(search_html) as fp:
html = fp.read()

pat = r"(<script>\s+jQuery.+searchindex\.js.+\s+<\/script>)"
repl = r'<script src="searchindex.js" defer></script>'
# re.findall(pat, html)
html_fixed = re.sub(pat, repl, html)

with open(search_html, "w") as fp:
fp.write(html_fixed)
2 changes: 2 additions & 0 deletions doc/make.bat
Expand Up @@ -35,6 +35,8 @@ if "%1" == "clean" (

if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
REM TODO remove when sphinx_rtd_theme fixes upstream
python fix_search.py
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
Expand Down
2 changes: 1 addition & 1 deletion pydicom/_version.py
Expand Up @@ -3,7 +3,7 @@
from typing import cast, Match


__version__: str = '2.4.2'
__version__: str = '2.4.4'

result = cast(Match[str], re.match(r'(\d+\.\d+\.\d+).*', __version__))
__version_info__ = tuple(result.group(1).split('.'))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -35,7 +35,7 @@ license = {text = "MIT"}
name = "pydicom"
readme = "README.md"
requires-python = ">=3.7"
version = "2.4.3"
version = "2.4.4"


[project.optional-dependencies]
Expand Down

0 comments on commit 1fab60e

Please sign in to comment.