diff --git a/bin/concat_chapters.rs b/bin/concat_chapters.rs index 8afb566ee..94a4e422d 100644 --- a/bin/concat_chapters.rs +++ b/bin/concat_chapters.rs @@ -87,7 +87,9 @@ fn concat_files(source_paths: Vec, target_path: PathBuf) -> io::Result< let mut contents: Vec = Vec::new(); try!(source.read_to_end(&mut contents)); - if !is_first { + if is_first { + try!(target.write_all(b"\n[TOC]\n\n")); + } else { try!(target.write_all(b"\n")); } try!(target.write_all(&contents)); diff --git a/bin/link2print.rs b/bin/link2print.rs index b14c43a8f..d1c3eee5a 100644 --- a/bin/link2print.rs +++ b/bin/link2print.rs @@ -39,12 +39,12 @@ fn parse_references(buffer: String) -> (String, HashMap) { fn parse_links((buffer, ref_map): (String, HashMap)) -> String { // TODO: check which punctuation is allowed by spec - let re = Regex::new(r###"(?:(?P
(?:```(?:[^`]|`[^`])*`?\n```\n)|(?:[^[]`[^`\n]+[\n]?[^`\n]*`))|(?:\[(?P[^]]+)\](?:(?:\([[:blank:]]*(?P[^")]*[^ ])(?:[[:blank:]]*"[^"]*")?\))|(?:\[(?P[^]]*)\]))?))"###).unwrap();
+    let re = Regex::new(r###"(?:(?P
(?:```(?:[^`]|`[^`])*`?\n```\n)|(?:[^[]`[^`\n]+[\n]?[^`\n]*`))|(?:\[(?P[^]]+)\](?:(?:\([[:blank:]]*(?P[^")]*[^ ])(?:[[:blank:]]*"[^"]*")?\))|(?:\[(?P[^]]*)\]))?))"###).expect("could not create regex");
     let output = re.replace_all(&buffer, |caps: &Captures| {
         match caps.name("pre") {
             Some(pre_section) => format!("{}", pre_section.to_owned()),
             None => {
-                let name = caps.name("name").unwrap().to_owned();
+                let name = caps.name("name").expect("could not get name").to_owned();
                 let val = match caps.name("val") {
                     // [name](link)
                     Some(value) => value.to_owned(),
@@ -53,13 +53,13 @@ fn parse_links((buffer, ref_map): (String, HashMap)) -> String {
                             Some(key) => {
                                 match key {
                                     // [name][]
-                                    "" => format!("{}", ref_map.get(&name.to_uppercase()).unwrap()),
+                                    "" => format!("{}", ref_map.get(&name.to_uppercase()).expect(&format!("could not find url for the link text `{}`", name))),
                                     // [name][reference]
-                                    _ => format!("{}", ref_map.get(&key.to_uppercase()).unwrap()),
+                                    _ => format!("{}", ref_map.get(&key.to_uppercase()).expect(&format!("could not find url for the link text `{}`", key))),
                                 }
                             }
                             // [name] as reference
-                            None => format!("{}", ref_map.get(&name.to_uppercase()).unwrap()),
+                            None => format!("{}", ref_map.get(&name.to_uppercase()).expect(&format!("could not find url for the link text `{}`", name))),
                         }
                     }
                 };
diff --git a/ch02-00-guessing-game-tutorial.html b/ch02-00-guessing-game-tutorial.html
index 78534fa58..1ceaedec0 100644
--- a/ch02-00-guessing-game-tutorial.html
+++ b/ch02-00-guessing-game-tutorial.html
@@ -67,8 +67,7 @@
                 
 
                 
-

[TOC]

-

Guessing Game

+

Guessing Game

Let's jump into Rust with a hands-on project! This chapter will introduce you to a few common Rust concepts by showing how you would use them in a real program. You'll learn about let, match, methods, associated functions, using diff --git a/ch04-01-ownership.html b/ch04-01-ownership.html index fd0998ffe..d74f80b16 100644 --- a/ch04-01-ownership.html +++ b/ch04-01-ownership.html @@ -268,9 +268,9 @@ copying can be assumed to be inexpensive.

Clone

But what if we do want to deeply copy the String’s data and not just the String itself? There’s a common method for that: clone(). We will discuss -methods in the section on [structs in Chapter XX], but they’re a common -enough feature in many programming languages that you have probably seen them -before.

+methods in the section on structs in Chapter XX, but they’re a +common enough feature in many programming languages that you have probably seen +them before.

Here’s an example of the clone() method in action:

let s1 = String::from("hello");
 let s2 = s1.clone();
diff --git a/chYY-YY-workspaces.html b/chYY-YY-workspaces.html
index ff29a851e..0781b459b 100644
--- a/chYY-YY-workspaces.html
+++ b/chYY-YY-workspaces.html
@@ -74,8 +74,8 @@ the same Cargo.lock and output directory.

crate until now, and casually people will use the words package and crate interchangeably and everyone will understand.

But there are cases when it makes sense to have multiple crates in one project -because [insert reasons here]. For example, [insert examples here, maybe -log/env_log in rust-lang-nursery?]

+because (insert reasons here). For example, (insert examples here, maybe +log/env_log in rust-lang-nursery?)

So let's get more precise now. Earlier, we said:

A crate is what we call a package of Rust code.

diff --git a/print.html b/print.html index f6fc7acc2..b7cd23a98 100644 --- a/print.html +++ b/print.html @@ -436,7 +436,6 @@ $ cargo build

Note: If you want to look at Cargo in more detail, check out the official Cargo guide, which covers all of its features.

-

[TOC]

Guessing Game

Let's jump into Rust with a hands-on project! This chapter will introduce you to a few common Rust concepts by showing how you would use them in a real program. @@ -2499,9 +2498,9 @@ copying can be assumed to be inexpensive.

Clone

But what if we do want to deeply copy the String’s data and not just the String itself? There’s a common method for that: clone(). We will discuss -methods in the section on [structs in Chapter XX], but they’re a common -enough feature in many programming languages that you have probably seen them -before.

+methods in the section on structs in Chapter XX, but they’re a +common enough feature in many programming languages that you have probably seen +them before.

Here’s an example of the clone() method in action:

let s1 = String::from("hello");
 let s2 = s1.clone();
@@ -4436,8 +4435,8 @@ the same Cargo.lock and output directory.

crate until now, and casually people will use the words package and crate interchangeably and everyone will understand.

But there are cases when it makes sense to have multiple crates in one project -because [insert reasons here]. For example, [insert examples here, maybe -log/env_log in rust-lang-nursery?]

+because (insert reasons here). For example, (insert examples here, maybe +log/env_log in rust-lang-nursery?)

So let's get more precise now. Earlier, we said:

A crate is what we call a package of Rust code.