[community/kep pages] Add automated handling for links from imported files #6926
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@chenopis PTAL
I've tried to generalize this solution and not make it too brittle---basically if you mark the import config file (e.g.
community.yml
) withgen-absolute-links
, it processes URLs from the imported pages as follows, depending on their type:#id-on-page
- leaves these URLs as they are/path/url
- adds the remote repo URL prefixpath/url
,./path.url
- adds the remote repo URL and the relevant file's subpath as a prefixhttp://
,https://
- leaves these URLs as they aremailto:
- leaves these URLs as they areRegex works for now, but people well-versed in parsing can likely come up with a cleaner solution.
Some of the URLs are broken because things in community have been moved around, I'll follow up on the CI report and fix them accordingly.
This change is