Skip to content

Commit

Permalink
Check for deadlinks from the summary during book generation
Browse files Browse the repository at this point in the history
Previously, any deadlinks from a book's SUMMARY.md wouldn't
cause any errors or warnings or similar but mdbook would simply
create a page with blank content.

This has kept bug rust-lang#47394 hidden. It should have been detected
back in the PR when those wrongly named files got added to the
book.

PR rust-lang#47414 was one component of the solution. This change
is a second line of defense for the unstable book and a first
line of defense for any other book.

We also update mdbook to the most recent version.
  • Loading branch information
est31 committed Jan 15, 2018
1 parent 57850e5 commit 38ddb44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/tools/rustbook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ license = "MIT/Apache-2.0"
clap = "2.25.0"

[dependencies.mdbook]
version = "0.0.26"
version = "0.0.28"
default-features = false
12 changes: 7 additions & 5 deletions src/tools/rustbook/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ fn main() {
// Build command implementation
pub fn build(args: &ArgMatches) -> Result<()> {
let book_dir = get_book_dir(args);
let book = MDBook::new(&book_dir).read_config()?;
let mut book = MDBook::new(&book_dir).read_config()?;

let mut book = match args.value_of("dest-dir") {
Some(dest_dir) => book.with_destination(dest_dir),
None => book,
};
// Set this to allow us to catch bugs in advance.
book.config.build.create_missing = false;

if let Some(dest_dir) = args.value_of("dest-dir") {
book.config.build.build_dir = PathBuf::from(dest_dir);
}

book.build()?;

Expand Down

0 comments on commit 38ddb44

Please sign in to comment.