Skip to content

Commit f8dc368

Browse files
committed
Switch to using native mdbook fragment redirects
Mdbook recently gained the ability to redirect fragments. This removes the embedded scripts to use this mechanism instead.
1 parent 1840e7a commit f8dc368

File tree

8 files changed

+55
-121
lines changed

8 files changed

+55
-121
lines changed

.github/workflows/contrib.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install mdbook
2424
run: |
2525
mkdir mdbook
26-
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.44/mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
26+
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.52/mdbook-v0.4.52-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
2727
echo `pwd`/mdbook >> $GITHUB_PATH
2828
- name: Deploy docs
2929
run: |

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ jobs:
275275
- name: Install mdbook
276276
run: |
277277
mkdir mdbook
278-
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.44/mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
278+
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.52/mdbook-v0.4.52-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
279279
echo `pwd`/mdbook >> $GITHUB_PATH
280280
- run: cd src/doc && mdbook build --dest-dir ../../target/doc
281281
- name: Run linkchecker.sh

src/doc/book.toml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,59 @@ use-boolean-and = true
1414
"CHANGELOG.md" = { enable = false }
1515

1616
[output.html.redirect]
17-
"/guide/build-cache.html" = "../reference/build-cache.html"
1817
"/commands/cargo-git-checkout.html" = "./deprecated-and-removed.html"
1918
"/commands/cargo-read-manifest.html" = "./deprecated-and-removed.html"
2019
"/commands/cargo-verify-project.html" = "./deprecated-and-removed.html"
20+
"/guide/build-cache.html" = "../reference/build-cache.html"
21+
"/reference/manifest.html#building-dynamic-or-static-libraries" = "cargo-targets.html#the-crate-type-field"
22+
"/reference/manifest.html#configuring-a-target" = "cargo-targets.html#configuring-a-target"
23+
"/reference/manifest.html#examples" = "cargo-targets.html#examples"
24+
"/reference/manifest.html#integration-tests" = "cargo-targets.html#integration-tests"
25+
"/reference/manifest.html#package-build" = "manifest.html#the-build-field"
26+
"/reference/manifest.html#package-metadata" = "manifest.html#the-package-section"
27+
"/reference/manifest.html#package-selection" = "workspaces.html#package-selection"
28+
"/reference/manifest.html#rules" = "features.html"
29+
"/reference/manifest.html#rust-version" = "rust-version.html"
30+
"/reference/manifest.html#target-auto-discovery" = "cargo-targets.html#target-auto-discovery"
31+
"/reference/manifest.html#tests" = "cargo-targets.html#tests"
32+
"/reference/manifest.html#the-authors-field-optional" = "manifest.html#the-authors-field"
33+
"/reference/manifest.html#the-build-field-optional" = "manifest.html#the-build-field"
34+
"/reference/manifest.html#the-documentation-field-optional" = "manifest.html#the-documentation-field"
35+
"/reference/manifest.html#the-edition-field-optional" = "manifest.html#the-edition-field"
36+
"/reference/manifest.html#the-exclude-and-include-fields-optional" = "manifest.html#the-exclude-and-include-fields"
37+
"/reference/manifest.html#the-features-section" = "features.html#the-features-section"
38+
"/reference/manifest.html#the-links-field-optional" = "manifest.html#the-links-field"
39+
"/reference/manifest.html#the-metadata-table-optional" = "manifest.html#the-metadata-table"
40+
"/reference/manifest.html#the-patch-section" = "overriding-dependencies.html#the-patch-section"
41+
"/reference/manifest.html#the-project-layout" = "../guide/project-layout.html"
42+
"/reference/manifest.html#the-publish--field-optional" = "manifest.html#the-publish-field"
43+
"/reference/manifest.html#the-replace-section" = "overriding-dependencies.html#the-replace-section"
44+
"/reference/manifest.html#the-required-features-field-optional" = "cargo-targets.html#the-required-features-field"
45+
"/reference/manifest.html#the-workspace--field-optional" = "manifest.html#the-workspace-field"
46+
"/reference/manifest.html#the-workspace-section" = "workspaces.html#the-workspace-section"
47+
"/reference/manifest.html#usage-in-end-products" = "features.html"
48+
"/reference/manifest.html#usage-in-packages" = "features.html"
49+
"/reference/manifest.html#using-patch-with-multiple-versions" = "overriding-dependencies.html#using-patch-with-multiple-versions"
50+
"/reference/manifest.html#virtual-workspace" = "workspaces.html"
51+
"/reference/registries.html#index-format" = "registry-index.html"
52+
"/reference/registries.html#login" = "registry-web-api.html#login"
53+
"/reference/registries.html#owners" = "registry-web-api.html#owners"
54+
"/reference/registries.html#owners-add" = "registry-web-api.html#owners-add"
55+
"/reference/registries.html#owners-list" = "registry-web-api.html#owners-list"
56+
"/reference/registries.html#owners-remove" = "registry-web-api.html#owners-remove"
57+
"/reference/registries.html#publish" = "registry-web-api.html#publish"
58+
"/reference/registries.html#running-a-registry" = "running-a-registry.html"
59+
"/reference/registries.html#search" = "registry-web-api.html#search"
60+
"/reference/registries.html#unyank" = "registry-web-api.html#unyank"
61+
"/reference/registries.html#web-api" = "registry-web-api.html"
62+
"/reference/registries.html#yank" = "registry-web-api.html#yank"
63+
"/reference/resolver.html#other-constraints" = "#constraints-and-heuristics"
64+
"/reference/resolver.html#pre-releases" = "specifying-dependencies.html#pre-releases"
65+
"/reference/resolver.html#version-metadata" = "specifying-dependencies.html#version-metadata"
66+
"/reference/specifying-dependencies.html#overriding-dependencies" = "overriding-dependencies.html"
67+
"/reference/specifying-dependencies.html#overriding-repository-url" = "overriding-dependencies.html#overriding-repository-url"
68+
"/reference/specifying-dependencies.html#overriding-with-local-dependencies" = "overriding-dependencies.html#paths-overrides"
69+
"/reference/specifying-dependencies.html#prepublishing-a-breaking-change" = "overriding-dependencies.html#prepublishing-a-breaking-change"
70+
"/reference/specifying-dependencies.html#testing-a-bugfix" = "overriding-dependencies.html#testing-a-bugfix"
71+
"/reference/specifying-dependencies.html#working-with-an-unpublished-minor-version" = "overriding-dependencies.html#working-with-an-unpublished-minor-version"
72+
"/reference/workspaces.html#virtual-manifest" = "workspaces.html#virtual-workspace"

