Skip to content

Commit 4d77198

Browse files
authored
Merge pull request #1965 from ehuss/mdbook-fragment-redirect
Switch to using native mdbook fragment redirects
2 parents 46e5bc8 + f1bee95 commit 4d77198

File tree

13 files changed

+13
-156
lines changed

13 files changed

+13
-156
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
merge_group:
55

66
env:
7-
MDBOOK_VERSION: 0.4.48
7+
MDBOOK_VERSION: 0.4.52
88

99
jobs:
1010
code-tests:

book.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ smart-punctuation = true
1515
"grammar.md" = { enable = false }
1616

1717
[output.html.redirect]
18+
"/crates-and-source-files.html#preludes-and-no_std" = "names/preludes.html"
1819
"/expressions/enum-variant-expr.html" = "struct-expr.html"
20+
"/expressions/if-expr.html#if-let-expressions" = "if-expr.html#if-let-patterns"
21+
"/expressions/loop-expr.html#predicate-pattern-loops" = "loop-expr.html#while-let-patterns"
22+
"/expressions/operator-expr.html#slice-dst-pointer-to-pointer-cast" = "operator-expr.html#pointer-to-pointer-cast"
23+
"/expressions/operator-expr.html#the-question-mark-operator" = "operator-expr.html#the-try-propagation-expression"
24+
"/glossary.html#object-safe-traits" = "glossary.html#dyn-compatible-traits"
25+
"/items/extern-crates.html#extern-prelude" = "../names/preludes.html#extern-prelude"
26+
"/items/modules.html#prelude-items" = "../names/preludes.html"
27+
"/items/traits.html#object-safety" = "traits.html#dyn-compatibility"
28+
"/lifetime-elision.html#static-lifetime-elision" = "lifetime-elision.html#const-and-static-elision"
29+
"/procedural-macros.html#derive-macros" = "procedural-macros.html#the-proc_macro_derive-attribute"
30+
"/runtime.html#the-panic_handler-attribute" = "panic.html#the-panic_handler-attribute"
1931
"/unsafe-blocks.html" = "unsafe-keyword.html"
2032
"/unsafe-functions.html" = "unsafe-keyword.html"
2133

src/crates-and-source-files.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,3 @@ or `_` (U+005F) characters.
172172
[shebang]: input-format.md#shebang-removal
173173
[trait or lifetime bounds]: trait-bounds.md
174174
[where clauses]: items/generics.md#where-clauses
175-
176-
<script>
177-
(function() {
178-
var fragments = {
179-
"#preludes-and-no_std": "names/preludes.html",
180-
};
181-
var target = fragments[window.location.hash];
182-
if (target) {
183-
var url = window.location.toString();
184-
var base = url.substring(0, url.lastIndexOf('/'));
185-
window.location.replace(base + "/" + target);
186-
}
187-
})();
188-
</script>

src/expressions/if-expr.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,3 @@ r[expr.if.edition2024]
181181
[`match` expressions]: match-expr.md
182182
[boolean type]: ../types/boolean.md
183183
[scrutinee]: ../glossary.md#scrutinee
184-
185-
<script>
186-
(function() {
187-
var fragments = {
188-
"#if-let-expressions": "if-expr.html#if-let-patterns",
189-
};
190-
var target = fragments[window.location.hash];
191-
if (target) {
192-
var url = window.location.toString();
193-
var base = url.substring(0, url.lastIndexOf('/'));
194-
window.location.replace(base + "/" + target);
195-
}
196-
})();
197-
</script>

src/expressions/loop-expr.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,3 @@ In the case a `loop` has an associated `break`, it is not considered diverging,
398398
[boolean type]: ../types/boolean.md
399399
[scrutinee]: ../glossary.md#scrutinee
400400
[temporary values]: ../expressions.md#temporaries
401-
402-
<script>
403-
(function() {
404-
var fragments = {
405-
"#predicate-pattern-loops": "loop-expr.html#while-let-patterns",
406-
};
407-
var target = fragments[window.location.hash];
408-
if (target) {
409-
var url = window.location.toString();
410-
var base = url.substring(0, url.lastIndexOf('/'));
411-
window.location.replace(base + "/" + target);
412-
}
413-
})();
414-
</script>

