Commit Graph

78 Commits

Author SHA1 Message Date
Carol (Nichols || Goulding)
4abac12c04
Fix deprecation warnings for trim left/right matches 2019-03-23 08:47:10 -04:00
Steve Klabnik
a481735fa2 failing test 2019-01-15 14:08:53 -05:00
Bas Bossink
3598e905aa Make failing_alternate_backend test more platform specific
Use the suggestion from @Michael-F-Bryan to make the passing_ and
failing_alternate_backend test more reliable across platforms.
2018-12-05 22:26:53 +01:00
Bas Bossink
742dbbc917 Run rustfmt. 2018-12-04 00:11:41 +01:00
Michael Bryan
132f4fd358
Fixed a bug where the tests use the wrong dummy book 2018-09-16 23:33:58 +08:00
Michael Bryan
1d72cea972
The example preprocessor works 2018-09-16 23:28:01 +08:00
Michael Bryan
1aa1194d79
We can shell out to the preprocessor 2018-09-16 23:23:03 +08:00
Michael Bryan
304234c122
The example can now tell mdbook if renderers are supported 2018-09-16 23:00:19 +08:00
Michael Bryan
729c94a7e4
Started working on a custom preprocessor 2018-09-16 22:49:52 +08:00
Michael Bryan
09667c9956
Configurable preprocessor (#658)
* The preprocessor trait now returns a modified book instead of editing in place

* A preprocessor is told which render it's running for

* Made sure preprocessors get their renderer's name

* Users can now manually specify whether a preprocessor should run for a renderer

* You can normally use default preprocessors by default

* Got my logic around the wrong way

* Fixed the `build.use-default-preprocessors` flag
2018-09-10 18:55:58 +08:00
Matt Ickstadt
1d69ccae48 Run rustfmt
using 0.8.2-stable included in rustc 1.28.0
2018-08-02 20:22:49 -05:00
Matt Ickstadt
1d1d4d7c30 Update tests to handle added dummy_book chapter 2018-07-25 12:45:20 -05:00
Matt Ickstadt
0e1787c617 Don't run index preprocessor on mdbook test 2018-07-25 12:19:01 -05:00
Matt Ickstadt
e5563182fc Add readme to cause test to fail
The test for `mdbook test` fails due to the index preprocessor which only runs on README files.
2018-07-25 12:14:27 -05:00
Matt Ickstadt
5835da2432 Run rustfmt 2018-07-23 12:47:04 -05:00
Matt Ickstadt
e94078cc9c Fix tests 2018-07-23 12:08:04 -05:00
cetra3
bdb37ec117 Use relative links and translate internal references (#603)
* Relative links for 0.1.8

* Compat for IE11 search
2018-07-11 21:33:44 +08:00
Andrew Gauger
2a55ff62f3 Recursively apply preprocessor (#682) 2018-05-20 18:36:19 +08:00
Matt Ickstadt
9a9c625319 Fix default theme dir selection 2018-05-14 14:52:29 -05:00
Weihang Lo
69599646e7 Add index preprocessor (#685)
* Add index preprocessor

README.md is a de facto index file in markdown-based documentation.
Hence, we respect to README.md and convert it into index.html.

* Fix warning for unused variables

* Update tests for config

* Match file stem case-insensitively for IndexPreprocessor

* Add tests for IndexPreprocessor

* Update book example to fit index preprocessor
2018-05-04 19:41:28 +08:00
Bastien Orivel
55f7ed1c37 Replace tempdir by tempfile (#650)
The former has been deprecated in favor of the latter
2018-03-27 07:47:37 +08:00
Matt Ickstadt
5fb3675151 Update elasticlunr-rs (#646)
* Update dependencies

* Use config structs from elasticlunr-rs

* Update searchindex fixture
2018-03-20 20:22:35 +08:00
Matt Ickstadt
b2ad669c61 Search with Elasticlunr, updated (#604)
* Add search with elasticlunr.js

This commit adds search functionality to mdBook, based on work done by @phaiax. The in-browser search code uses elasticlunr.js to execute the search, using an index generated at book build time by elasticlunr-rs.

* Add generator comment
Someone on Reddit was wondering how the rust book was generated and said they checked the source. Thought I'd put this here. Might be a good idea to have a little footer "made with mdBook", but this'll do for now.

* Remove search/editor file override behavior

* Use for loop for book iterator

* Improve HTML regex

* Fix search CORS in file URIs

* Use ammonia to sanitize HTML

* Filter html5ever log messages
2018-03-07 21:02:06 +08:00
Michael Bryan
bda23f0183
Missing backends are no longer fatal 2018-01-25 01:15:29 +08:00
Michael Bryan
c89245b45b
Recursively apply replace_all() when running the links preprocessor (#564)
* Looks like we forgot to recursively apply replace_all() in #532

* Removed some print statements

* Made sure we ignore the rendered dummy_book
2018-01-22 06:44:28 +08:00
Michael Bryan
232a923676
Added a windows-specific tee equivalent (#561)
* Added a windows-specific `tee` equivalent

* Changed how the windows "tee" command gets quoted

* Temporarily disabled the backends_receive_render_context_via_stdin test
2018-01-20 21:46:44 +08:00
Jaime Valdemoros
80a20eb730 Use Arc instead of lazy_static for dummy preprocessor 2018-01-17 19:02:25 +00:00
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
vabc3
fd8f3bb415 Remove unneeded mut modifier in test (#534) 2018-01-08 00:25:45 +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
Michael Bryan
cba16a0083
Updated dependencies and made logging more readable 2017-12-30 18:43:46 +08: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
4f4e86db3a
Added tests to make sure we parse existing SUMMARY.md's 2017-12-11 12:26:11 +11:00
Michael Bryan
ace0b51fb6
Put the create_missing feature back in 2017-12-11 10:32:35 +11:00
Michael Bryan
9950f69c48
Removed the MDBook::read_config() method because it's redundant now 2017-12-10 23:13:46 +11:00
Michael Bryan
12d1ed5558
The example book renders correctly 2017-12-10 22:59:35 +11:00
Michael Bryan
751da4f05f
Added a test to make sure you can include rust files in chapters 2017-12-10 22:59:35 +11:00
Michael Bryan
f993677626
All tests finally pass! 2017-12-10 22:52:00 +11:00
Michael Bryan
21498631b3
Made sure the dummy book can build 2017-12-10 22:50:57 +11:00
Michael Bryan
8b21da9950
Fleshed out book creation 2017-12-10 22:50:57 +11:00
Michael Bryan
47eb4788cb
Introduced the BookBuilder.
- You now use a `BookBuilder` for creating a book directory tree

- This also removes the `--no-create` argument
2017-12-10 22:49:40 +11:00
Michael Bryan
42ff5a895c
Added a test to make sure book.toml isn't required 2017-12-09 20:46:39 +11:00
Chris Spiegel
803df90efa Add tests to check create-missing. 2017-12-02 22:53:19 -08: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
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
Michael Bryan
3aa6436679
Added in things from @Phaiax's review 2017-11-12 21:37:38 +08:00
Michael Bryan
d37821c194
Rebased after #438 2017-11-12 21:37:38 +08:00