kubernetes / contributor-site

Code for kubernetes.dev
https://www.kubernetes.dev
Apache License 2.0
63 stars 147 forks source link

hack/gen-content.sh: fix bogus reference link mangling #510

Closed rul closed 2 weeks ago

rul commented 3 weeks ago

Some pages downloaded by gen-content.sh contain links to other pages. Some of these links are similar to each other--they can be subpages or even anchor links. For example:

[slack-config]: ./slack-config/
[Channel Documentation]: ./slack-config/README.md
[Slack Config Documentation]: ./slack-config/README.md
[usergroups.yaml]: ./slack-config/usergroups.yaml
[User Group Documentation]: ./slack-config/README.md#usergroups

There's a corner case in gen-content.sh that produces bogus links under these conditions. This commit fixes it.

Here's a diff with the before an after for content/:

> diff -r ~/tmp/site-no-fix/ ~/tmp/site-with-fix/
diff -r /home/rul/tmp/site-no-fix/en/docs/comms/slack.md /home/rul/tmp/site-with-fix/en/docs/comms/slack.md
398c398
< [Channel Documentation]: https://github.com/kubernetes/community/blob/master/communication/slack-configREADME.md
---
> [Channel Documentation]: https://github.com/kubernetes/community/blob/master/communication/slack-config/README.md
400c400
< [Slack Config Documentation]: https://github.com/kubernetes/community/blob/master/communication/slack-configREADME.md
---
> [Slack Config Documentation]: https://github.com/kubernetes/community/blob/master/communication/slack-config/README.md
402,403c402,403
< [usergroups.yaml]: https://github.com/kubernetes/community/blob/master/communication/slack-configusergroups.yaml
< [User Group Documentation]: https://github.com/kubernetes/community/blob/master/communication/slack-configREADME.md#usergroups
---
> [usergroups.yaml]: https://github.com/kubernetes/community/blob/master/communication/slack-config/usergroups.yaml
> [User Group Documentation]: https://github.com/kubernetes/community/blob/master/communication/slack-config/README.md#usergroups

Fixes #509.

k8s-ci-robot commented 3 weeks ago

Welcome @rul!

It looks like this is your first PR to kubernetes/contributor-site 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/contributor-site has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

nimbinatus commented 2 weeks ago

/lgtm /assign @stmcginnis

stmcginnis commented 2 weeks ago

Great catch - thanks!

/lgtm /approve

k8s-ci-robot commented 2 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rul, stmcginnis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes/contributor-site/blob/master/OWNERS)~~ [stmcginnis] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment