@@ -22,13 +22,19 @@ pub fn parse_cmd(name: &str) -> Option<Box<Subcommand>> {
22
22
}
23
23
24
24
fn 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 < ( ) > {
26
29
for ( i, item) in items. iter ( ) . enumerate ( ) {
27
30
try!( walk_item ( item, format ! ( "{}{}." , section, i + 1 ) [ ] , path_to_root, out) ) ;
28
31
}
29
32
Ok ( ( ) )
30
33
}
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 < ( ) > {
32
38
try!( writeln ! ( out, "<li><a href='{}'><b>{}</b> {}</a>" ,
33
39
path_to_root. join( item. path. with_extension( "html" ) ) . display( ) ,
34
40
section,
@@ -55,7 +61,8 @@ fn write_toc(book: &Book, path_to_root: &Path, out: &mut Writer) -> IoResult<()>
55
61
fn render ( book : & Book , tgt : & Path ) -> CliResult < ( ) > {
56
62
let tmp = TempDir :: new ( "rust-book" )
57
63
. 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" ) ;
59
66
60
67
for ( section, item) in book. iter ( ) {
61
68
println ! ( "{} {}" , section, item. title) ;
@@ -66,8 +73,9 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
66
73
let markdown_data = try!( File :: open ( & item. path ) . read_to_string ( ) ) ;
67
74
let preprocessed_path = tmp. path ( ) . join ( item. path . filename ( ) . unwrap ( ) ) ;
68
75
{
76
+ let urls = md_urls. replace_all ( markdown_data[ ] , "[$title]($url_stem.html)" ) ;
69
77
try!( File :: create ( & preprocessed_path)
70
- . write_str ( md_urls . replace_all ( markdown_data [ ] , "[$title]($url_stem.html)" ) [ ] ) ) ;
78
+ . write_str ( urls [ ] ) ) ;
71
79
}
72
80
73
81
// write the prelude to a temporary HTML file for rustdoc inclusion
@@ -129,7 +137,8 @@ impl Subcommand for Build {
129
137
130
138
let _ = fs:: mkdir ( & tgt, io:: USER_DIR ) ; // FIXME: handle errors
131
139
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 ) ;
133
142
134
143
let summary = File :: open ( & src. join ( "SUMMARY.md" ) ) ;
135
144
match book:: parse_summary ( summary, & src) {
0 commit comments