Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3400749

Browse filesBrowse files
authored
DOC [PST] disable gallery link tweaks when html-noplot to avoid warnings (#28512)
1 parent 30a21d6 commit 3400749
Copy full SHA for 3400749

File tree

Expand file treeCollapse file tree

2 files changed

+16
-9
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-9
lines changed

‎doc/make.bat

Copy file name to clipboardExpand all lines: doc/make.bat
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ if "%1" == "html-noplot" (
6161
%SPHINXBUILD% -D plot_gallery=0 -b html %ALLSPHINXOPTS% %BUILDDIR%/html
6262
echo.
6363
echo.Build finished. The HTML pages are in %BUILDDIR%/html
64+
goto end
6465
)
6566

6667
if "%1" == "dirhtml" (

‎doc/sphinxext/move_gallery_links.py

Copy file name to clipboardExpand all lines: doc/sphinxext/move_gallery_links.py
+15-9Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,28 @@ def _create_badge_link(link):
142142
sg_note = soup.find("div", class_="sphx-glr-download-link-note")
143143
sg_footer = soup.find("div", class_="sphx-glr-footer")
144144

145+
# If any one of these two is not found, we directly give up tweaking
146+
if sg_note is None or sg_footer is None:
147+
continue
148+
145149
# Move the download links into the secondary sidebar
146-
py_link = sg_footer.find("div", class_="sphx-glr-download-python").a
147-
ipy_link = sg_footer.find("div", class_="sphx-glr-download-jupyter").a
150+
py_link_div = sg_footer.find("div", class_="sphx-glr-download-python")
151+
ipy_link_div = sg_footer.find("div", class_="sphx-glr-download-jupyter")
148152
_create_secondary_sidebar_component(
149153
[
150-
_create_download_link(py_link, is_jupyter=False),
151-
_create_download_link(ipy_link, is_jupyter=True),
154+
_create_download_link(py_link_div.a, is_jupyter=False),
155+
_create_download_link(ipy_link_div.a, is_jupyter=True),
152156
]
153157
)
154158

155159
# Move the badge links into the secondary sidebar
156-
lite_link = sg_footer.find("div", class_="lite-badge").a
157-
binder_link = sg_footer.find("div", class_="binder-badge").a
160+
lite_link_div = sg_footer.find("div", class_="lite-badge")
161+
binder_link_div = sg_footer.find("div", class_="binder-badge")
158162
_create_secondary_sidebar_component(
159-
[_create_badge_link(lite_link), _create_badge_link(binder_link)]
163+
[
164+
_create_badge_link(lite_link_div.a),
165+
_create_badge_link(binder_link_div.a),
166+
]
160167
)
161168

162169
# Remove the sourcelink component from the secondary sidebar; the reason
@@ -171,9 +178,8 @@ def _create_badge_link(link):
171178
sg_note.extract()
172179
sg_footer.extract()
173180

174-
except Exception as e:
181+
except Exception:
175182
# If any step fails we directly skip the file
176-
logger.warning(f"Failed to tweak gallery links in {html_file}: {e}")
177183
continue
178184

179185
# Write the modified file back

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.