Skip to content

Commit 4578859

Browse files
Update CI to ensure correct links
1 parent b0023aa commit 4578859

35 files changed

Lines changed: 362 additions & 62 deletions

.github/workflows/docs-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,8 @@ jobs:
4242
- name: Build Jekyll site
4343
run: bundle exec jekyll build --baseurl "/docs"
4444

45+
- name: Check internal links
46+
run: python scripts/check_internal_links.py --site-dir _site --base-path /docs
47+
4548
- name: Check Pages artifact
4649
run: python scripts/check_pages_artifact.py --site-dir _site --base-path /docs

.github/workflows/docs-deploy-pages.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ jobs:
5454
- name: Build Jekyll site
5555
run: bundle exec jekyll build --baseurl "/docs"
5656

57+
- name: Check internal links
58+
run: python scripts/check_internal_links.py --site-dir _site --base-path /docs
59+
5760
- name: Check Pages artifact
5861
run: python scripts/check_pages_artifact.py --site-dir _site --base-path /docs
5962

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
from pathlib import Path
2+
3+
from scripts.check_internal_links import check_site
4+
5+
6+
def write(tmp_path: Path, relative_path: str, content: str) -> None:
7+
target = tmp_path / relative_path
8+
target.parent.mkdir(parents=True, exist_ok=True)
9+
target.write_text(content, encoding="utf-8")
10+
11+
12+
def test_check_site_accepts_valid_internal_links(tmp_path: Path) -> None:
13+
write(
14+
tmp_path,
15+
"index.html",
16+
"""
17+
<html><body>
18+
<a href="/docs/fr/docs/demarrage/">French getting started</a>
19+
<a href="/docs/fr/docs/guide-langage/toutes-langues/#equivalents">All languages</a>
20+
</body></html>
21+
""",
22+
)
23+
write(
24+
tmp_path,
25+
"fr/docs/demarrage/index.html",
26+
"""
27+
<html><body>
28+
<a href="/docs/fr/docs/guide-langage/toutes-langues/#equivalents">Guide</a>
29+
</body></html>
30+
""",
31+
)
32+
write(
33+
tmp_path,
34+
"fr/docs/guide-langage/toutes-langues/index.html",
35+
"""
36+
<html><body>
37+
<h1 id="equivalents">Equivalents</h1>
38+
</body></html>
39+
""",
40+
)
41+
42+
assert check_site(tmp_path, base_path="/docs") == []
43+
44+
45+
def test_check_site_rejects_root_relative_links_without_base_path(tmp_path: Path) -> None:
46+
write(
47+
tmp_path,
48+
"fr/docs/demarrage/demarrage-rapide/index.html",
49+
"""
50+
<html><body>
51+
<a href="/fr/docs/guide-langage/toutes-langues/">Broken link</a>
52+
</body></html>
53+
""",
54+
)
55+
write(
56+
tmp_path,
57+
"fr/docs/guide-langage/toutes-langues/index.html",
58+
"<html><body></body></html>",
59+
)
60+
61+
errors = check_site(tmp_path, base_path="/docs")
62+
63+
assert len(errors) == 1
64+
assert "bypasses base path /docs" in errors[0]
65+
66+
67+
def test_check_site_rejects_missing_anchor(tmp_path: Path) -> None:
68+
write(
69+
tmp_path,
70+
"fr/docs/demarrage/index.html",
71+
"""
72+
<html><body>
73+
<a href="/docs/fr/docs/guide-langage/#missing-anchor">Guide</a>
74+
</body></html>
75+
""",
76+
)
77+
write(
78+
tmp_path,
79+
"fr/docs/guide-langage/index.html",
80+
"""
81+
<html><body>
82+
<h1 id="existing-anchor">Guide</h1>
83+
</body></html>
84+
""",
85+
)
86+
87+
errors = check_site(tmp_path, base_path="/docs")
88+
89+
assert len(errors) == 1
90+
assert "missing anchor #missing-anchor" in errors[0]

docs/content/en/codegen/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ multilingual build-wasm-bundle program.ml --out-dir wasm-out
157157

158158
The generated WAT module exports `__main` and uses host-import callbacks (`env.print_str`, `env.print_f64`, etc.) for output — it does not return values.
159159

