Skip to content

Fix transformation of some relative links #1431

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 1 commit into from
Jan 17, 2025

Conversation

deivid-rodriguez
Copy link
Member

What was the end-user problem that led to this PR?

The problem was some links in the doc folder imported from rubygems/rubygems were not being properly adapted to the site structure.

What was your diagnosis of the problem?

My diagnosis was that the regexp to detect relative links not starting with http was incorrect, because it would fail to detect any link with target starting with "h", "t", or "p" as relative.

What is your fix for the problem, implemented in this PR?

My fix is to properly use a negative lookahead.

This PR fixes #844. It depends on #1430 since that restore the whole page hierarchy under /doc.

@deivid-rodriguez deivid-rodriguez changed the title Fix some relative links Fix transformation of some relative links Jan 17, 2025
Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nicer, having fewer absolute links in there is super.

When the link started with the "h", "t", or "p" character, like in
[Merging pull requests](playbooks/MERGING_A_PR.md), they would not be
properly detected.

This commit fixes it by properly using a negative lookahead.
@deivid-rodriguez deivid-rodriguez merged commit 91e80fc into master Jan 17, 2025
3 checks passed
@deivid-rodriguez deivid-rodriguez deleted the fix-some-relative-links branch January 17, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

404: /doc/playbooks/MERGING_A_PR.md
2 participants