Commit Graph

52 Commits

Author SHA1 Message Date
Jaime Valdemoros 4177288b11 Add test to make sure pre-processors are being run 2018-01-16 22:39:11 +00:00
Michael Bryan 9ab54412ea
Made it so the CmdRenderer writes directly to the child's stdin (#544) 2018-01-14 19:14:27 +08:00
Michael Bryan a1b6ccc29a
Override configuration using environment variables (#541)
* Added the ability to update config settings from env vars

* Added tests

* Documented that you can override configuration with environment
variables

* Refactored the config get() methods to use toml-query

* Made the `Updateable` trait more generic
2018-01-14 02:38:43 +08:00
Michael Bryan fd7e8d1b7b
Add support for alternative backends (#507)
* Added a mechanism for creating alternate backends

* Added a CmdRenderer and the ability to have multiple renderers

* Made MDBook::load() autodetect renderers

* Added a couple methods to RenderContext

* Converted RenderContext.version to a String

* Made sure all alternate renderers are invoked as `mdbook-*`

* Factored out the logic for determining which renderer to use

* Added tests for renderer detection

* Made it so `mdbook test` works on the book-example again

* Updated the "For Developers" docs

* Removed `[output.epub]` from the example book's book.toml

* Added a bit more info on how backends should work

* Added a `destination` key to the RenderContext

* Altered how we wait for an alternate backend to finish

* Refactored the Renderer trait to not use MDBook and moved livereload to the template

* Moved info for developers out of the book.toml format chapter

* MOAR docs

* MDBook::build() no longer takes &mut self

* Replaced a bunch of println!()'s with proper log macros

* Cleaned up the build() method and backend discovery

* Added a couple notes and doc-comments

* Found a race condition when backends exit really quickly

* Added support for backends with arguments

* Fixed a funny doc-comment
2018-01-07 22:10:48 +08:00
Jan Likar dedc208a6a Prohibit 'print.md' files (#524)
* Prohibit 'print.md' files

Fix #258 by emmiting an error whenever an mdBook contains a
"print.md" file in its root.

* Apply suggested changes

* Add tests
2018-01-07 00:02:23 +08:00
boxdot e461610dab Implement partial include of source files (#520)
* Implement partial include of source files.

The macro `{{include some_file}}` accepts now optional line number
arguments, s.t. the specified line range is included. The following
forms are supported:

* `{{include some_file::}}` is equivalent to `{{include some_file}}`
* `{{include some_file:from:}}` includes lines [from, infinity)
* `{{include some_file::to}}` includes lines [0, to]
* `{{include some_file:from:to}}` includes lines [from, to]

* Remove the special case IncludeFull which is IncludeFrom(0).

* Use Range, RangeFrom, RangeTo and RangeFull to represent include-ranges.

Also:
* Move out introduced methods as free functions.
* Introduce RangeArgument trait as long it is unstable in stdlib.
* Use itertools for joining of lines on the fly.
* Split tests.
* Simplify include file argument parsing.

* Make utils::string private and link collections_range feature issue.
2018-01-06 05:03:30 +08:00
Michael Bryan 75dac15f09
Fixed a couple issues with the docs 2017-12-11 18:50:31 +11:00
Michael Bryan 148511eceb
Able to parse all existing SUMMARY.md files 2017-12-11 17:20:05 +11:00
Michael Bryan f5e9b857de
Rewrote summary parser from a state machine to use recursive descent 2017-12-11 15:17:20 +11:00
Michael Bryan 1b51cd244e
Moved the book examples to the top level lib.rs 2017-12-11 11:29:30 +11:00
Michael Bryan f993677626
All tests finally pass! 2017-12-10 22:52:00 +11:00
Michael Bryan 4c6c696c87
Copied across the summary parser and Book structure (doesn't compile) 2017-12-10 22:43:12 +11:00
Chris Spiegel b0b09bad3f Clean up build configuration.
This rolls all "create missing" handling into BuildConfig, and moves the
build-dir option from the "book" table to the "build" table. Some
documentation cleanup surrounding the build table is also updated.
2017-11-30 07:39:58 -08:00
Michael Bryan 1b5137c84e
All tests pass again :) 2017-11-12 21:37:37 +08:00
Michael Bryan 6059883229
Added some basic configuration objects 2017-11-12 21:37:35 +08:00
Jacob Wahlgren 56cee872e8 Box Handlebars template error
See https://github.com/azerupi/mdBook/pull/466#issuecomment-335450110
2017-10-12 21:50:33 +02:00
Pratik Karki 382fc4139b run rustfmt on the repository #398(Updated) (#438)
rustfmt the repository #398
2017-10-03 13:40:23 +02:00
Michal Budzynski ddf31dcc08 Fixed `mdbook test` for {{#playpen file.rs}}
- now `mdbook test` does full link expansion to temp file prior to running
- also minor reformat and cleanup of `HtmlHandlebars::render_item`
2017-08-07 21:42:28 +02:00
Michael Bryan 2f8d5ce263 Removed a lot of the repetition in Theme::new() 2017-08-03 07:01:52 +08:00
Michal Budzynski d7ecb1a80c Rewrite of {{#}} links handling in preprocess module
- Replaced link parser with a Regex
- Implemented {{#include}} links
- Will display relatively nice error when cannot open {{#}} linked file
- Escaped links no longer render with escape char
- utils::fs::file_to_path no takes AsRef<Path>
- sorted export/mod in lib.rs
2017-08-01 13:50:12 +02:00
Michal Budzynski f3f6b40ea9 Moved playpen.rs `renderer` helper to `preprocess/links.rs` module 2017-08-01 13:50:12 +02:00
messense f2544e0707
Print stdout when `mdbook test` failed 2017-06-28 10:28:50 +08:00
Michael Bryan 487f5ce339 Added error-chain to the renderer module 2017-06-25 00:10:06 +08:00
Michael Bryan 1356e0f068 Added error-chain to the book and utils modules 2017-06-25 00:04:57 +08:00
Michael Bryan 6761442241 Added error-chain to lib.rs 2017-06-24 23:48:50 +08:00
Mathieu David f3cb4265ca Fix typo 2017-06-23 01:10:18 +02:00
Michal Budzynski e8908e32c9 Minor cleanup
- removing need to explicitly use `Path::new` all over the place
- removed warnings from doctests (normally invisible unless `cargo test -- --nocapture`)
- no doctests are norun/ignore now
- updated docs both in book-example and in docs not to refer to nonexisting API's
2017-06-14 21:55:42 +02:00
Mathieu David 70383d0a25 New config structs supports json again (the old style) for a little deprecation period 2017-06-04 20:41:31 +02:00
Mathieu David d3ae2eda56 Replace the old book structure with the new one 2017-06-04 20:41:31 +02:00
Mathieu David 170bf8b1eb New configuration struct + tests #285 2017-06-04 20:41:31 +02:00
Michal Budzynski 75bbd55128 Changes made with rustfmt including `use_try_shorthand`
Updated the project rustfmt.toml to include `use_try_shorthand = true`.
Run rustfmt on all rust sources.
2017-05-19 13:04:37 +02:00
Steve Klabnik 38b3516b60 Implement links in section headers.
This project already had a transitive dependency on regex; let's use it.

This isn't the most efficient solution, but it should be fine. It ends
up doing five full scans of the text. There's probably an easier way but
I'm mostly just trying to get this to work for now.

This also implements the same algorithm that rustdoc does for generating
the name for the link.

Fixes #204
2017-02-16 17:07:17 -05:00
Corey Farwell 152ebba762 Bump serde, serde_json, and handlebars crates. 2017-02-15 23:31:05 -05:00
Mathieu David 67aee5c192 Switch from rustc_serialize to serde. Closes #18 2016-11-03 01:58:42 +01:00
Gambhiro b584f6eb9c use macros from the log crate, issue #151 2016-08-14 13:34:02 +01:00
Mathieu David 15d26befcc Refactor: Move extern crate definitions to lib.rs 2016-03-27 18:22:17 +02:00
Mathieu David 74fff81e4b Refactor: Move fs related functions from utils into their own submodule 2016-03-17 22:41:00 +01:00
Mathieu David bf114d7e21 Removed the sub module from utils and put the functions directly in the utils module + docs #30 2015-08-06 23:04:19 +02:00
Mathieu David b7214f92a1 Add documentation for MDBook #30 2015-08-06 21:10:59 +02:00
Mathieu David 20bfcd128d Fixed the code examples and added no_run to prevent them from running 2015-08-06 15:04:27 +02:00
Mathieu David 726018307e ignored test, have to fix some bugs before 2015-08-06 12:52:06 +02:00
Mathieu David e725215103 Add rustdoc generated API doc 2015-08-06 12:38:48 +02:00
Mathieu David 01369ea42f Checked the API, moved handlebars theme handling to the theme module to expose it to every renderer. Closes #28 2015-08-05 22:35:26 +02:00
Mathieu David 22280bbb16 Add debug! macro that can be activated using the "debug" feature. #19 2015-08-03 18:06:01 +02:00
Mathieu David 5bd1385212 Added a utils module for general / common functions 2015-07-30 15:20:55 +02:00
Mathieu David 4d4f35ecba First big step for the html renderer, it reads an handlebars template and creates the files from SUMMARY.md respecting the source folder structure 2015-07-19 00:08:38 +02:00
Mathieu David 7fa5b06ccb Rudimentary: Parse SUMMARY.md, support for nested levels. Only list items: "- [name](path)" or "* [name](path)" #2 2015-07-18 00:04:20 +02:00
Mathieu David 4fe0bc2de5 renamed directory + created BookItem 2015-07-16 19:26:16 +02:00
Mathieu David ad01c37432 clean up structure and code 2015-07-16 18:20:36 +02:00
Mathieu David 4d884b9c40 Added BookConfig struct, cleaned up some parts 2015-07-08 15:17:11 +02:00