Commit Graph

75 Commits

Author SHA1 Message Date
Michael Bryan 01301d9951 Started cleaning up some of the lints and warnings 2017-08-03 00:30:45 +08:00
Michael Bryan 0a035e3a49 Created a SUMMARY.md parser and basic Loader
From the [pull request comment][pr], here's a rough summary of what
was done in the squashed commits.

---

\# Summary Parser

- Added a private submodule called `mdbook::loader::summary` which
contains all the code for parsing `SUMMARY.md`

- A `Summary` contains a title (optional), then some prefix, numbered,
and suffix chapters (technically `Vec<SummaryItem>`)

- A `SummaryItem` is either a `Link` (i.e. link to a chapter), or a
separator

- A `Link` contains the chapter name, its location relative to the
book's `src/` directory, and a list of nested `SummaryItems`

- The `SummaryParser` (a state machine-based parser) uses
`pulldown_cmark` to turn the `SUMMARY.md` string into a stream of
`Events`, it then iterates over those events changing its behaviour
depending on the current state,

  - The states are `Start`, `PrefixChapters`, `NestedChapters(u32)` (the
  `u32` represents your nesting level, because lists can contain lists),
  `SuffixChapters`, and `End`

  - Each state will read the appropriate link and build up the
  `Summary`, skipping any events which aren't a link, horizontal rule
  (separator), or a list

\# Loader

- Created a basic loader which can be used to load the `SUMMARY.md` in
a directory.

\# Tests

- Added a couple unit tests for each state in the parser's state
machine

- Added integration tests for parsing a dummy SUMMARY.md then asserting
the result is exactly what we expected

[pr]: https://github.com/azerupi/mdBook/pull/371#issuecomment-312636102
2017-08-03 00:30:45 +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
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