summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Erik Rediger <badboy@archlinux.us>2018-09-18 16:16:56 +0200
committerGitHub <noreply@github.com>2018-09-18 16:16:56 +0200
commit7521a7fa2efd6f56e51b0afd627b77343dfa90da (patch)
tree393db675c4dbdeea068525b3bbb87ce3f08980c7
parent9499caa07b8441f51c20eadfa87592641c0e4ea9 (diff)
parenta5e1e217182a69aaa727d94c8750bdee74b76fd8 (diff)
Merge pull request #1 from badboy/mdbook-alpha
Mdbook alpha
-rw-r--r--.travis.yml4
-rw-r--r--Cargo.lock8
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib.rs8
4 files changed, 12 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index e1badb7..6942f66 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,6 @@ script:
- |
cargo build &&
cargo test
+
notifications:
- email:
- on_success: never
+ email: false
diff --git a/Cargo.lock b/Cargo.lock
index 2d91f82..9366060 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -469,8 +469,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mdbook"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
+version = "0.2.2-alpha.0"
+source = "git+https://github.com/rust-lang-nursery/mdBook#ced74ca4dd87ff7e0d9618b757e3536a6a472910"
dependencies = [
"ammonia 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -506,7 +506,7 @@ dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "mdbook 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mdbook 0.2.2-alpha.0 (git+https://github.com/rust-lang-nursery/mdBook)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark-to-cmark 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1472,7 +1472,7 @@ dependencies = [
"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
"checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
-"checksum mdbook 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a137498976d9c7a6a07bd31c132bf6c3477d824e585436f5ccf47ab538d738c"
+"checksum mdbook 0.2.2-alpha.0 (git+https://github.com/rust-lang-nursery/mdBook)" = "<none>"
"checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d"
"checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
"checksum mime_guess 1.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4c0961143b8efdcfa29c3ae63281601b446a4a668165454b6c90f8024954c5"
diff --git a/Cargo.toml b/Cargo.toml
index c52370a..0975d83 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Jan-Erik Rediger <janerik@fnordig.de>"]
[dependencies]
-mdbook = "0.2.1"
+mdbook = { git = "https://github.com/rust-lang-nursery/mdBook" }
pulldown-cmark = "0.1.2"
pulldown-cmark-to-cmark = "1.1.0"
env_logger = "0.5.10"
diff --git a/src/lib.rs b/src/lib.rs
index a18b8fb..b76ba7c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,19 +15,21 @@ impl Preprocessor for Mermaid {
"mermaid"
}
- fn run(&self, _ctx: &PreprocessorContext, book: &mut Book) -> Result<()> {
- let mut res: Option<_> = None;
+ fn run(&self, _ctx: &PreprocessorContext, mut book: Book) -> Result<Book> {
+ let mut res = None;
book.for_each_mut(|item: &mut BookItem| {
if let Some(Err(_)) = res {
return;
}
+
if let BookItem::Chapter(ref mut chapter) = *item {
res = Some(Mermaid::add_mermaid(chapter).map(|md| {
chapter.content = md;
}));
}
});
- res.unwrap_or(Ok(()))
+
+ res.unwrap_or(Ok(())).map(|_| book)
}
}