Skip to content

Commit c7b8b00

Browse files
Broken GitHub links from gallery examples (#2111)
* corrected path * fixed linter * Added watsnew * Revert "Added watsnew" This reverts commit 3cc357d. * Update conf.py * Update conf.py * Update conf.py * Update conf.py * Update conf.py
1 parent 13ef8f4 commit c7b8b00

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/sphinx/source/conf.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,16 @@ def make_github_url(file_name):
442442

443443
# is it a gallery page?
444444
if any(d in file_name for d in sphinx_gallery_conf['gallery_dirs']):
445-
if file_name.split("/")[-1] == "index":
445+
example_folder = file_name.split("/")[-2]
446+
if file_name.split("/")[-1] == "index.rst":
446447
example_file = "README.rst"
447448
else:
448449
example_file = file_name.split("/")[-1].replace('.rst', '.py')
449-
target_url = URL_BASE + "docs/examples/" + example_file
450+
451+
if example_folder == 'gallery':
452+
target_url = URL_BASE + "docs/examples/" + example_file # noqa: E501
453+
else:
454+
target_url = URL_BASE + "docs/examples/" + example_folder + "/" + example_file # noqa: E501
450455

451456
# is it an API autogen page?
452457
elif "generated" in file_name:

0 commit comments

Comments
 (0)