Skip to content

Broken GitHub links from gallery examples #2111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading