Skip to content

Commit 94ee454

Browse files
authored
feat: fix broken links (#81)
A few links were broken by not having their underscores replaced with hyphens, meaning they weren't matching the filenames.
1 parent 9688d22 commit 94ee454

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

.github/workflows/contrib.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: Copy CONTRIBUTING.md into docs
3030
run: |
3131
sed -i -e 's|./docs/||g' hyper/CONTRIBUTING.md
32-
cp -a hyper/CONTRIBUTING.md hyper/docs
33-
32+
cp -a hyper/CONTRIBUTING.md hyper/docs/CONTRIBUTING.md
33+
3434
# Insert frontmatter borders, replace markdown header with
3535
# frontmatter title and insert layout: guide
3636
- name: Convert doc titles to frontmatter
@@ -49,23 +49,34 @@ jobs:
4949
sed -i -e '4i permalink: /contrib/' hyper/docs/README.md
5050
mv hyper/docs/README.md hyper/docs/index.md
5151
52-
# Lowercase the internal links so they will correctly point to
53-
# the lowercased filenames.
52+
53+
# Lowercase the internal links and replace underscores with
54+
# hyphens, so they will point to the correct file.
5455
- name: Lowercase internal links
5556
run: |
5657
for filename in hyper/docs/*.md; do
5758
# cut `.md` from the filename before search and replace
5859
filename=${filename::-3};
5960
6061
for file in hyper/docs/*.md; do
62+
# filename without parent path
63+
filename=${filename##*/}
64+
6165
# don't lowercase MSRV
62-
if [[ "${filename##*/}" == 'MSRV' ]]; then
66+
if [[ "${filename}" == 'MSRV' ]]; then
6367
continue
6468
fi
6569
66-
# match instances of only the filename, not including
67-
# the parent path, and convert them to lowercase
68-
sed -i -e "s|${filename##*/}|\L\0|g" $file;
70+
# lowercase filenames
71+
sed -i -e "s|${filename}|${filename,,}|g" $file;
72+
73+
# match on the lowercased filename from here on
74+
lowercased=${filename,,}
75+
76+
hyphenated=${lowercased//_/-}
77+
78+
# replace underscores in internal links with hyphens
79+
sed -i -e "s|${lowercased}|${hyphenated}|g" $file;
6980
done
7081
done
7182
@@ -75,7 +86,7 @@ jobs:
7586
mv -vn "$f" "$(echo "$f" | tr '[:upper:]' '[:lower:]' | tr '_' '-')";
7687
done
7788
78-
- name: Copy docs to contrib
89+
- name: Copy the hyper docs to contrib
7990
run: |
8091
mkdir -p _contrib
8192
cp -a hyper/docs/. _contrib/

_contrib/contributing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You want to contribute? You're awesome! Don't know where to start? Check the [li
88
[easy tag]: https://github.com/hyperium/hyper/issues?q=label%3AE-easy+is%3Aopen
99

1010

11-
## [Pull Requests](pull_requests.md)
11+
## [Pull Requests](pull-requests.md)
1212

13-
- [Submitting a Pull Request](pull_requests.md#submitting-a-pull-request)
13+
- [Submitting a Pull Request](pull-requests.md#submitting-a-pull-request)
1414
- [Commit Guidelines](commits.md)

_contrib/governance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@ Maintainers are the project admins. Besides being a collaborator, they take care
109109
of house-keeping duties, help lead the direction, and have the final authority when
110110
required.
111111

112-
[coc]: ./code_of_conduct.md
112+
[coc]: ./code-of-conduct.md
113113
[contrib]: ../contributing.md
114114
[triage-guide]: ./issues.md#triaging

_contrib/issues.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,6 @@ The severity marks how _severe_ the issue is. Note this isn't "importance" or "p
112112
- **S-refactor**: improve internal code to help readability and maintenance.
113113

114114
[issues]: https://github.com/hyperium/hyper/issues
115-
[COC]: ./code_of_conduct.md
116-
[PRs]: ./pull_requests.md
115+
[COC]: ./code-of-conduct.md
116+
[PRs]: ./pull-requests.md
117117
[MRE]: https://en.wikipedia.org/wiki/Minimal_reproducible_example

_contrib/tenets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ community building and using it. All contributions are in the open. We don't
2020
maintain private versions, and don't include features that aren't useful to
2121
others.
2222

23-
[We prioritize kindness](./code_of_conduct.md), compassion and empathy towards all
23+
[We prioritize kindness](./code-of-conduct.md), compassion and empathy towards all
2424
contributors. Technical skill is not a substitute for human decency.
2525

2626
### Examples

0 commit comments

Comments
 (0)