diff --git a/src/loader/mod.rs b/src/loader/mod.rs index eff46441..63d16f86 100644 --- a/src/loader/mod.rs +++ b/src/loader/mod.rs @@ -4,6 +4,12 @@ use std::path::{Path, PathBuf}; use std::error::Error; +use std::fs::File; +use std::io::Read; + +mod summary; + +pub use self::summary::Summary; /// The object in charge of parsing the source directory into a usable @@ -21,9 +27,11 @@ impl Loader { /// Parse the `SUMMARY.md` file. pub fn parse_summary(&self) -> Result> { - unimplemented!() + let path = self.source_directory.join("SUMMARY.md"); + + let mut summary_content = String::new(); + File::open(&path)?.read_to_string(&mut summary_content)?; + + summary::parse_summary(&summary_content) } } - -/// The parsed `SUMMARY.md`, specifying how the book should be laid out. -pub struct Summary; \ No newline at end of file diff --git a/src/loader/summary.rs b/src/loader/summary.rs new file mode 100644 index 00000000..52a1d7d5 --- /dev/null +++ b/src/loader/summary.rs @@ -0,0 +1,9 @@ +use std::error::Error; +use pulldown_cmark; + +/// The parsed `SUMMARY.md`, specifying how the book should be laid out. +pub struct Summary; + +pub fn parse_summary(summary: &str) -> Result> { + unimplemented!() +} \ No newline at end of file