Skip to content

Commit 59b4f88

Browse files
authored
Rollup merge of #86933 - GuillaumeGomez:cleanup-rustdoc-static-files, r=Manishearth
Clean up rustdoc static files The `html/static` of rustdoc was starting to be quite a mess... So I moved files in sub-folders to make it easier to follow. Here what remains in `html/static` folder: ``` $ ls COPYRIGHT.txt css fonts images js LICENSE-APACHE.txt LICENSE-MIT.txt ``` cc ```@jyn514``` r? ```@Manishearth```
2 parents 463301a + e5c24ba commit 59b4f88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+48
-47
lines changed

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ impl Step for RustdocTheme {
742742
let rustdoc = builder.out.join("bootstrap/debug/rustdoc");
743743
let mut cmd = builder.tool_cmd(Tool::RustdocTheme);
744744
cmd.arg(rustdoc.to_str().unwrap())
745-
.arg(builder.src.join("src/librustdoc/html/static/themes").to_str().unwrap())
745+
.arg(builder.src.join("src/librustdoc/html/static/css/themes").to_str().unwrap())
746746
.env("RUSTC_STAGE", self.compiler.stage.to_string())
747747
.env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
748748
.env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host))

src/ci/docker/host-x86_64/mingw-check/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
4040
/scripts/validate-toolstate.sh && \
4141
/scripts/validate-error-codes.sh && \
4242
# Runs checks to ensure that there are no ES5 issues in our JS code.
43-
es-check es5 ../src/librustdoc/html/static/*.js && \
44-
eslint ../src/librustdoc/html/static/*.js
43+
es-check es5 ../src/librustdoc/html/static/js/*.js && \
44+
eslint ../src/librustdoc/html/static/js/*.js

src/librustdoc/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl Options {
513513
))
514514
.warn("the theme may appear incorrect when loaded")
515515
.help(&format!(
516-
"to see what rules are missing, call `rustdoc --check-theme \"{}\"`",
516+
"to see what rules are missing, call `rustdoc --check-theme \"{}\"`",
517517
theme_s
518518
))
519519
.emit();

src/librustdoc/html/static_files.rs

+42-41
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,44 @@
88
//! directly written to a `Write` handle.
99
1010
/// The file contents of the main `rustdoc.css` file, responsible for the core layout of the page.
11-
crate static RUSTDOC_CSS: &str = include_str!("static/rustdoc.css");
11+
crate static RUSTDOC_CSS: &str = include_str!("static/css/rustdoc.css");
1212

1313
/// The file contents of `settings.css`, responsible for the items on the settings page.
14-
crate static SETTINGS_CSS: &str = include_str!("static/settings.css");
14+
crate static SETTINGS_CSS: &str = include_str!("static/css/settings.css");
1515

1616
/// The file contents of the `noscript.css` file, used in case JS isn't supported or is disabled.
17-
crate static NOSCRIPT_CSS: &str = include_str!("static/noscript.css");
17+
crate static NOSCRIPT_CSS: &str = include_str!("static/css/noscript.css");
1818

1919
/// The file contents of `normalize.css`, included to even out standard elements between browser
2020
/// implementations.
21-
crate static NORMALIZE_CSS: &str = include_str!("static/normalize.css");
21+
crate static NORMALIZE_CSS: &str = include_str!("static/css/normalize.css");
2222

2323
/// The file contents of `main.js`, which contains the core JavaScript used on documentation pages,
2424
/// including search behavior and docblock folding, among others.
25-
crate static MAIN_JS: &str = include_str!("static/main.js");
25+
crate static MAIN_JS: &str = include_str!("static/js/main.js");
2626

2727
/// The file contents of `search.js`, which contains the search behavior.
28-
crate static SEARCH_JS: &str = include_str!("static/search.js");
28+
crate static SEARCH_JS: &str = include_str!("static/js/search.js");
2929

3030
/// The file contents of `settings.js`, which contains the JavaScript used to handle the settings
3131
/// page.
32-
crate static SETTINGS_JS: &str = include_str!("static/settings.js");
32+
crate static SETTINGS_JS: &str = include_str!("static/js/settings.js");
3333

3434
/// The file contents of `storage.js`, which contains functionality related to browser Local
3535
/// Storage, used to store documentation settings.
36-
crate static STORAGE_JS: &str = include_str!("static/storage.js");
36+
crate static STORAGE_JS: &str = include_str!("static/js/storage.js");
3737

3838
/// The file contents of `brush.svg`, the icon used for the theme-switch button.
39-
crate static BRUSH_SVG: &[u8] = include_bytes!("static/brush.svg");
39+
crate static BRUSH_SVG: &[u8] = include_bytes!("static/images/brush.svg");
4040

4141
/// The file contents of `wheel.svg`, the icon used for the settings button.
42-
crate static WHEEL_SVG: &[u8] = include_bytes!("static/wheel.svg");
42+
crate static WHEEL_SVG: &[u8] = include_bytes!("static/images/wheel.svg");
4343

4444
/// The file contents of `clipboard.svg`, the icon used for the "copy path" button.
45-
crate static CLIPBOARD_SVG: &[u8] = include_bytes!("static/clipboard.svg");
45+
crate static CLIPBOARD_SVG: &[u8] = include_bytes!("static/images/clipboard.svg");
4646

4747
/// The file contents of `down-arrow.svg`, the icon used for the crate choice combobox.
48-
crate static DOWN_ARROW_SVG: &[u8] = include_bytes!("static/down-arrow.svg");
48+
crate static DOWN_ARROW_SVG: &[u8] = include_bytes!("static/images/down-arrow.svg");
4949

5050
/// The contents of `COPYRIGHT.txt`, the license listing for files distributed with documentation
5151
/// output.
@@ -58,113 +58,114 @@ crate static LICENSE_APACHE: &[u8] = include_bytes!("static/LICENSE-APACHE.txt")
5858
crate static LICENSE_MIT: &[u8] = include_bytes!("static/LICENSE-MIT.txt");
5959

6060
/// The contents of `rust-logo.png`, the default icon of the documentation.
61-
crate static RUST_LOGO: &[u8] = include_bytes!("static/rust-logo.png");
61+
crate static RUST_LOGO: &[u8] = include_bytes!("static/images/rust-logo.png");
6262
/// The default documentation favicons (SVG and PNG fallbacks)
63-
crate static RUST_FAVICON_SVG: &[u8] = include_bytes!("static/favicon.svg");
64-
crate static RUST_FAVICON_PNG_16: &[u8] = include_bytes!("static/favicon-16x16.png");
65-
crate static RUST_FAVICON_PNG_32: &[u8] = include_bytes!("static/favicon-32x32.png");
63+
crate static RUST_FAVICON_SVG: &[u8] = include_bytes!("static/images/favicon.svg");
64+
crate static RUST_FAVICON_PNG_16: &[u8] = include_bytes!("static/images/favicon-16x16.png");
65+
crate static RUST_FAVICON_PNG_32: &[u8] = include_bytes!("static/images/favicon-32x32.png");
6666

6767
crate static PAGE: &str = include_str!("templates/page.html");
6868

6969
/// The built-in themes given to every documentation site.
7070
crate mod themes {
7171
/// The "light" theme, selected by default when no setting is available. Used as the basis for
7272
/// the `--check-theme` functionality.
73-
crate static LIGHT: &str = include_str!("static/themes/light.css");
73+
crate static LIGHT: &str = include_str!("static/css/themes/light.css");
7474

7575
/// The "dark" theme.
76-
crate static DARK: &str = include_str!("static/themes/dark.css");
76+
crate static DARK: &str = include_str!("static/css/themes/dark.css");
7777

7878
/// The "ayu" theme.
79-
crate static AYU: &str = include_str!("static/themes/ayu.css");
79+
crate static AYU: &str = include_str!("static/css/themes/ayu.css");
8080
}
8181

8282
/// Files related to the Fira Sans font.
8383
crate mod fira_sans {
8484
/// The file `FiraSans-Regular.woff`, the Regular variant of the Fira Sans font.
85-
crate static REGULAR: &[u8] = include_bytes!("static/FiraSans-Regular.woff");
85+
crate static REGULAR: &[u8] = include_bytes!("static/fonts/FiraSans-Regular.woff");
8686

8787
/// The file `FiraSans-Regular.woff2`, the Regular variant of the Fira Sans font in woff2.
88-
crate static REGULAR2: &[u8] = include_bytes!("static/FiraSans-Regular.woff2");
88+
crate static REGULAR2: &[u8] = include_bytes!("static/fonts/FiraSans-Regular.woff2");
8989

9090
/// The file `FiraSans-Medium.woff`, the Medium variant of the Fira Sans font.
91-
crate static MEDIUM: &[u8] = include_bytes!("static/FiraSans-Medium.woff");
91+
crate static MEDIUM: &[u8] = include_bytes!("static/fonts/FiraSans-Medium.woff");
9292

9393
/// The file `FiraSans-Medium.woff2`, the Medium variant of the Fira Sans font in woff2.
94-
crate static MEDIUM2: &[u8] = include_bytes!("static/FiraSans-Medium.woff2");
94+
crate static MEDIUM2: &[u8] = include_bytes!("static/fonts/FiraSans-Medium.woff2");
9595

9696
/// The file `FiraSans-LICENSE.txt`, the license text for the Fira Sans font.
97-
crate static LICENSE: &[u8] = include_bytes!("static/FiraSans-LICENSE.txt");
97+
crate static LICENSE: &[u8] = include_bytes!("static/fonts/FiraSans-LICENSE.txt");
9898
}
9999

100100
/// Files related to the Source Serif 4 font.
101101
crate mod source_serif_4 {
102102
/// The file `SourceSerif4-Regular.ttf.woff`, the Regular variant of the Source Serif 4 font.
103-
crate static REGULAR: &[u8] = include_bytes!("static/SourceSerif4-Regular.ttf.woff");
103+
crate static REGULAR: &[u8] = include_bytes!("static/fonts/SourceSerif4-Regular.ttf.woff");
104104

105105
/// The file `SourceSerif4-Regular.ttf.woff2`, the Regular variant of the Source Serif 4 font in
106106
/// woff2.
107-
crate static REGULAR2: &[u8] = include_bytes!("static/SourceSerif4-Regular.ttf.woff2");
107+
crate static REGULAR2: &[u8] = include_bytes!("static/fonts/SourceSerif4-Regular.ttf.woff2");
108108

109109
/// The file `SourceSerif4-Bold.ttf.woff`, the Bold variant of the Source Serif 4 font.
110-
crate static BOLD: &[u8] = include_bytes!("static/SourceSerif4-Bold.ttf.woff");
110+
crate static BOLD: &[u8] = include_bytes!("static/fonts/SourceSerif4-Bold.ttf.woff");
111111

112112
/// The file `SourceSerif4-Bold.ttf.woff2`, the Bold variant of the Source Serif 4 font in
113113
/// woff2.
114-
crate static BOLD2: &[u8] = include_bytes!("static/SourceSerif4-Bold.ttf.woff2");
114+
crate static BOLD2: &[u8] = include_bytes!("static/fonts/SourceSerif4-Bold.ttf.woff2");
115115

116116
/// The file `SourceSerif4-It.ttf.woff`, the Italic variant of the Source Serif 4 font.
117-
crate static ITALIC: &[u8] = include_bytes!("static/SourceSerif4-It.ttf.woff");
117+
crate static ITALIC: &[u8] = include_bytes!("static/fonts/SourceSerif4-It.ttf.woff");
118118

119119
/// The file `SourceSerif4-It.ttf.woff2`, the Italic variant of the Source Serif 4 font in
120120
/// woff2.
121-
crate static ITALIC2: &[u8] = include_bytes!("static/SourceSerif4-It.ttf.woff2");
121+
crate static ITALIC2: &[u8] = include_bytes!("static/fonts/SourceSerif4-It.ttf.woff2");
122122

123123
/// The file `SourceSerif4-LICENSE.txt`, the license text for the Source Serif 4 font.
124-
crate static LICENSE: &[u8] = include_bytes!("static/SourceSerif4-LICENSE.md");
124+
crate static LICENSE: &[u8] = include_bytes!("static/fonts/SourceSerif4-LICENSE.md");
125125
}
126126

127127
/// Files related to the Source Code Pro font.
128128
crate mod source_code_pro {
129129
/// The file `SourceCodePro-Regular.ttf.woff`, the Regular variant of the Source Code Pro font.
130-
crate static REGULAR: &[u8] = include_bytes!("static/SourceCodePro-Regular.ttf.woff");
130+
crate static REGULAR: &[u8] = include_bytes!("static/fonts/SourceCodePro-Regular.ttf.woff");
131131

132132
/// The file `SourceCodePro-Regular.ttf.woff2`, the Regular variant of the Source Code Pro font
133133
/// in woff2.
134-
crate static REGULAR2: &[u8] = include_bytes!("static/SourceCodePro-Regular.ttf.woff2");
134+
crate static REGULAR2: &[u8] = include_bytes!("static/fonts/SourceCodePro-Regular.ttf.woff2");
135135

136136
/// The file `SourceCodePro-Semibold.ttf.woff`, the Semibold variant of the Source Code Pro
137137
/// font.
138-
crate static SEMIBOLD: &[u8] = include_bytes!("static/SourceCodePro-Semibold.ttf.woff");
138+
crate static SEMIBOLD: &[u8] = include_bytes!("static/fonts/SourceCodePro-Semibold.ttf.woff");
139139

140140
/// The file `SourceCodePro-Semibold.ttf.woff2`, the Semibold variant of the Source Code Pro
141141
/// font in woff2.
142-
crate static SEMIBOLD2: &[u8] = include_bytes!("static/SourceCodePro-Semibold.ttf.woff2");
142+
crate static SEMIBOLD2: &[u8] = include_bytes!("static/fonts/SourceCodePro-Semibold.ttf.woff2");
143143

144144
/// The file `SourceCodePro-It.ttf.woff`, the Italic variant of the Source Code Pro font.
145-
crate static ITALIC: &[u8] = include_bytes!("static/SourceCodePro-It.ttf.woff");
145+
crate static ITALIC: &[u8] = include_bytes!("static/fonts/SourceCodePro-It.ttf.woff");
146146

147147
/// The file `SourceCodePro-It.ttf.woff2`, the Italic variant of the Source Code Pro font in
148148
/// woff2.
149-
crate static ITALIC2: &[u8] = include_bytes!("static/SourceCodePro-It.ttf.woff2");
149+
crate static ITALIC2: &[u8] = include_bytes!("static/fonts/SourceCodePro-It.ttf.woff2");
150150

151151
/// The file `SourceCodePro-LICENSE.txt`, the license text of the Source Code Pro font.
152-
crate static LICENSE: &[u8] = include_bytes!("static/SourceCodePro-LICENSE.txt");
152+
crate static LICENSE: &[u8] = include_bytes!("static/fonts/SourceCodePro-LICENSE.txt");
153153
}
154154

155155
crate mod noto_sans_kr {
156156
/// The file `noto-sans-kr-v13-korean-regular.woff`, the Regular variant of the Noto Sans KR
157157
/// font.
158-
crate static REGULAR: &[u8] = include_bytes!("static/noto-sans-kr-v13-korean-regular.woff");
158+
crate static REGULAR: &[u8] =
159+
include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular.woff");
159160

160161
/// The file `noto-sans-kr-v13-korean-regular-LICENSE.txt`, the license text of the Noto Sans KR
161162
/// font.
162163
crate static LICENSE: &[u8] =
163-
include_bytes!("static/noto-sans-kr-v13-korean-regular-LICENSE.txt");
164+
include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt");
164165
}
165166

166167
/// Files related to the sidebar in rustdoc sources.
167168
crate mod sidebar {
168169
/// File script to handle sidebar.
169-
crate static SOURCE_SCRIPT: &str = include_str!("static/source-script.js");
170+
crate static SOURCE_SCRIPT: &str = include_str!("static/js/source-script.js");
170171
}

src/librustdoc/theme/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn check_invalid_css() {
105105

106106
#[test]
107107
fn test_with_minification() {
108-
let text = include_str!("../html/static/themes/dark.css");
108+
let text = include_str!("../html/static/css/themes/dark.css");
109109
let minified = minifier::css::minify(&text).expect("CSS minification failed");
110110

111111
let against = load_css_paths(text.as_bytes());

src/test/run-make-fulldeps/rustdoc-themes/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes"
66

77
all:
8-
cp $(S)/src/librustdoc/html/static/themes/light.css $(TMPDIR)/test.css
8+
cp $(S)/src/librustdoc/html/static/css/themes/light.css $(TMPDIR)/test.css
99
$(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css
1010
$(HTMLDOCCK) $(OUTPUT_DIR) foo.rs

0 commit comments

Comments
 (0)