build book index
This commit is contained in:
parent
8573a1319a
commit
5f2f3d07dc
@ -53,9 +53,58 @@ pub fn rustbook(build: &Build, target: &str, name: &str) {
|
||||
.arg(out));
|
||||
}
|
||||
|
||||
/// Build the book and associated stuff.
|
||||
///
|
||||
/// We need to build:
|
||||
///
|
||||
/// * Book (first edition)
|
||||
/// * Book (second edition)
|
||||
/// * Index page
|
||||
/// * Redirect pages
|
||||
pub fn book(build: &Build, target: &str, name: &str) {
|
||||
// build book first edition
|
||||
rustbook(build, target, &format!("{}/first-edition", name));
|
||||
|
||||
// build book second edition
|
||||
rustbook(build, target, &format!("{}/second-edition", name));
|
||||
|
||||
// build the index page
|
||||
let index = format!("{}/index.md", name);
|
||||
invoke_rustdoc(build, target, &index);
|
||||
}
|
||||
|
||||
fn invoke_rustdoc(build: &Build, target: &str, markdown: &str) {
|
||||
let out = build.doc_out(target);
|
||||
|
||||
let compiler = Compiler::new(0, &build.config.build);
|
||||
|
||||
let path = build.src.join("src/doc").join(markdown);
|
||||
|
||||
let rustdoc = build.rustdoc(&compiler);
|
||||
|
||||
let favicon = build.src.join("src/doc/favicon.inc");
|
||||
let footer = build.src.join("src/doc/footer.inc");
|
||||
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
|
||||
|
||||
let version_info = out.join("version_info.html");
|
||||
|
||||
let mut cmd = Command::new(&rustdoc);
|
||||
|
||||
build.add_rustc_lib_path(&compiler, &mut cmd);
|
||||
|
||||
let out = out.join("book");
|
||||
|
||||
cmd.arg("--html-after-content").arg(&footer)
|
||||
.arg("--html-before-content").arg(&version_info)
|
||||
.arg("--html-in-header").arg(&favicon)
|
||||
.arg("--markdown-playground-url")
|
||||
.arg("https://play.rust-lang.org/")
|
||||
.arg("-o").arg(&out)
|
||||
.arg(&path)
|
||||
.arg("--markdown-css")
|
||||
.arg("rust.css");
|
||||
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
/// Generates all standalone documentation as compiled by the rustdoc in `stage`
|
||||
|
Loading…
x
Reference in New Issue
Block a user