diff options
| author | Nick Howell <howellnick@gmail.com> | 2015-09-04 17:00:33 -0400 |
|---|---|---|
| committer | Nick Howell <howellnick@gmail.com> | 2015-09-04 17:00:33 -0400 |
| commit | 0f0c48b0b10358427f23572096d117d07daa67cb (patch) | |
| tree | a631936598300130a933e97017eb76a59c16d470 | |
| parent | 94ddfc77072d99b16a5cc779d2b1f8d69e0d6850 (diff) | |
| download | rust-0f0c48b0b10358427f23572096d117d07daa67cb.tar.gz rust-0f0c48b0b10358427f23572096d117d07daa67cb.zip | |
rustbook: Fix relative links on the Introduction page
The Introduction page generated by rustbook used weird relative links like "./getting-started.html" instead of just "getting-started.html" like on the other pages. This adversely affected Windows builds the worst, since it generated links like ".\getting-started.html" (note the backslash). If you then try to upload the generated book to a webserver, you end up with 404's. See this example of what is going on with the Introduction page links and why this PR should fix it: http://is.gd/fRUTXk Compare the links on these two pages, for instance: https://doc.rust-lang.org/nightly/book/ https://doc.rust-lang.org/nightly/book/getting-started.html Also, fix a few whitespace issues in build.rs.
| -rw-r--r-- | src/rustbook/book.rs | 2 | ||||
| -rw-r--r-- | src/rustbook/build.rs | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/rustbook/book.rs b/src/rustbook/book.rs index 2d630d8fe8d..e14c3346cc1 100644 --- a/src/rustbook/book.rs +++ b/src/rustbook/book.rs @@ -102,7 +102,7 @@ pub fn parse_summary(input: &mut Read, src: &Path) -> Result<Book, Vec<String>> top_items.push(BookItem { title: "Introduction".to_string(), path: PathBuf::from("README.md"), - path_to_root: PathBuf::from("."), + path_to_root: PathBuf::from(""), children: vec!(), }); diff --git a/src/rustbook/build.rs b/src/rustbook/build.rs index a1f4539443d..aca0db4e1ad 100644 --- a/src/rustbook/build.rs +++ b/src/rustbook/build.rs @@ -52,16 +52,16 @@ fn write_toc(book: &Book, current_page: &BookItem, out: &mut Write) -> io::Resul current_page: &BookItem, out: &mut Write) -> io::Result<()> { let class_string = if item.path == current_page.path { - "class='active'" + "class='active'" } else { - "" + "" }; try!(writeln!(out, "<li><a {} href='{}'><b>{}</b> {}</a>", - class_string, - current_page.path_to_root.join(&item.path).with_extension("html").display(), - section, - item.title)); + class_string, + current_page.path_to_root.join(&item.path).with_extension("html").display(), + section, + item.title)); if !item.children.is_empty() { try!(writeln!(out, "<ul class='section'>")); let _ = walk_items(&item.children[..], section, current_page, out); |
