@@ -22,13 +22,19 @@ pub fn parse_cmd(name: &str) -> Option<Box<Subcommand>> {
2222}
2323
2424fn write_toc ( book : & Book , path_to_root : & Path , out : & mut Writer ) -> IoResult < ( ) > {
25- fn walk_items ( items : & [ BookItem ] , section : & str , path_to_root : & Path , out : & mut Writer ) -> IoResult < ( ) > {
25+ fn walk_items ( items : & [ BookItem ] ,
26+ section : & str ,
27+ path_to_root : & Path ,
28+ out : & mut Writer ) -> IoResult < ( ) > {
2629 for ( i, item) in items. iter ( ) . enumerate ( ) {
2730 try!( walk_item ( item, format ! ( "{}{}." , section, i + 1 ) [ ] , path_to_root, out) ) ;
2831 }
2932 Ok ( ( ) )
3033 }
31- fn walk_item ( item : & BookItem , section : & str , path_to_root : & Path , out : & mut Writer ) -> IoResult < ( ) > {
34+ fn walk_item ( item : & BookItem ,
35+ section : & str ,
36+ path_to_root : & Path ,
37+ out : & mut Writer ) -> IoResult < ( ) > {
3238 try!( writeln ! ( out, "<li><a href='{}'><b>{}</b> {}</a>" ,
3339 path_to_root. join( item. path. with_extension( "html" ) ) . display( ) ,
3440 section,
@@ -55,7 +61,8 @@ fn write_toc(book: &Book, path_to_root: &Path, out: &mut Writer) -> IoResult<()>
5561fn render ( book : & Book , tgt : & Path ) -> CliResult < ( ) > {
5662 let tmp = TempDir :: new ( "rust-book" )
5763 . ok ( )
58- . expect ( "could not create temporary directory" ) ; // FIXME: lift to Result instead
64+ // FIXME: lift to Result instead
65+ . expect ( "could not create temporary directory" ) ;
5966
6067 for ( section, item) in book. iter ( ) {
6168 println ! ( "{} {}" , section, item. title) ;
@@ -66,8 +73,9 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
6673 let markdown_data = try!( File :: open ( & item. path ) . read_to_string ( ) ) ;
6774 let preprocessed_path = tmp. path ( ) . join ( item. path . filename ( ) . unwrap ( ) ) ;
6875 {
76+ let urls = md_urls. replace_all ( markdown_data[ ] , "[$title]($url_stem.html)" ) ;
6977 try!( File :: create ( & preprocessed_path)
70- . write_str ( md_urls . replace_all ( markdown_data [ ] , "[$title]($url_stem.html)" ) [ ] ) ) ;
78+ . write_str ( urls [ ] ) ) ;
7179 }
7280
7381 // write the prelude to a temporary HTML file for rustdoc inclusion
@@ -129,7 +137,8 @@ impl Subcommand for Build {
129137
130138 let _ = fs:: mkdir ( & tgt, io:: USER_DIR ) ; // FIXME: handle errors
131139
132- let _ = File :: create ( & tgt. join ( "rust-book.css" ) ) . write_str ( css:: STYLE ) ; // FIXME: handle errors
140+ // FIXME: handle errors
141+ let _ = File :: create ( & tgt. join ( "rust-book.css" ) ) . write_str ( css:: STYLE ) ;
133142
134143 let summary = File :: open ( & src. join ( "SUMMARY.md" ) ) ;
135144 match book:: parse_summary ( summary, & src) {
0 commit comments