Skip to content
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

Check for /-/ in GitLab url (closes #1073) #1074

Merged
merged 3 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,9 @@ def parse_url(self, uri):

elif self.platform == "gitlab":
# cp. https://docs.gitlab.com/ee/user/markdown.html#gitlab-specific-references
if any(map(uri.path.__contains__, ["issues", "merge_requests"])):
if "/-/" in path and any(
map(uri.path.__contains__, ["issues", "merge_requests"])
):
group_and_subgroups, parts, *_ = path.split("/-/")
parts = parts.split("/")
url_type, element_number, *_ = parts
Expand Down
1 change: 1 addition & 0 deletions tests/sites/base/page1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Page 1
https://gitlab.com/gitlab-org
https://gitlab.com/gitlab-org/gitlab
https://gitlab.com/gitlab-org/gitlab/-/issues/375583
https://gitlab.com/gitlab-org/gitlab/issues/375583
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84669
https://gitlab.com/gitlab-org/gitlab/-/pipelines/511894707
https://gitlab.com/gitlab-com/gl-infra/production/-/issues/6788
3 changes: 3 additions & 0 deletions tests/test_build/gitlab_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<a class="gitlab reference external" href="https://gitlab.com/gitlab-org/gitlab/-/issues/375583">
gitlab-org/gitlab#375583
</a>
<a class="gitlab reference external" href="https://gitlab.com/gitlab-org/gitlab/issues/375583">
gitlab-org/gitlab/issues/375583
</a>
<a class="gitlab reference external" href="https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84669">
gitlab-org/gitlab!84669
</a>
Expand Down