src/doc/src/reference/manifest.md

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -647,46 +647,3 @@ more detail.
647647
[spdx-license-list-3.20]: https://github.com/spdx/license-list-data/tree/v3.20
648648
[SPDX site]: https://spdx.org
649649
[TOML]: https://toml.io/
650-
651-
<script>
652-
(function() {
653-
var fragments = {
654-
"#the-project-layout": "../guide/project-layout.html",
655-
"#examples": "cargo-targets.html#examples",
656-
"#tests": "cargo-targets.html#tests",
657-
"#integration-tests": "cargo-targets.html#integration-tests",
658-
"#configuring-a-target": "cargo-targets.html#configuring-a-target",
659-
"#target-auto-discovery": "cargo-targets.html#target-auto-discovery",
660-
"#the-required-features-field-optional": "cargo-targets.html#the-required-features-field",
661-
"#building-dynamic-or-static-libraries": "cargo-targets.html#the-crate-type-field",
662-
"#the-workspace-section": "workspaces.html#the-workspace-section",
663-
"#virtual-workspace": "workspaces.html",
664-
"#package-selection": "workspaces.html#package-selection",
665-
"#the-features-section": "features.html#the-features-section",
666-
"#rules": "features.html",
667-
"#usage-in-end-products": "features.html",
668-
"#usage-in-packages": "features.html",
669-
"#the-patch-section": "overriding-dependencies.html#the-patch-section",
670-
"#using-patch-with-multiple-versions": "overriding-dependencies.html#using-patch-with-multiple-versions",
671-
"#the-replace-section": "overriding-dependencies.html#the-replace-section",
672-
"#package-metadata": "manifest.html#the-package-section",
673-
"#the-authors-field-optional": "manifest.html#the-authors-field",
674-
"#the-edition-field-optional": "manifest.html#the-edition-field",
675-
"#the-documentation-field-optional": "manifest.html#the-documentation-field",
676-
"#the-workspace--field-optional": "manifest.html#the-workspace-field",
677-
"#package-build": "manifest.html#the-build-field",
678-
"#the-build-field-optional": "manifest.html#the-build-field",
679-
"#the-links-field-optional": "manifest.html#the-links-field",
680-
"#the-exclude-and-include-fields-optional": "manifest.html#the-exclude-and-include-fields",
681-
"#the-publish--field-optional": "manifest.html#the-publish-field",
682-
"#the-metadata-table-optional": "manifest.html#the-metadata-table",
683-
"#rust-version": "rust-version.html",
684-
};
685-
var target = fragments[window.location.hash];
686-
if (target) {
687-
var url = window.location.toString();
688-
var base = url.substring(0, url.lastIndexOf('/'));
689-
window.location.replace(base + "/" + target);
690-
}
691-
})();
692-
</script>