src/expressions/operator-expr.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -968,18 +968,3 @@ Like assignment expressions, compound assignment expressions always produce [the
968968
[undefined behavior]: ../behavior-considered-undefined.md
969969
[Underscore expressions]: ./underscore-expr.md
970970
[range expressions]: ./range-expr.md
971-
972-
<script>
973-
(function() {
974-
var fragments = {
975-
"#slice-dst-pointer-to-pointer-cast": "operator-expr.html#pointer-to-pointer-cast",
976-
"#the-question-mark-operator": "operator-expr.html#the-try-propagation-expression",
977-
};
978-
var target = fragments[window.location.hash];
979-
if (target) {
980-
var url = window.location.toString();
981-
var base = url.substring(0, url.lastIndexOf('/'));
982-
window.location.replace(base + "/" + target);
983-
}
984-
})();
985-
</script>

src/glossary.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,3 @@ example of an uninhabited type is the [never type] `!`, or an enum with no varia
328328
[unions]: items/unions.md
329329
[variable bindings]: patterns.md
330330
[visibility rules]: visibility-and-privacy.md
331-
332-
<script>
333-
(function() {
334-
var fragments = {
335-
"#object-safe-traits": "glossary.html#dyn-compatible-traits",
336-
};
337-
var target = fragments[window.location.hash];
338-
if (target) {
339-
var url = window.location.toString();
340-
var base = url.substring(0, url.lastIndexOf('/'));
341-
window.location.replace(base + "/" + target);
342-
}
343-
})();
344-
</script>

src/items/extern-crates.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,3 @@ Only the first use of `no_link` on an `extern crate` declaration has effect.
114114
[`macro_use` prelude]: ../names/preludes.md#macro_use-prelude
115115
[`crate_name` attributes]: ../crates-and-source-files.md#the-crate_name-attribute
116116
[type namespace]: ../names/namespaces.md
117-
118-
<script>
119-
(function() {
120-
var fragments = {
121-
"#extern-prelude": "../names/preludes.html#extern-prelude",
122-
};
123-
var target = fragments[window.location.hash];
124-
if (target) {
125-
var url = window.location.toString();
126-
var base = url.substring(0, url.lastIndexOf('/'));
127-
window.location.replace(base + "/" + target);
128-
}
129-
})();
130-
</script>

src/items/modules.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,3 @@ The built-in attributes that have meaning on a module are [`cfg`],
170170
[scopes chapter]: ../names/scopes.md
171171
[the lint check attributes]: ../attributes/diagnostics.md#lint-check-attributes
172172
[type namespace]: ../names/namespaces.md
173-
174-
<script>
175-
(function() {
176-
var fragments = {
177-
"#prelude-items": "../names/preludes.html",
178-
};
179-
var target = fragments[window.location.hash];
180-
if (target) {
181-
var url = window.location.toString();
182-
var base = url.substring(0, url.lastIndexOf('/'));
183-
window.location.replace(base + "/" + target);
184-
}
185-
})();
186-
</script>

src/items/traits.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -410,17 +410,3 @@ fn main() {
410410
[`async`]: functions.md#async-functions
411411
[`const`]: functions.md#const-functions
412412
[type namespace]: ../names/namespaces.md
413-
414-
<script>
415-
(function() {
416-
var fragments = {
417-
"#object-safety": "traits.html#dyn-compatibility",
418-
};
419-
var target = fragments[window.location.hash];
420-
if (target) {
421-
var url = window.location.toString();
422-
var base = url.substring(0, url.lastIndexOf('/'));
423-
window.location.replace(base + "/" + target);
424-
}
425-
})();
426-
</script>

0 commit comments

Comments
 (0)