Commit Graph

707 Commits

Author SHA1 Message Date
Michael Bryan 7821835129 Reverted some churn (cheers cargo-edit) and added myself to contributors 2017-09-30 16:05:53 +08:00
Michael Bryan 3a51e4a27c Everything compiles and all the tests pass. 2017-09-30 16:00:21 +08:00
Michael Bryan d39352aa45 Unit tests now all pass 2017-09-30 16:00:21 +08:00
Michael Bryan c4da845974 Removed old bookitem.md, now everyone uses the correct BookItem 2017-09-30 15:52:46 +08:00
Michael Bryan 7ca198a700 Moved most of MDBook over to using the new Book format 2017-09-30 15:52:46 +08:00
Michael Bryan ce6dbd6736 Deleted previous bookitem.md and moved loader contents across 2017-09-30 15:52:46 +08:00
Michael Bryan 02d1d9317d Started cleaning up some of the lints and warnings 2017-09-30 15:52:46 +08:00
Michael Bryan 4202ead962 Started integrating some of the feedback from budziq 2017-09-30 15:52:46 +08:00
Michael Bryan b925c7c41c Added a depth-first chapter iterator 2017-09-30 15:52:46 +08:00
Michael Bryan 1b5a58902f Created a Loader for loading a book using the Summary
This is a squashed commit. It roughly encompasses the following changes.

---

\# Book

- Created another private submodule, mdbook::loader::book

- This submodule contains the data types representing a Book

- For now the Book just contains a list of BookItems (either chapters or
separators)

- A Chapter contains its name, contents (as one long string), an
optional section number (only numbered chapters have numbers,
obviously), and any nested chapters

- There's a function for loading a single Chapter from disk using it's
associated Link entry from the SUMMARY.md

- Another function builds up the Book by recursively visiting all Links
and separators in the Summary and joining them into a single
Vec<SummaryItem>. This is the only non-dumb-data-type item which is
actually exported from the book module

\# Loader

- Made the loader use the book::load_book_from_disk function for
loading a book in the loader's directory.

\# Tests

- Made sure you can load from disk by writing some files to a temporary
directory

- Made sure the Loader can load the entire example-book from disk and
doesn't crash or hit an error

- Increased test coverage from 34.4% to 47.7% (as reported by cargo
kcov)
2017-09-30 15:52:46 +08:00
Michael Bryan 6d0d4bf379 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-09-30 15:52:46 +08:00
Mathieu David a6d4881e00 Merge pull request #450 from Zengor/master
Call playground with /execute
2017-09-23 21:35:41 +02:00
Mathieu David a0515bd104 Merge pull request #449 from steveklabnik/fix-regression
Change key for theme to not clobber old books
2017-09-23 20:42:31 +02:00
steveklabnik 9b64db908f prefix sidebar too 2017-09-22 13:58:45 -04:00
steveklabnik f562878131 I forgot one theme, thanks budziq 2017-09-22 13:56:58 -04:00
Zengor 3823fc0e74 Call playground with /execute and not the legacy /evaluate.json
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.
2017-09-21 00:24:47 -03:00
steveklabnik 793fb8f654 Change key for theme to not clobber old books
Fixes https://github.com/azerupi/mdBook/issues/448
2017-09-19 16:59:16 -04:00
Bartłomiej T. Listwon 911683d2cf Fix styling regression on print media in chromium
Forces 0px left padding on print view even if sidebar is visible
2017-09-18 22:10:31 +02:00
Mathieu David 2ae6e6a6e3 Merge pull request #445 from Listwon/master
Fix code snippet font size a little smaller in FF
2017-09-18 14:32:57 +02:00
Bartłomiej T. Listwon 91fd8a2865 Fix code snippet font size a little smaller in FF 2017-09-18 11:18:21 +02:00
Steve Klabnik a3b6e549e2 Merge pull request #440 from budziq/force_runnable
added `mdbook-runnable` infostring support
2017-09-14 12:48:29 -04:00
Steve Klabnik d450518292 Merge pull request #439 from azerupi/fix-print
Fix the issue with pages named print not at the root
2017-09-14 11:44:38 -04:00
Michal Budzynski c056df597a added `mdbook-runnable` infostring support
makes `ignore`'d playpens runnable
2017-09-13 22:54:01 +02:00
Mathieu David 0d6adc5fc9 Fix the issue with pages named print not at the root 2017-09-13 22:17:23 +02:00
Mathieu David 0226da91e4 Fix shield in README 2017-09-11 19:47:39 +02:00
Mathieu David ef5895fa78 Update all dependencies 2017-09-11 19:38:10 +02:00
Mathieu David 8e0abfb22f Fix test condition in Travis config 2017-09-10 09:06:46 +02:00
Mathieu David c9bc13d786 Merge pull request #429 from azerupi/ci-infra
Revive Travis
2017-09-10 00:09:08 +02:00
Mathieu David 7ce78cbfea Fix missing && in travis config 2017-09-08 20:24:29 +02:00
Mathieu David 26544fa531 Fix Travis script 2017-09-08 20:24:29 +02:00
Mathieu David 0c93770f4a Update and simplify Travis CI 2017-09-08 20:24:29 +02:00
Mathieu David 743713ad3a Merge pull request #425 from dvberkel/correct-documentation-of-inline-mathematics
Correct inline mathematics delimiters
2017-09-08 20:23:08 +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 84ef4d2617 preserve dashes when generating anchors and trim whitespace 2017-09-08 19:59:04 +02:00
Daan van Berkel bd30cae17e
Correct inline mathematics delimiters
This fixes #424
2017-09-08 09:21:20 +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
Mathieu David 016ec8836c Merge pull request #415 from azerupi/fix-print-title
Fix the print title that was using the title from the last rendered chapter
2017-09-07 23:29:54 +02:00
Mathieu David 881a1b39ff Remove the logic in handlebars and expose the 3 different titles in the handlebars variables 2017-09-07 23:19:22 +02:00
Mathieu David a1e58229b2 Merge pull request #418 from behnam/manifest
[Cargo.toml] Fix package.exclude warnings
2017-09-07 22:46:49 +02:00
Mathieu David 276eab095c Merge pull request #427 from budziq/spurious_reloads
Do not trigger spurious watch events on Write and Remove
2017-09-07 22:45:12 +02:00
Mathieu David f4513d3b5c Merge pull request #419 from behnam/nested
Fix heading links in nested pages
2017-09-07 22:39:51 +02:00
Michal Budzynski 570ce6681f Do not trigger spurious watch events on Write and Remove 2017-09-06 22:33:56 +02:00
Behnam Esfahbod ddee839d9c [renderer] Err on bad file names, instead of panic
Addressing the review comments.
2017-09-06 02:25:10 -07:00
Behnam Esfahbod 99945542ca [renderer] Add normalize_path()
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.
2017-09-06 00:52:17 -07:00
Behnam Esfahbod 956a5cc7fd Fix heading links in nested pages
Plus fixing the whitespace chars not being replaced by hyphen.

Also expand tests for link creations, and add test for nested pages.

Fixes <https://github.com/azerupi/mdBook/issues/416>
Fixes <https://github.com/azerupi/mdBook/issues/417>
2017-09-06 00:52:17 -07:00
Behnam Esfahbod cef62ec42e Fix build and test warnings
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.
2017-09-06 00:52:17 -07:00
Behnam Esfahbod b1362bfa06 [watch] Fix build warnings 2017-09-06 00:52:15 -07: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