src/doc/src/reference/registries.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -129,29 +129,3 @@ controlled via the [`registries.crates-io.protocol`] config key.
129129
[config]: config.md
130130
[crates.io]: https://crates.io/
131131
[`registries.crates-io.protocol`]: config.md#registriescrates-ioprotocol
132-
133-
134-
<script>
135-
(function() {
136-
var fragments = {
137-
"#running-a-registry": "running-a-registry.html",
138-
"#index-format": "registry-index.html",
139-
"#web-api": "registry-web-api.html",
140-
"#publish": "registry-web-api.html#publish",
141-
"#yank": "registry-web-api.html#yank",
142-
"#unyank": "registry-web-api.html#unyank",
143-
"#owners": "registry-web-api.html#owners",
144-
"#owners-list": "registry-web-api.html#owners-list",
145-
"#owners-add": "registry-web-api.html#owners-add",
146-
"#owners-remove": "registry-web-api.html#owners-remove",
147-
"#search": "registry-web-api.html#search",
148-
"#login": "registry-web-api.html#login",
149-
};
150-
var target = fragments[window.location.hash];
151-
if (target) {
152-
var url = window.location.toString();
153-
var base = url.substring(0, url.lastIndexOf('/'));
154-
window.location.replace(base + "/" + target);
155-
}
156-
})();
157-
</script>

src/doc/src/reference/resolver.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -697,19 +697,3 @@ circumstances:
697697
dependency.
698698

699699
[`cargo install`]: ../commands/cargo-install.md
700-
701-
<script>
702-
(function() {
703-
var fragments = {
704-
"#version-metadata": "specifying-dependencies.html#version-metadata",
705-
"#pre-releases": "specifying-dependencies.html#pre-releases",
706-
"#other-constraints": "#constraints-and-heuristics",
707-
};
708-
var target = fragments[window.location.hash];
709-
if (target) {
710-
var url = window.location.toString();
711-
var base = url.substring(0, url.lastIndexOf('/'));
712-
window.location.replace(base + "/" + target);
713-
}
714-
})();
715-
</script>

src/doc/src/reference/specifying-dependencies.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -667,22 +667,3 @@ rand = { workspace = true, optional = true }
667667
[workspace.dependencies]: workspaces.md#the-dependencies-table
668668
[optional]: features.md#optional-dependencies
669669
[features]: features.md
670-
671-
<script>
672-
(function() {
673-
var fragments = {
674-
"#overriding-dependencies": "overriding-dependencies.html",
675-
"#testing-a-bugfix": "overriding-dependencies.html#testing-a-bugfix",
676-
"#working-with-an-unpublished-minor-version": "overriding-dependencies.html#working-with-an-unpublished-minor-version",
677-
"#overriding-repository-url": "overriding-dependencies.html#overriding-repository-url",
678-
"#prepublishing-a-breaking-change": "overriding-dependencies.html#prepublishing-a-breaking-change",
679-
"#overriding-with-local-dependencies": "overriding-dependencies.html#paths-overrides",
680-
};
681-
var target = fragments[window.location.hash];
682-
if (target) {
683-
var url = window.location.toString();
684-
var base = url.substring(0, url.lastIndexOf('/'));
685-
window.location.replace(base + "/" + target);
686-
}
687-
})();
688-
</script>

src/doc/src/reference/workspaces.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,17 +299,3 @@ if that makes sense for the tool in question.
299299
[specifying-dependencies]: specifying-dependencies.md
300300
[features]: features.md
301301
[inheriting-a-dependency-from-a-workspace]: specifying-dependencies.md#inheriting-a-dependency-from-a-workspace
302-
303-
<script>
304-
(function() {
305-
var fragments = {
306-
"#virtual-manifest": "workspaces.html#virtual-workspace",
307-
};
308-
var target = fragments[window.location.hash];
309-
if (target) {
310-
var url = window.location.toString();
311-
var base = url.substring(0, url.lastIndexOf('/'));
312-
window.location.replace(base + "/" + target);
313-
}
314-
})();
315-
</script>

0 commit comments

Comments
 (0)