Commit graph

295 commits

Author SHA1 Message Date
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
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
daade63c27
Rolls back the Iron version due to issues with staticfile 2018-01-02 22:02:34 +08:00
Michael Bryan
cba16a0083
Updated dependencies and made logging more readable 2017-12-30 18:43:46 +08:00
Michael Bryan
5041359817
Updated the pulldown-cmark patch in Cargo.toml 2017-12-11 17:36:13 +11:00
Michael Bryan
148511eceb
Able to parse all existing SUMMARY.md files 2017-12-11 17:20:05 +11:00
Michael Bryan
4619ab60b0
(cargo-release) start next development iteration 0.0.29-alpha.0 2017-12-09 21:26:12 +11:00
Michael Bryan
2a5409db20
(cargo-release) version 0.0.28 2017-12-09 21:23:44 +11:00
Michael Bryan
f22835f7bc
(cargo-release) start next development iteration 0.0.28-alpha.0 2017-12-07 21:40:45 +11:00
Michael Bryan
1f84f66041
Bumped the version number in preparation for the next release 2017-12-07 21:35:50 +11:00
Anna Liao
5ce05a79be updated links from azerupi to rust-lang-nursery (#489) 2017-11-22 11:35:18 +01:00
Michael Bryan
d56ff94ce6
Regression tests (#422)
* Created regression tests for the table of contents

* Refactoring to make the test more readable

* Fixed some bitrot and removed the (now redundant) tests/helper module

* Removed the include_str!() stuff and use just the dummy book for testing

* Regression tests now pass again!

* Pinned a `*` dependency to use a particular version

* Made sure test mocks return errors instead of panicking

* Addressed the rest of @budziq's review

* Replaced a file open/read with file_to_string
2017-11-16 15:51:12 +08:00
steveklabnik
b45e5e4420 Release 0.0.26
Fixes #460
2017-10-02 09:10:17 -04:00
Mathieu David
ef5895fa78 Update all dependencies 2017-09-11 19:38:10 +02:00
Mathieu David
e3f4bb5101 (cargo-release) start next development iteration 0.0.26-alpha.0 2017-09-08 20:21:49 +02:00
Mathieu David
441bcb5963 (cargo-release) version 0.0.25 2017-09-08 20:20:48 +02:00
Mathieu David
6f0b67f44f (cargo-release) start next development iteration 0.0.25-alpha.0 2017-09-07 23:32:57 +02:00
Mathieu David
abf86eefd9 (cargo-release) version 0.0.24 2017-09-07 23:31:57 +02:00
Behnam Esfahbod
a529ca5e65 [Cargo.toml] Fix package.exclude warnings
IIUC, the existing exclude rule has meant to do what it will do in the
future (gitignore-like matching, not glob-only matching). This fix makes
the rule to do what it was expected to do, and is forward-compatible,
therefore fixing the warning messages.
2017-09-06 00:52:15 -07:00
steveklabnik
313f9b9403 Bump version in Cargo.toml for next release 2017-08-29 12:53:32 -04:00
steveklabnik
b7372d3bf2 Fix toml problem and release 0.0.23
The toml crate removed its serde dependency in 0.3, but in 0.4, it
went away. Cargo didn't warn on this, but now it does. As such, we
need a release so that rust's build doesn't warn constantly.
2017-08-29 10:53:20 -04: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
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
Michael Bryan
b796ee7c36 Made sure travis installs musl for the musl builds 2017-06-25 13:17:44 +08:00
Michael Bryan
2abebfb244 Removed the default error-chain features
On `x86_64-unknown-linux-musl` it looks like travis can't compile
the `backtrace-sys` crate because the `./configure` step fails.

The error message `./configure` gives is:

configure: error: in `/home/travis/build/azerupi/mdBook/target/x86_64-unknown-linux-musl/debug/build/backtrace-sys-204dc57c91e9a514/out':
configure: error: C compiler cannot create executables
2017-06-25 00:40:56 +08:00
Michael Bryan
6761442241 Added error-chain to lib.rs 2017-06-24 23:48:50 +08:00
Ning Sun
9aa39a6a12 (chore) update handlebars to 0.27.0
Signed-off-by: Ning Sun <sunng@about.me>
2017-06-13 20:43:36 +08:00
Mathieu David
170bf8b1eb New configuration struct + tests #285 2017-06-04 20:41:31 +02:00
Michal Budzynski
a84c1ecf33 Implemented a more friendly stylus error handling
Added error-chain as build-dependency
2017-05-22 04:25:59 +02:00
Mathieu David
faa716d99c update all dependencies 2017-05-18 11:56:04 +02:00
Mathieu David
435682e95c (cargo-release) start next development iteration 0.0.22-pre 2017-04-27 16:05:45 +02:00
Mathieu David
69188445e7 (cargo-release) version 0.0.21 2017-04-27 16:03:02 +02:00
Mathieu David
607bf4426e (cargo-release) start next development iteration 0.0.21-pre 2017-04-26 19:25:14 +02:00
Mathieu David
8b84b8fa82 (cargo-release) version 0.0.20 2017-04-26 19:22:37 +02:00
steveklabnik
cba988f009 bump for 0.0.19 2017-04-18 10:50:58 -04:00
steveklabnik
1cf4774737 bump version 2017-03-10 13:39:35 -05:00
Mathieu David
677fa42458 (cargo-release) start next development iteration 0.0.18-pre 2017-02-28 17:22:51 +01:00
Mathieu David
a8bba0b94d (cargo-release) version 0.0.17 2017-02-28 17:20:28 +01:00
Mathieu David
0c624d0f74 bump version 2017-02-20 16:16:21 +01:00
Corey Farwell
7fa36f82b0 Bump ws crate to 0.6. 2017-02-18 20:28:12 -05:00
Corey Farwell
3a30e65eef Bump staticfile crate to 0.4, iron to 0.5. 2017-02-18 20:26:12 -05:00
Corey Farwell
fab24f5224 Bump notify crate to 0.4. 2017-02-18 20:24:27 -05:00
Corey Farwell
cfa4295d79 Bump toml crate to 0.3. 2017-02-18 20:22:55 -05:00
Steve Klabnik
aba153a271 update env_logger 2017-02-16 17:17:26 -05:00
Steve Klabnik
280dabecd7 update regex dep 2017-02-16 17:11:16 -05: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
Matt Brubeck
1ac2602360 Update to notify 3.0
notify now does its own event debouncing, so it's no longer necessary
for mdbook to do this manually.
2017-01-01 16:03:49 -08:00
Matt Brubeck
21bc3d47c8 Add a CLI option to open a web browser 2017-01-01 09:58:20 -08:00
Gambhiro
f67ae7c71a update dependency versions 2016-12-23 08:10:42 +00:00
Mathieu David
67aee5c192 Switch from rustc_serialize to serde. Closes #18 2016-11-03 01:58:42 +01:00
Mathieu David
9e634a4e83 Bump version number to 0.0.15, 0.0.14 has been published to crates.io 2016-08-31 15:11:33 +02:00
Gambhiro
4153db2624 env_logger 2016-08-14 14:55:10 +01:00
Gambhiro
b584f6eb9c use macros from the log crate, issue #151 2016-08-14 13:34:02 +01:00
Mathieu David
0b88b043d0 Bump version number to 0.0.14, 0.0.13 has been published to crates.io [ci_skip] 2016-08-02 00:58:08 +02:00
Mathieu David
ac725cb39d bump version to 0.0.13 to publish to crates.io 2016-08-02 00:42:17 +02:00
Mathieu David
5350d62591 Update all dependencies to latest version 2016-08-01 14:06:08 +02:00
Mathieu David
10e7a41d92 Bump version to 0.0.12, version 0.0.11 has been published to crates.io 2016-04-13 22:37:46 +02:00
Mathieu David
6aa6546ce4 Merge pull request #128 from Bobo1239/serve-squashed
Implement Serve feature
2016-04-04 23:17:01 +02:00
Boris-Chengbiao Zhou
c8051294b0 Switch from rust-websocket to ws-rs 2016-04-02 21:44:13 +02:00
Jorge Aparicio
807a2f116e travis: test/release on/for i686-apple-darwin 2016-04-02 09:33:05 -05:00
Boris-Chengbiao Zhou
e861880f95 Implement Serve feature 2016-04-02 05:20:46 +02:00
Boris-Chengbiao Zhou
b30a8bdc81 Update dependencies 2016-03-19 17:45:58 +01:00
Mathieu David
075da959c9 bump version, v0.0.10 has been published to crates.io 2016-03-01 18:50:04 +01:00
Mathieu David
625f5081fa update notify and change dependency version restrictions 2016-03-01 18:32:43 +01:00
Mathieu David
f24eb59753 Bump version number, v0.0.9 has been published to Crates.io 2016-02-22 19:03:31 +01:00
Mathieu David
dd0cfc14d4 bump version number to 0.0.9, v0.0.8 has been published to crates.io 2016-02-16 08:57:55 +01:00
Mathieu David
394023f617 Bump version number from 0.0.7 to 0.0.8, version 0.0.7 has been published to Crates.io 2016-02-15 21:20:07 +01:00
Mathieu David
39a6fe4b3c Fix wildcard dependency on crossbeam 2016-02-15 21:18:43 +01:00
funkill
814b21ad94 pulldown-mark version bump 2016-02-15 21:25:46 +03:00
Mathieu David
e286b208da Bump version from 0.0.6 to 0.0.7, v0.0.6 has been published to Crates.io 2016-01-03 14:18:36 +01:00
Mathieu David
d000fc8bac Updated pulldown-cmark to version 0.0.5
Version 0.0.5 contains table and footnotes support, both options are now enabled in mdBook.
2016-01-03 12:02:39 +01:00
Mathieu David
9c5c8a6804 Bump version to 0.0.6, v0.0.5 has been published to Crates.io 2015-12-30 17:26:04 +01:00
Mathieu David
98cd2f0c27 Version bump to 0.0.5, v0.0.4 has been published to crates.io 2015-12-30 17:05:09 +01:00
Mathieu David
b40688c880 Merge branch 'master' into watch-command 2015-12-29 13:40:13 +01:00
Mathieu David
4ca6693a48 Update handlebars from 0.11.x to 0.12.x 2015-12-15 18:58:34 +01:00
Mathieu David
d376b0663a Bumped version to 0.0.4 (after publishing 0.0.3 to crates.io) + updated README to use cargo install for the installation 2015-12-11 22:17:05 +01:00
Kevin K
274c22c702 adds version for deps to make cargo installable 2015-11-20 08:41:16 -05:00
Mathieu David
22b6448381 Merge branch 'master' into watch-command 2015-11-10 16:33:25 +01:00
Mathieu David
6dcb411f6a Bumped version that was still set to 0.0.1 + added a bigger top margin for h2 and h3 elements 2015-11-10 16:26:39 +01:00
Mathieu David
cdbb2ee5fd Watch builds are now spawned in new threads (using crossbeam) and there is a timelock, preventing multiple builds being triggered in less than a second 2015-11-09 14:31:00 +01:00
Mathieu David
522eef9296 first implementation of the watch sub-command. #61 Needs refining, bug in notify made me use recursion, afraid of hitting the max recursion limit... 2015-09-27 14:38:37 +02:00
Mathieu David
a177a9e10d Only regenerate css when feature regenerate-css is enabled 2015-09-24 15:37:20 +02:00
Mathieu David
e377f4702f Preliminary setup for switching from pure css to stylus 2015-09-18 14:46:55 +02:00
Mathieu David
835c61c7f3 Some clean-up + initial implementation of '--theme' flag for init. Still needs some work 2015-08-11 16:13:41 +02:00
Mathieu David
3baa916a28 Added crate metadata 2015-08-06 23:37:44 +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
e725215103 Add rustdoc generated API doc 2015-08-06 12:38:48 +02:00
Mathieu David
4ead44457a Added a new macro 'output' that can be disabled by a feature 2015-08-04 17:13:24 +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
Kevin K
c7361704b9 uses clap to simplify CLI 2015-08-01 00:59:05 -04:00
Mathieu David
4203b5b1c4 added markdown with 'pulldown-cmark', added basic styling, render of the toc is still not completely done 2015-07-28 21:01:13 +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
b94304405a Skeleton for main.rs (binary) 2015-07-06 21:12:24 +02:00
Mathieu David
d5a8d7f3a1 Initial commit 2015-07-06 14:21:59 +02:00