Include the new Book struct in a hashmap alongside the old representation
This commit is contained in:
parent
99e8082891
commit
efc2644f84
|
@ -18,12 +18,13 @@ use std::io;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use {theme, parse, utils};
|
use {theme, parse, utils};
|
||||||
use renderer::{Renderer, HtmlHandlebars};
|
use renderer::{Renderer, HtmlHandlebars};
|
||||||
|
|
||||||
|
|
||||||
pub struct MDBook {
|
pub struct MDBook<'a> {
|
||||||
root: PathBuf,
|
root: PathBuf,
|
||||||
dest: PathBuf,
|
dest: PathBuf,
|
||||||
src: PathBuf,
|
src: PathBuf,
|
||||||
|
@ -34,12 +35,13 @@ pub struct MDBook {
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|
||||||
pub content: Vec<BookItem>,
|
pub content: Vec<BookItem>,
|
||||||
|
books: HashMap<&'a str, Book>,
|
||||||
renderer: Box<Renderer>,
|
renderer: Box<Renderer>,
|
||||||
|
|
||||||
livereload: Option<String>,
|
livereload: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MDBook {
|
impl<'a> MDBook<'a> {
|
||||||
/// Create a new `MDBook` struct with root directory `root`
|
/// Create a new `MDBook` struct with root directory `root`
|
||||||
///
|
///
|
||||||
/// Default directory paths:
|
/// Default directory paths:
|
||||||
|
@ -67,6 +69,7 @@ impl MDBook {
|
||||||
description: String::new(),
|
description: String::new(),
|
||||||
|
|
||||||
content: vec![],
|
content: vec![],
|
||||||
|
books: HashMap::new(),
|
||||||
renderer: Box::new(HtmlHandlebars::new()),
|
renderer: Box::new(HtmlHandlebars::new()),
|
||||||
|
|
||||||
livereload: None,
|
livereload: None,
|
||||||
|
|
Loading…
Reference in New Issue