mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
rustdoc: include index-page in dep-info
This commit is contained in:
@@ -744,10 +744,12 @@ fn println_condition(condition: Condition) {
|
||||
}
|
||||
|
||||
let index_page = matches.opt_str("index-page").map(|s| PathBuf::from(&s));
|
||||
if let Some(ref index_page) = index_page
|
||||
&& !index_page.is_file()
|
||||
{
|
||||
dcx.fatal("option `--index-page` argument must be a file");
|
||||
if let Some(ref index_page) = index_page {
|
||||
if index_page.is_file() {
|
||||
loaded_paths.push(index_page.clone());
|
||||
} else {
|
||||
dcx.fatal("option `--index-page` argument must be a file");
|
||||
}
|
||||
}
|
||||
|
||||
let target = parse_target_triple(early_dcx, matches);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
% Index page
|
||||
|
||||
Index page
|
||||
@@ -19,6 +19,7 @@ fn main() {
|
||||
.arg("--markdown-after-content=after.md")
|
||||
.arg("--extend-css=extend.css")
|
||||
.arg("--theme=theme.css")
|
||||
.arg("--index-page=index-page.md")
|
||||
.emit("dep-info")
|
||||
.run();
|
||||
|
||||
@@ -31,6 +32,7 @@ fn main() {
|
||||
assert_contains(&content, "before.html:");
|
||||
assert_contains(&content, "extend.css:");
|
||||
assert_contains(&content, "theme.css:");
|
||||
assert_contains(&content, "index-page.md:");
|
||||
|
||||
// Now we check that we can provide a file name to the `dep-info` argument.
|
||||
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run();
|
||||
@@ -80,6 +82,7 @@ fn main() {
|
||||
.arg("--markdown-after-content=after.md")
|
||||
.arg("--extend-css=extend.css")
|
||||
.arg("--theme=theme.css")
|
||||
.arg("--index-page=index-page.md")
|
||||
.emit("dep-info=example.d")
|
||||
.run();
|
||||
let content = rfs::read_to_string("example.d");
|
||||
@@ -92,4 +95,5 @@ fn main() {
|
||||
assert_contains(&content, "before.html:");
|
||||
assert_contains(&content, "extend.css:");
|
||||
assert_contains(&content, "theme.css:");
|
||||
assert_contains(&content, "index-page.md:");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user