Skip to content

Commit 9833fd3

Browse files
committed
Fix broken CSS for book redirect pages
rust.css has to be next to the font files so we shouldn't copy it for only the book redirect pages, instead just use the version that is already there. This also removes the duplicate code creating version_info.html.
1 parent e21df80 commit 9833fd3

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/bootstrap/doc.rs

+11-16
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ impl Step for TheBook {
205205
///
206206
/// * Book (first edition)
207207
/// * Book (second edition)
208+
/// * Version info and CSS
208209
/// * Index page
209210
/// * Redirect pages
210211
fn run(self, builder: &Builder) {
211212
let build = builder.build;
213+
let compiler = self.compiler;
212214
let target = self.target;
213215
let name = self.name;
214216
// build book first edition
@@ -223,10 +225,16 @@ impl Step for TheBook {
223225
name: INTERNER.intern_string(format!("{}/second-edition", name)),
224226
});
225227

228+
// build the version info page and CSS
229+
builder.ensure(Standalone {
230+
compiler,
231+
target,
232+
});
233+
226234
// build the index page
227235
let index = format!("{}/index.md", name);
228236
println!("Documenting book index ({})", target);
229-
invoke_rustdoc(builder, self.compiler, target, &index);
237+
invoke_rustdoc(builder, compiler, target, &index);
230238

231239
// build the redirect pages
232240
println!("Documenting book redirect pages ({})", target);
@@ -235,7 +243,7 @@ impl Step for TheBook {
235243
let path = file.path();
236244
let path = path.to_str().unwrap();
237245

238-
invoke_rustdoc(builder, self.compiler, target, path);
246+
invoke_rustdoc(builder, compiler, target, path);
239247
}
240248
}
241249
}
@@ -293,25 +301,12 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
293301

294302
let favicon = build.src.join("src/doc/favicon.inc");
295303
let footer = build.src.join("src/doc/footer.inc");
296-
297-
let version_input = build.src.join("src/doc/version_info.html.template");
298304
let version_info = out.join("version_info.html");
299305

300-
if !up_to_date(&version_input, &version_info) {
301-
let mut info = String::new();
302-
t!(t!(File::open(&version_input)).read_to_string(&mut info));
303-
let info = info.replace("VERSION", &build.rust_release())
304-
.replace("SHORT_HASH", build.rust_info.sha_short().unwrap_or(""))
305-
.replace("STAMP", build.rust_info.sha().unwrap_or(""));
306-
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
307-
}
308-
309306
let mut cmd = builder.rustdoc_cmd(compiler.host);
310307

311308
let out = out.join("book");
312309

313-
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
314-
315310
cmd.arg("--html-after-content").arg(&footer)
316311
.arg("--html-before-content").arg(&version_info)
317312
.arg("--html-in-header").arg(&favicon)
@@ -320,7 +315,7 @@ fn invoke_rustdoc(builder: &Builder, compiler: Compiler, target: Interned<String
320315
.arg("-o").arg(&out)
321316
.arg(&path)
322317
.arg("--markdown-css")
323-
.arg("rust.css");
318+
.arg("../rust.css");
324319

325320
build.run(&mut cmd);
326321
}

0 commit comments

Comments
 (0)