Skip to content

Commit

Permalink
Broken GitHub links from gallery examples (#2111)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
IoannisSifnaios authored Jul 1, 2024
1 parent 13ef8f4 commit c7b8b00
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,16 @@ def make_github_url(file_name):

# is it a gallery page?
if any(d in file_name for d in sphinx_gallery_conf['gallery_dirs']):
if file_name.split("/")[-1] == "index":
example_folder = file_name.split("/")[-2]
if file_name.split("/")[-1] == "index.rst":
example_file = "README.rst"
else:
example_file = file_name.split("/")[-1].replace('.rst', '.py')
target_url = URL_BASE + "docs/examples/" + example_file

if example_folder == 'gallery':
target_url = URL_BASE + "docs/examples/" + example_file # noqa: E501
else:
target_url = URL_BASE + "docs/examples/" + example_folder + "/" + example_file # noqa: E501

# is it an API autogen page?
elif "generated" in file_name:
Expand Down

0 comments on commit c7b8b00

Please sign in to comment.