mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-28 13:51:10 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a5409db20 | ||
|
|
dc89a82329 | ||
|
|
42ff5a895c | ||
|
|
8ee795045a | ||
|
|
f22835f7bc |
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mdbook"
|
||||
version = "0.0.27"
|
||||
version = "0.0.28"
|
||||
authors = ["Mathieu David <mathieudavid@mathieudavid.org>"]
|
||||
description = "create books from markdown files (like Gitbook)"
|
||||
documentation = "http://rust-lang-nursery.github.io/mdBook/index.html"
|
||||
|
||||
@@ -299,8 +299,13 @@ impl MDBook {
|
||||
|
||||
pub fn read_config(mut self) -> Result<Self> {
|
||||
let config_path = self.root.join("book.toml");
|
||||
debug!("[*] Loading the config from {}", config_path.display());
|
||||
self.config = Config::from_disk(&config_path)?;
|
||||
|
||||
if config_path.exists() {
|
||||
debug!("[*] Loading the config from {}", config_path.display());
|
||||
self.config = Config::from_disk(&config_path)?;
|
||||
} else {
|
||||
self.config = Config::default();
|
||||
}
|
||||
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
@@ -51,3 +51,14 @@ fn run_mdbook_init_with_custom_book_and_src_locations() {
|
||||
assert!(target.exists(), "{} should have been created by `mdbook init`", file);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn book_toml_isnt_required() {
|
||||
let temp = TempDir::new("mdbook").unwrap();
|
||||
let mut md = MDBook::new(temp.path());
|
||||
md.init().unwrap();
|
||||
|
||||
assert!(!temp.path().join("book.toml").exists());
|
||||
|
||||
md.read_config().unwrap().build().unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user