Skip to content

Book representation - Attempt #2 #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6d0d4bf
Created a SUMMARY.md parser and basic Loader
Michael-F-Bryan Jun 24, 2017
1b5a589
Created a Loader for loading a book using the Summary
Michael-F-Bryan Jul 2, 2017
b925c7c
Added a depth-first chapter iterator
Michael-F-Bryan Jul 7, 2017
4202ead
Started integrating some of the feedback from budziq
Michael-F-Bryan Jul 8, 2017
02d1d93
Started cleaning up some of the lints and warnings
Michael-F-Bryan Jul 8, 2017
ce6dbd6
Deleted previous bookitem.md and moved loader contents across
Michael-F-Bryan Aug 21, 2017
7ca198a
Moved most of MDBook over to using the new Book format
Michael-F-Bryan Aug 21, 2017
c4da845
Removed old bookitem.md, now everyone uses the correct BookItem
Michael-F-Bryan Aug 21, 2017
d39352a
Unit tests now all pass
Michael-F-Bryan Aug 21, 2017
3a51e4a
Everything compiles and all the tests pass.
Michael-F-Bryan Aug 21, 2017
7821835
Reverted some churn (cheers cargo-edit) and added myself to contributors
Michael-F-Bryan Aug 21, 2017
1826fbd
Removed an unused function
Michael-F-Bryan Aug 21, 2017
b530b67
Fixed up Cargo.toml
Michael-F-Bryan Aug 25, 2017
af8a548
Added a flag to create missing files
Michael-F-Bryan Aug 27, 2017
98a8ce9
Made non-existent file creation opt-in instead of opt-out
Michael-F-Bryan Aug 27, 2017
f8cec4c
Incorporated Budziq's feedback
Michael-F-Bryan Aug 31, 2017
e89e6a0
`mdbook init` will stub out chapters if SUMMARY already exists
Michael-F-Bryan Aug 31, 2017
227f406
Reduced some of the code duplication
Michael-F-Bryan Sep 2, 2017
1bd26fb
Fixed the rendering bug
Michael-F-Bryan Sep 2, 2017
2bdca9e
Fixed `mdbook build` overwriting your book with the `mdbook init` stuff
Michael-F-Bryan Sep 24, 2017
e9370c9
Updated the hrefs in the integration tests
Michael-F-Bryan Sep 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ ws = { version = "0.7", optional = true}
[build-dependencies]
error-chain = "0.11"

[dev-dependencies]
pretty_assertions = "0.2"

[features]
default = ["output", "watch", "serve"]
debug = []
Expand Down
1 change: 1 addition & 0 deletions book-example/src/misc/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ If you have contributed to mdBook and I forgot to add you, don't hesitate to add
- Wayne Nilsen ([waynenilsen](https://github.com/waynenilsen))
- [funnkill](https://github.com/funkill)
- Fu Gangqiang ([FuGangqiang](https://github.com/FuGangqiang))
- Michael Bryan ([Michael-F-Bryan](https://github.com/Michael-F-Bryan))
9 changes: 4 additions & 5 deletions src/bin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,28 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
.about("Build the book from the markdown files")
.arg_from_usage("-o, --open 'Open the compiled book in a web browser'")
.arg_from_usage("-d, --dest-dir=[dest-dir] 'The output directory for your book{n}(Defaults to ./book when omitted)'")
.arg_from_usage("--no-create 'Will not create non-existent files linked from SUMMARY.md'")
.arg_from_usage("--create 'Will create non-existent files linked from SUMMARY.md'")
.arg_from_usage("--curly-quotes 'Convert straight quotes to curly quotes, except for those that occur in code blocks and code spans'")
.arg_from_usage("[dir] 'A directory for your book{n}(Defaults to Current Directory when omitted)'")
}

// Build command implementation
pub fn execute(args: &ArgMatches) -> Result<()> {
let book_dir = get_book_dir(args);
let book = MDBook::new(&book_dir).read_config()?;
let book = MDBook::new(&book_dir);

let mut book = match args.value_of("dest-dir") {
Some(dest_dir) => book.with_destination(dest_dir),
None => book,
};

if args.is_present("no-create") {
book.create_missing = false;
}
book.create_missing = args.is_present("create");

if args.is_present("curly-quotes") {
book = book.with_curly_quotes(true);
}

book = book.read_config()?;
book.build()?;

if args.is_present("open") {
Expand Down
Loading