diff options
Diffstat (limited to 'src/new/chapter.rs')
-rw-r--r-- | src/new/chapter.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/new/chapter.rs b/src/new/chapter.rs index 9cc12d0..88f2a85 100644 --- a/src/new/chapter.rs +++ b/src/new/chapter.rs @@ -9,7 +9,6 @@ use crate::data::Data; use super::{get_project_root, CHAPTER}; - pub fn generate_new_chapter(name: String) -> io::Result<()> { let project_root = get_project_root().unwrap(); @@ -22,10 +21,14 @@ pub fn generate_new_chapter(name: String) -> io::Result<()> { "content/{}/chapter_{:02}.tex", name.to_case(Case::Snake), data_file.last_chapter.number + 1 - ))).unwrap(); - new_chapter.write_all(CHAPTER.replace("REPLACEMENT_CHAPTER", &name).as_bytes()).unwrap(); + ))) + .unwrap(); + new_chapter + .write_all(CHAPTER.replace("REPLACEMENT_CHAPTER", &name).as_bytes()) + .unwrap(); - fs::create_dir(project_root.join(format!("content/{}/sections", name.to_case(Case::Snake),))).unwrap(); + fs::create_dir(project_root.join(format!("content/{}/sections", name.to_case(Case::Snake),))) + .unwrap(); main_file = main_file.replace( &format!( @@ -55,7 +58,8 @@ pub fn generate_new_chapter(name: String) -> io::Result<()> { fs::write( project_root.join("lpm.toml"), toml::to_string(&data_file).expect("We changed it ourselfes, the conversion should work"), - ).unwrap(); + ) + .unwrap(); fs::write(project_root.join("main.tex"), main_file).unwrap(); |