Skip to content

Commit 28ea399

Browse files
release: bump version 1.6.1
1 parent 6f5aee4 commit 28ea399

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

.github/workflows/ci_cd.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ jobs:
187187
runs-on: ubuntu-latest
188188
steps:
189189

190-
- name: "Release to the private PyPI repository"
191-
uses: ansys/actions/release-pypi-private@1096998b81f7ebdea116b683e11f3a8bda759ca6 # v10.0.14
192-
with:
193-
library-name: ${{ env.PACKAGE_NAME }}
194-
twine-username: "__token__"
195-
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
196-
197190
- name: "Download the library artifacts from build-library step"
198191
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
199192
with:

doc/changelog.d/795.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Home link reference

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ theme-name = "ansys_sphinx_theme"
1111
[project]
1212
# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
1313
name = "ansys-sphinx-theme"
14-
version = "1.6.0"
14+
version = "1.6.1"
1515
description = "A theme devised by ANSYS, Inc. for Sphinx documentation."
1616
readme = "README.rst"
1717
requires-python = ">=3.10,<4"

src/ansys_sphinx_theme/__init__.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@
7272
ANSYS_LOGO_LINK = "https://www.ansys.com/"
7373
PYANSYS_LOGO_LINK = "https://docs.pyansys.com/"
7474

75-
PACKAGE_HOME_HTML_PATTERN = re.compile(r'<a([^>]*?)href="[^"]*index\.html"([^>]*?)>\s*Home\s*</a>')
76-
75+
PACKAGE_HOME_HTML_PATTERN = re.compile(
76+
r'<a([^>]*)href="([^"]*index\.html)"([^>]*)>\s*Home\s*</a>', re.IGNORECASE
77+
)
7778

7879
# make logo paths available
7980
ansys_favicon = str((LOGOS_PATH / "ansys-favicon.png").absolute())
@@ -481,7 +482,7 @@ def update_search_sidebar_context(
481482
context["sidebars"] = sidebar
482483

483484

484-
def on_doctree_resolved(app: Sphinx, doctree: nodes.document, docname: str) -> None:
485+
def resolve_home_entry(app: Sphinx, doctree: nodes.document, docname: str) -> None:
485486
"""Add a 'Home' entry to the root TOC.
486487
487488
Parameters
@@ -500,20 +501,23 @@ def on_doctree_resolved(app: Sphinx, doctree: nodes.document, docname: str) -> N
500501
The 'Home' entry links to the index page of the documentation.
501502
"""
502503
index_page = app.config.root_doc or app.config.master_doc or "index"
504+
505+
# Get the root TOC
503506
root_toc = app.env.tocs[app.config.root_doc]
504-
for toc in traverse_or_findall(root_toc, toctree):
507+
if not root_toc:
508+
return
509+
510+
for toc in root_toc.findall(addnodes.toctree):
505511
if not toc.attributes.get("entries"):
506-
return
512+
continue
507513

514+
# Skip if "Home" already exists
508515
for title, page in toc.attributes["entries"]:
509-
if title == "Home":
516+
if title == "Home" and page in ("self", index_page):
510517
return
511518

512-
home_entry = (
513-
nodes.Text("Home"),
514-
index_page if index_page != docname else None,
515-
)
516-
# Insert 'Home' entry at the beginning of the TOC
519+
# Insert "Home <self>" entry at the beginning
520+
home_entry = ("Home", "self")
517521
toc.attributes["entries"].insert(0, home_entry)
518522

519523

@@ -547,11 +551,17 @@ def add_tooltip_after_build(app: Sphinx, exception):
547551
text = html_file.read_text(encoding="utf-8")
548552

549553
def replacer(match):
550-
attrs_before, attrs_after = match.groups()
554+
attrs_before, href_link, attrs_after = match.groups()
551555
full_attrs = f"{attrs_before}{attrs_after}"
556+
557+
# don’t duplicate if title already exists
552558
if "title=" in full_attrs:
553-
return match.group(0) # don't duplicate title
554-
return f'<a{attrs_before}href="index.html"{attrs_after} title="{project_name}">\n Home\n</a>' # noqa: E501
559+
return match.group(0)
560+
561+
return (
562+
f'<a{attrs_before}href="{href_link}"{attrs_after} '
563+
f'title="{project_name}">Home</a>'
564+
)
555565

556566
new_text = PACKAGE_HOME_HTML_PATTERN.sub(replacer, text)
557567

@@ -606,7 +616,7 @@ def setup(app: Sphinx) -> dict:
606616
app.connect("html-page-context", fix_edit_html_page_context)
607617
app.connect("html-page-context", update_search_sidebar_context)
608618
app.connect("html-page-context", update_template_context)
609-
app.connect("doctree-resolved", on_doctree_resolved)
619+
app.connect("doctree-resolved", resolve_home_entry)
610620

611621
app.connect("build-finished", replace_html_tag)
612622
app.connect("build-finished", add_tooltip_after_build)

0 commit comments

Comments
 (0)