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
This commit changes the url used to call the playground, and the
request parameter format to go with it. The older evaluate is
available in the playground as a form of backwards compatibility
and swithcing now opens way for using newer features.
On the web, the normalized path separator is forward-slash (`/`), so we
use the built-in `is_separator()` method to replace any path separator
with the forward-slash, to ensure consistent output on unix and windows
machines.
Move non-test test module files into their own directories to prevent
cargo from running them as tests. Then suppress the left-over warnings.
Move *dummy book* code and data into a shared folder, and leave the rest
of helper utilities (one function) in the original module.
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.
- list of available crates is dynamically loaded from play.rust-lang.org
- play button is enabled only if crates used in snippet are available on playground
- ACE editor's play button is dynamically updated on each text change
- `no_run` is honored by always disabling the play button
- minor cleanups
To only ignore the output destination (default: `book`) and no other
file/directory with the same name under the mdbook root, we should
prefix the gitignore rule with a leading slash (default: `/book`).
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.