Removed an unused function

This commit is contained in:
Michael Bryan 2017-08-21 22:59:19 +08:00
parent 7821835129
commit 1826fbd65e
6 changed files with 17 additions and 16 deletions

View File

@ -88,7 +88,7 @@ impl Chapter {
/// ///
/// You need to pass in the book's source directory because all the links in /// You need to pass in the book's source directory because all the links in
/// `SUMMARY.md` give the chapter locations relative to it. /// `SUMMARY.md` give the chapter locations relative to it.
pub fn load_book_from_disk<P: AsRef<Path>>(summary: &Summary, src_dir: P) -> Result<Book> { fn load_book_from_disk<P: AsRef<Path>>(summary: &Summary, src_dir: P) -> Result<Book> {
debug!("[*] Loading the book from disk"); debug!("[*] Loading the book from disk");
let src_dir = src_dir.as_ref(); let src_dir = src_dir.as_ref();
@ -229,9 +229,9 @@ And here is some more text.
let mut second = Link::new("Nested Chapter 1", &second_path); let mut second = Link::new("Nested Chapter 1", &second_path);
second.number = Some(SectionNumber(vec![1, 2])); second.number = Some(SectionNumber(vec![1, 2]));
root.push_item(second.clone()); root.nested_items.push(second.clone().into());
root.push_item(SummaryItem::Separator); root.nested_items.push(SummaryItem::Separator);
root.push_item(second.clone()); root.nested_items.push(second.clone().into());
(root, temp_dir) (root, temp_dir)
} }

View File

@ -1,7 +1,10 @@
pub mod book; //! The internal representation of a `Book`.
pub mod summary;
use self::book::{load_book, Book, BookItem, BookItems}; mod book;
mod summary;
pub use self::book::{load_book, Book, BookItem, BookItems, Chapter};
pub use self::summary::SectionNumber;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::fs::{self, File}; use std::fs::{self, File};
@ -19,6 +22,9 @@ use config::tomlconfig::TomlConfig;
use config::htmlconfig::HtmlConfig; use config::htmlconfig::HtmlConfig;
use config::jsonconfig::JsonConfig; use config::jsonconfig::JsonConfig;
/// A helper for managing the `Book`, its configuration, and the rendering
/// process.
pub struct MDBook { pub struct MDBook {
config: BookConfig, config: BookConfig,
@ -85,7 +91,7 @@ impl MDBook {
/// ```no_run /// ```no_run
/// # extern crate mdbook; /// # extern crate mdbook;
/// # use mdbook::MDBook; /// # use mdbook::MDBook;
/// # use mdbook::book::book::BookItem; /// # use mdbook::book::BookItem;
/// # #[allow(unused_variables)] /// # #[allow(unused_variables)]
/// # fn main() { /// # fn main() {
/// # let book = MDBook::new("mybook"); /// # let book = MDBook::new("mybook");

View File

@ -86,11 +86,6 @@ impl Link {
nested_items: Vec::new(), nested_items: Vec::new(),
} }
} }
/// Add an item to this link's `nested_items`.
pub fn push_item<I: Into<SummaryItem>>(&mut self, item: I) {
self.nested_items.push(item.into());
}
} }
impl Default for Link { impl Default for Link {

View File

@ -99,7 +99,7 @@ pub mod theme;
pub mod utils; pub mod utils;
pub use book::MDBook; pub use book::MDBook;
pub use book::book::Book; pub use book::Book;
pub use renderer::Renderer; pub use renderer::Renderer;
/// The error types used through out this crate. /// The error types used through out this crate.

View File

@ -4,7 +4,7 @@ use renderer::Renderer;
use book::MDBook; use book::MDBook;
use config::PlaypenConfig; use config::PlaypenConfig;
use theme::{self, Theme, playpen_editor}; use theme::{self, Theme, playpen_editor};
use book::book::{BookItem, Chapter}; use book::{BookItem, Chapter};
use utils; use utils;
use errors::*; use errors::*;
use regex::{Regex, Captures}; use regex::{Regex, Captures};

View File

@ -5,7 +5,7 @@ extern crate env_logger;
use std::path::PathBuf; use std::path::PathBuf;
use mdbook::book::book::load_book; use mdbook::book::load_book;
#[test] #[test]