* 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.
* 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
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.
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.
- 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
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
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