160-
See [WASM Architecture](/wasm/architecture/) for the full pipeline and host import protocol.
160+
See [WASM Architecture]({{ '/en/docs/wasm/architecture/' | relative_url }}) for the full pipeline and host import protocol.
161161

162162
---
163163

docs/content/en/design/frontend-contracts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ When adding language `xx`:
167167
3. Satisfies compositionality: each concept keyword maps to exactly one concept
168168
4. (If adding surface patterns): patterns are narrow, tested, and non-overlapping
169169

170-
See [Adding a Language](/extending/) for the full checklist.
170+
See [Adding a Language]({{ '/en/docs/extending/' | relative_url }}) for the full checklist.

docs/content/en/design/stdlib-localization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ These are the built-ins that currently have localized aliases across the 17 supp
134134
### String/Encoding
135135
`chr`, `ord`, `format`
136136

137-
See [Built-in Aliases Reference](/en/docs/reference/builtins/) for the complete table across all languages.
137+
See [Built-in Aliases Reference]({{ '/en/docs/reference/builtins/' | relative_url }}) for the complete table across all languages.
138138

139139
---
140140

@@ -170,7 +170,7 @@ Structure:
170170
Guidelines for adding new aliases:
171171
- Must be complete and unambiguous in the target language
172172
- Must not conflict with existing Python keywords or other aliases in the same language
173-
- Must pass collision detection (see [Translation Guidelines](/extending/translation/))
173+
- Must pass collision detection (see [Translation Guidelines]({{ '/en/docs/extending/translation/' | relative_url }}))
174174
- Should use full natural words, not abbreviations
175175

176176
---

docs/content/en/extending/cnl-scope.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The CNL approach is related to:
147147
- **Racket #lang** — explicit language selection at module boundary, shared semantic core
148148
- **ALGOL 68** — multiple publication languages mapping to one formal definition
149149

150-
See [Related Work](/design/related-work/) for more context.
150+
See [Related Work]({{ '/en/docs/design/related-work/' | relative_url }}) for more context.
151151

152152
---
153153

docs/content/en/extending/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permalink: /en/docs/extending/
1111

1212
multilingual is designed so new programming languages can be added primarily by updating **data files** (JSON), not parser or codegen logic.
1313

14-
Language onboarding follows a controlled-language policy: add deterministic, testable surface forms only. See [CNL Scope](/extending/cnl-scope/).
14+
Language onboarding follows a controlled-language policy: add deterministic, testable surface forms only. See [CNL Scope]({{ '/en/docs/extending/cnl-scope/' | relative_url }}).
1515

1616
---
1717

docs/content/en/extending/translation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Before submitting a language pack PR:
189189

190190
## Resources
191191

192-
- [Adding a New Language](/extending/) — Full onboarding guide
192+
- [Adding a New Language]({{ '/en/docs/extending/' | relative_url }}) — Full onboarding guide
193193
- `multilingualprogramming/resources/usm/keywords.json` — Keyword data file
194194
- `multilingualprogramming/resources/usm/builtins_aliases.json` — Builtin aliases
195195
- `multilingualprogramming/keyword/keyword_validator.py` — Validation logic

docs/content/en/getting-started/quick-start.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ status: source
1010
permalink: /en/docs/getting-started/quick-start/
1111
---
1212

13-
This guide walks through the core language features in 10 minutes using English. Every construct shown here is available in all 17 languages — see the [Language Guide](/en/docs/language-guide/all-languages/) for equivalents.
13+
This guide walks through the core language features in 10 minutes using English. Every construct shown here is available in all 17 languages — see the [Language Guide]({{ '/en/docs/language-guide/all-languages/' | relative_url }}) for equivalents.
1414

1515
---
1616

@@ -171,4 +171,4 @@ Augmented assignment:
171171
## Next: All 17 Languages
172172

173173
Every feature above is available in all 17 supported languages.
174-
See [All Languages Reference](/en/docs/language-guide/all-languages/) for the complete keyword and syntax mapping.
174+
See [All Languages Reference]({{ '/en/docs/language-guide/all-languages/' | relative_url }}) for the complete keyword and syntax mapping.

0 commit comments

Comments
 (0)