added a parse_summary() method to the Loader
This commit is contained in:
parent
1e60d6b53c
commit
c68a29c3c5
|
@ -4,6 +4,12 @@
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::error::Error;
|
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
|
/// The object in charge of parsing the source directory into a usable
|
||||||
|
@ -21,9 +27,11 @@ impl Loader {
|
||||||
|
|
||||||
/// Parse the `SUMMARY.md` file.
|
/// Parse the `SUMMARY.md` file.
|
||||||
pub fn parse_summary(&self) -> Result<Summary, Box<Error>> {
|
pub fn parse_summary(&self) -> Result<Summary, Box<Error>> {
|
||||||
unimplemented!()
|
let path = self.source_directory.join("SUMMARY.md");
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The parsed `SUMMARY.md`, specifying how the book should be laid out.
|
let mut summary_content = String::new();
|
||||||
pub struct Summary;
|
File::open(&path)?.read_to_string(&mut summary_content)?;
|
||||||
|
|
||||||
|
summary::parse_summary(&summary_content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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<Summary, Box<Error>> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
Loading…
Reference in New Issue