aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Letan <contact@thomasletan.fr>2019-08-15 12:28:34 +0200
committerThomas Letan <contact@thomasletan.fr>2019-08-15 15:48:43 +0200
commitad38eaad27fe6c45dc9694936cd7e3d887271d51 (patch)
tree185b2e9c17711fc920e53c163a7f5ccda44b9a59
parentchore: Add a minimal README (diff)
chore: Abstract away the loading process of a Book project
At some point, we will want to create a website to write ogmarkup document in a collaborative manner. To prepare that time, we abstract away the loading process of a Book project with a dedicated trait. In addition, the project is now divided into a library on the one hand, and the celtchar executable on the other hand. The celtchar executable uses its own implementation of the [Loader] trait to load a Book project from the filesystem, as before. This means, currently, the related functions are not provided by the celtchar library.
-rw-r--r--.gitignore3
-rw-r--r--Cargo.lock847
-rw-r--r--Cargo.toml19
-rw-r--r--app/Cargo.toml15
-rw-r--r--app/src/filesystem.rs114
-rw-r--r--app/src/main.rs (renamed from src/main.rs)38
-rw-r--r--lib/Cargo.toml12
-rw-r--r--lib/src/epub.rs (renamed from src/epub.rs)139
-rw-r--r--lib/src/error.rs (renamed from src/error.rs)0
-rw-r--r--lib/src/lib.rs14
-rw-r--r--lib/src/project.rs107
-rw-r--r--lib/src/render.rs (renamed from src/render.rs)0
-rw-r--r--src/project.rs129
13 files changed, 302 insertions, 1135 deletions
diff --git a/.gitignore b/.gitignore
index 5c09e9c..2f88dba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
/target
**/*.rs.bk
-
-/_build \ No newline at end of file
+Cargo.lock \ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
deleted file mode 100644
index a50f628..0000000
--- a/Cargo.lock
+++ /dev/null
@@ -1,847 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-[[package]]
-name = "adler32"
-version = "1.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "aho-corasick"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "ansi_term"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "atty"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
- "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "autocfg"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "backtrace"
-version = "0.3.34"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
- "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "backtrace-sys"
-version = "0.1.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "bitflags"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "block-buffer"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "block-padding"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "byte-tools"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "byteorder"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "bzip2"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "bzip2-sys"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "cc"
-version = "1.0.38"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "celtchar"
-version = "0.1.0"
-dependencies = [
- "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "ogmarkup 0.1.0 (git+https://git.sr.ht/~lthms/ogmarkup/?rev=feaf8d0cbc7aa34ac521020914df91489ef24595)",
- "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
- "tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "zip 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "cfg-if"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "chrono"
-version = "0.4.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "clap"
-version = "2.33.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "crc32fast"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "deunicode"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "digest"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "error-chain"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)",
- "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "fake-simd"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "generic-array"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "glob"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "humansize"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "idna"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "itoa"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "lazy_static"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "lexical-core"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "stackvector 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "static_assertions 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "libc"
-version = "0.2.58"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "libflate"
-version = "0.1.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "maplit"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "matches"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "memchr"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "nom"
-version = "5.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "lexical-core 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "num-integer"
-version = "0.1.41"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "numtoa"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "ogmarkup"
-version = "0.1.0"
-source = "git+https://git.sr.ht/~lthms/ogmarkup/?rev=feaf8d0cbc7aa34ac521020914df91489ef24595#feaf8d0cbc7aa34ac521020914df91489ef24595"
-dependencies = [
- "nom 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "opaque-debug"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "percent-encoding"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "pest"
-version = "2.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "pest_derive"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "pest_generator"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pest_meta 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "pest_meta"
-version = "2.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "podio"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "proc-macro2"
-version = "0.4.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "quote"
-version = "0.6.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "redox_syscall"
-version = "0.1.54"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "redox_termios"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "regex"
-version = "1.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "rle-decode-fast"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "rustc-demangle"
-version = "0.1.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "rustc_version"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "ryu"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "semver"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "semver-parser"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "serde"
-version = "1.0.92"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "serde_derive"
-version = "1.0.92"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "serde_json"
-version = "1.0.40"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "sha-1"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "slug"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "smallvec"
-version = "0.6.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "stackvector"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "static_assertions"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "strsim"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "syn"
-version = "0.15.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "take_mut"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "tera"
-version = "0.11.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
- "slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "unic-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "termion"
-version = "1.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
- "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "textwrap"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "thread_local"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "time"
-version = "0.1.42"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "toml"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "typenum"
-version = "1.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "ucd-trie"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "unic-char-property"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unic-char-range 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unic-char-range"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "unic-common"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "unic-segment"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unic-ucd-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unic-ucd-segment"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unic-char-property 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "unic-char-range 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "unic-ucd-version 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unic-ucd-version"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unic-common 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unicode-bidi"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unicode-normalization"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unicode-width"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "unicode-xid"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "unreachable"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "url"
-version = "1.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "utf8-ranges"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "vec_map"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "version_check"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "void"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "zip"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libflate 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
- "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[metadata]
-"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
-"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
-"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
-"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
-"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b"
-"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba"
-"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
-"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
-"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
-"checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09"
-"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
-"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
-"checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b"
-"checksum bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6584aa36f5ad4c9247f5323b0a42f37802b37a836f0ad87084d7a33961abe25f"
-"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46"
-"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
-"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe"
-"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
-"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
-"checksum deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
-"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
-"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9"
-"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
-"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
-"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
-"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
-"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
-"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
-"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
-"checksum lexical-core 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b0f90c979adde96d19eb10eb6431ba0c441e2f9e9bdff868b2f6f5114ff519"
-"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319"
-"checksum libflate 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "45c97cf62125b79dcac52d506acdc4799f21a198597806947fd5f40dc7b93412"
-"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
-"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
-"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
-"checksum nom 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9761d859320e381010a4f7f8ed425f2c924de33ad121ace447367c713ad561b"
-"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
-"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
-"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
-"checksum ogmarkup 0.1.0 (git+https://git.sr.ht/~lthms/ogmarkup/?rev=feaf8d0cbc7aa34ac521020914df91489ef24595)" = "<none>"
-"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
-"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
-"checksum pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "933085deae3f32071f135d799d75667b63c8dc1f4537159756e3d4ceab41868c"
-"checksum pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
-"checksum pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63120576c4efd69615b5537d3d052257328a4ca82876771d6944424ccfd9f646"
-"checksum pest_meta 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f249ea6de7c7b7aba92b4ff4376a994c6dbd98fd2166c89d5c4947397ecb574d"
-"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd"
-"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
-"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
-"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252"
-"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
-"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"
-"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f"
-"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
-"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af"
-"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
-"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"
-"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
-"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-"checksum serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "32746bf0f26eab52f06af0d0aa1984f641341d06d8d673c693871da2d188c9be"
-"checksum serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "46a3223d0c9ba936b61c0d2e3e559e3217dbfb8d65d06d26e8b3c25de38bae3e"
-"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
-"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68"
-"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
-"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
-"checksum stackvector 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1c4725650978235083241fab0fdc8e694c3de37821524e7534a1a9061d1068af"
-"checksum static_assertions 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4f8de36da215253eb5f24020bfaa0646613b48bf7ebe36cdfa37c3b3b33b241"
-"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-"checksum syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)" = "641e117d55514d6d918490e47102f7e08d096fdde360247e4a10f7a91a8478d3"
-"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
-"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
-"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea"
-"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
-"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
-"checksum toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b8c96d7873fa7ef8bdeb3a9cda3ac48389b4154f32b9803b4bc26220b677b039"
-"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
-"checksum ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2"
-"checksum unic-char-property 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce36d3f7ce754afdbccccf8ff0dd0134e50fb44aaae579f96218856e9e5dbd1e"
-"checksum unic-char-range 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ab85fab42ad1b26cafc03bf891f69cb4d6e15f491030e89a0122197baa8ae8"
-"checksum unic-common 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8d4a7ade929ef7d971e16ced21a8cd56a63869aa6032dfb8cb083cf7d077bf"
-"checksum unic-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ca47cbb09fb5fcd066b5867d11dc528302fa465277882797d6a836e1ee6f9e"
-"checksum unic-ucd-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48f1a08ce0409a9e391b88d1930118eec48af12742fc538bcec55f775865776e"
-"checksum unic-ucd-version 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1f5e6c6c53c2d0ece4a5964bc55fcff8602153063cb4fab20958ff32998ff6"
-"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
-"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
-"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
-"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
-"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
-"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
-"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
-"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
-"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
-"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
-"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
-"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-"checksum zip 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c18fc320faf909036e46ac785ea827f72e485304877faf1a3a39538d3714dbc3"
diff --git a/Cargo.toml b/Cargo.toml
index d05a914..3d05405 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,17 +1,2 @@
-[package]
-name = "celtchar"
-version = "0.1.0"
-authors = ["Thomas Letan <contact@thomasletan.fr>"]
-
-[dependencies]
-toml = "0.5"
-clap = "2.33"
-serde = "1.0"
-serde_derive = "1.0"
-serde_json = "1.0"
-tera = "0.11"
-zip = "0.5"
-
-[dependencies.ogmarkup]
-git = "https://git.sr.ht/~lthms/ogmarkup/"
-rev = "feaf8d0cbc7aa34ac521020914df91489ef24595" \ No newline at end of file
+[workspace]
+members = [ 'lib', 'app' ] \ No newline at end of file
diff --git a/app/Cargo.toml b/app/Cargo.toml
new file mode 100644
index 0000000..90ececf
--- /dev/null
+++ b/app/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "celtchar"
+version = "0.1.0"
+authors = ["Thomas Letan <contact@thomasletan.fr>"]
+
+[dependencies]
+toml = "0.5"
+clap = "2.33"
+serde = "1.0"
+serde_derive = "1.0"
+serde_json = "1.0"
+tera = "0.11"
+zip = "0.5"
+libceltchar = { version = "0.1", path = "../lib" }
+ogmarkup = { version = "0.1", git = "https://git.sr.ht/~lthms/ogmarkup" } \ No newline at end of file
diff --git a/app/src/filesystem.rs b/app/src/filesystem.rs
new file mode 100644
index 0000000..7c07219
--- /dev/null
+++ b/app/src/filesystem.rs
@@ -0,0 +1,114 @@
+use std::path::{PathBuf};
+use std::fs;
+use std::fs::{canonicalize};
+use std::env::{current_dir, set_current_dir};
+
+use libceltchar::{Loader, Raise, Error, Project, Chapter, Cover};
+
+const PROJECT_FILE : &str = "Book.toml";
+pub struct Fs;
+
+pub fn find_root() -> Result<PathBuf, Error> {
+ let mut cwd: PathBuf = current_dir().or_raise("cannot get current directory")?;
+
+ loop {
+ cwd.push(PROJECT_FILE); // (*)
+
+ if cwd.exists() {
+ cwd.pop(); // we pop the `Book.toml` previously pushed (see (*))
+
+ return Ok(cwd);
+ } else {
+ // We `pop` a first time for `Book.toml`, since we have pushed
+ // previously it (see (*))
+ cwd.pop();
+
+ // We `pop` a second time to get the parent directory of cwd. If
+ // `pop` returns false, we are at the root of the current FS, and
+ // there is no project file to find.
+ if !cwd.pop() {
+ return Err(Error::new("could not find Book.toml"))
+ }
+ }
+ }
+}
+
+fn canonicalize_chapter(
+ chapter : &Chapter<Vec<PathBuf>>
+) -> Result<Chapter<Vec<PathBuf>>, Error> {
+ let title = chapter.title.clone();
+ Ok(Chapter {
+ title: title,
+ content: chapter.content
+ .iter()
+ .map(|x| canonicalize(x).or_raise(&format!("Could not canonicalize {:?}", x)))
+ .collect::<Result<_, Error>>()?
+ })
+}
+
+fn canonicalize_project(
+ project : Project<PathBuf, Vec<PathBuf>>
+) -> Result<Project<PathBuf, Vec<PathBuf>>, Error> {
+ Ok(Project {
+ author: project.author,
+ title: project.title,
+ cover: project.cover.map(canonicalize)
+ .map_or(Ok(None), |r| r.map(Some))
+ .or_raise("…")?,
+ numbering: project.numbering,
+ chapters: project.chapters.iter().map(canonicalize_chapter)
+ .collect::<Result<_, Error>>()?
+ })
+}
+
+impl Loader for Fs {
+ type ProjId = PathBuf;
+ type CovId = PathBuf;
+ type DocId = PathBuf;
+
+ fn load_project(
+ &self,
+ id : &PathBuf
+ ) -> Result<Project<PathBuf, Vec<PathBuf>>, Error> {
+ let cwd = current_dir().or_raise("could not get current dir")?;
+
+ let input = fs::read_to_string(PROJECT_FILE)
+ .or_raise("found Book.toml, but cannot read it")?;
+
+ // We have to modify set the current directory to the PROJECT_FILE directory,
+ // otherwise `canonicalize` will not work.
+ set_current_dir(id).or_raise("could not change the current directory")?;
+ let res = canonicalize_project(
+ toml::from_str(input.as_str())
+ .or_raise(&format!("could not parse Book.toml"))?
+ )?;
+ set_current_dir(cwd).or_raise("could not change the current directory")?;
+
+ Ok(res)
+ }
+
+ fn load_cover(
+ &self,
+ id : &PathBuf
+ ) -> Result<Cover, Error> {
+ let extension = id.extension()
+ .or_raise("cover lacks an extension")?
+ .to_str()
+ .or_raise("cover extension is not valid utf-8")?;
+
+ let content = fs::read(id)
+ .or_raise(&format!("could not read cover from {:?}", id))?;
+
+ Ok(Cover {
+ extension: String::from(extension),
+ content: content,
+ })
+ }
+
+ fn load_document(
+ &self,
+ id : &PathBuf
+ ) -> Result<String, Error> {
+ fs::read_to_string(id).or_raise(&format!("Could not read {:?}", id))
+ }
+}
diff --git a/src/main.rs b/app/src/main.rs
index d95e119..52d590d 100644
--- a/src/main.rs
+++ b/app/src/main.rs
@@ -1,46 +1,36 @@
extern crate clap;
-extern crate ogmarkup;
-extern crate serde_derive;
extern crate serde_json;
extern crate toml;
-#[macro_use]
+extern crate libceltchar;
+extern crate ogmarkup;
extern crate tera;
-extern crate zip;
+
+use std::path::PathBuf;
use clap::{App, SubCommand};
-pub mod error;
-pub mod render;
-pub mod project;
-pub mod epub;
+use ogmarkup::typography::FRENCH;
-use std::path::PathBuf;
+use libceltchar::{Error, Zip, EpubWriter, Loader};
#[cfg(debug_assertions)]
use std::env::current_dir;
#[cfg(debug_assertions)]
-use error::Raise;
-
-use ogmarkup::typography::FRENCH;
+use libceltchar::Raise;
-use error::Error;
-use project::Project;
-use epub::{Zip, Fs};
+mod filesystem;
+use crate::filesystem::{find_root, Fs};
-use epub::EpubWriter;
+fn build(assets : &PathBuf) -> Result<(), Error> {
+ let root = find_root()?;
+ let loader = Fs;
-pub fn build(assets : &PathBuf) -> Result<(), Error> {
- Project::cd_root()?;
-
- let project = Project::find_project()?
- .load_and_render(&FRENCH)?;
+ let project = loader.load_project(&root)?
+ .load_and_render(&loader, &FRENCH)?;
let mut zip_writer = Zip::init()?;
zip_writer.generate(&project, assets)?;
- let mut fs_writer = Fs::init()?;
- fs_writer.generate(&project, assets)?;
-
Ok(())
}
diff --git a/lib/Cargo.toml b/lib/Cargo.toml
new file mode 100644
index 0000000..3786d25
--- /dev/null
+++ b/lib/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "libceltchar"
+version = "0.1.0"
+authors = ["Thomas Letan <contact@thomasletan.fr>"]
+
+[dependencies]
+serde = "1.0"
+serde_derive = "1.0"
+serde_json = "1.0"
+tera = "0.11"
+zip = "0.5"
+ogmarkup = { version = "0.1", git = "https://git.sr.ht/~lthms/ogmarkup" } \ No newline at end of file
diff --git a/src/epub.rs b/lib/src/epub.rs
index a6f09e5..daa3446 100644
--- a/src/epub.rs
+++ b/lib/src/epub.rs
@@ -1,15 +1,12 @@
-use std::env::set_current_dir;
-use std::fs::{create_dir, remove_dir_all, create_dir_all};
-use std::fs;
use std::io::{Read, Write};
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use serde_json::json;
use tera::{Tera, Context};
use crate::error::{Raise, Error};
-use crate::project::{Project, Chapter};
+use crate::project::{Project, Chapter, Cover};
use zip::write::FileOptions;
use zip::ZipWriter;
@@ -25,22 +22,27 @@ pub trait EpubWriter {
tera : & Tera,
template : &str,
ctx : &Context,
- ) -> Result<(), Error> ;
+ ) -> Result<(), Error> {
+ let content = tera.render(template, ctx)
+ .or_raise(&format!("cannot render {}", template))?;
+
+ self.write_bytes(dst, content.as_bytes())
+ }
fn write_file(
&mut self,
dst : &PathBuf,
src : &PathBuf,
- ) -> Result<(), Error> ;
+ ) -> Result<(), Error>;
- fn write_str(
+ fn write_bytes(
&mut self,
dst : &PathBuf,
- input : &str
+ input : &[u8]
) -> Result<(), Error> ;
fn create_mimetype(&mut self) -> Result<(), Error> {
- self.write_str(&PathBuf::from("mimetype"), EPUB_MIMETYPE)
+ self.write_bytes(&PathBuf::from("mimetype"), EPUB_MIMETYPE.as_bytes())
}
fn create_container(&mut self, tera : &Tera) -> Result<(), Error> {
@@ -92,20 +94,12 @@ pub trait EpubWriter {
Ok(())
}
- fn install_cover(&mut self, cover : &PathBuf) -> Result<String, Error> {
- let extension = cover.extension()
- .or_raise("cover lacks an extension")?
- .to_str()
- .or_raise("cover extension is not valid utf-8")?;
-
- let dst = PathBuf::from("OEBPS").join(format!("cover.{}", extension));
-
- self.write_file(&dst, cover)?;
-
- Ok(extension.into())
+ fn install_cover(&mut self, cover : &Cover) -> Result<(), Error> {
+ let dst = PathBuf::from("OEBPS").join(format!("cover.{}", cover.extension));
+ self.write_bytes(&dst, cover.content.as_slice())
}
- fn generate(&mut self, project : &Project<String>, assets : &PathBuf) -> Result<(), Error> {
+ fn generate(&mut self, project : &Project<Cover, String>, assets : &PathBuf) -> Result<(), Error> {
let tera = compile_templates!(template_dir(assets)?.as_str());
@@ -121,9 +115,9 @@ pub trait EpubWriter {
&Context::new(),
)?;
- let cover_extension = project.cover.clone().map(|cov| self.install_cover(&cov))
- // from Option<Result<_, E>> to Result<Option<_>, E>
- .map_or(Ok(None), |r| r.map(Some))?;
+ if let Some(ref cov) = project.cover {
+ self.install_cover(cov)?;
+ }
let fonts = vec![
"et-book-roman-line-figures.ttf",
@@ -140,7 +134,7 @@ pub trait EpubWriter {
let mut ctx = Context::new();
ctx.insert("title", &project.title);
ctx.insert("author", &project.author);
- ctx.insert("cover_extension", &cover_extension);
+ ctx.insert("cover_extension", &project.cover.as_ref().map(|x| x.extension.clone()));
ctx.insert("files", &files);
ctx.insert("fonts", &fonts);
@@ -189,72 +183,6 @@ fn fonts_dir(assets : &PathBuf) -> Result<PathBuf, Error> {
Ok(res)
}
-pub struct Fs;
-
-const BUILD_DIR : &'static str = "_build";
-
-impl Fs {
- pub fn init() -> Result<Fs, Error> {
- remove_dir_all(BUILD_DIR).or_raise("cannot clean up _build/")?;
- create_dir(BUILD_DIR).or_raise("cannot create _build/")?;
- set_current_dir(BUILD_DIR).or_raise("cannot set current directory to _build/")?;
-
- Ok(Fs)
- }
-
- fn create_parent(&mut self, dst : &PathBuf) -> Result<(), Error> {
- let directory : &Path = dst.parent().ok_or(Error(String::from("is not a file")))?;
-
- if !directory.exists() {
- create_dir_all(directory)
- .or_raise(&format!("cannot create directory {:?}", directory))?;
- }
-
- Ok(())
- }
-}
-
-impl EpubWriter for Fs {
- fn write_template(
- &mut self,
- dst : &PathBuf,
- tera : & Tera,
- template : &str,
- ctx : &Context,
- ) -> Result<(), Error> {
- self.create_parent(dst)?;
-
- let content = tera.render(template, ctx)
- .or_raise(&format!("cannot render {}", template))?;
-
- fs::write(dst, content).or_raise(&format!("cannot create {:?}", dst))?;
-
- Ok(())
- }
-
- fn write_str(
- &mut self,
- dst : &PathBuf,
- input : &str
- ) -> Result<(), Error> {
- self.create_parent(dst)?;
-
- fs::write(dst, input).or_raise(&format!("cannot create {:?}", dst))
- }
-
- fn write_file(
- &mut self,
- dst : &PathBuf,
- src : &PathBuf,
- ) -> Result<(), Error> {
- self.create_parent(dst)?;
-
- fs::copy(src, dst).or_raise(&format!("cannot copy {:?} to {:?}", src, dst))?;
-
- Ok(())
- }
-}
-
pub struct Zip {
output : ZipWriter<File>,
dirs : HashSet<PathBuf>,
@@ -284,38 +212,17 @@ impl Zip {
}
impl EpubWriter for Zip {
- fn write_template(
- &mut self,
- dst : &PathBuf,
- tera : & Tera,
- template : &str,
- ctx : &Context,
- ) -> Result<(), Error> {
- self.create_parent(dst)?;
-
- let content = tera.render(template, ctx)
- .or_raise(&format!("cannot render {}", template))?;
-
- self.output.start_file_from_path(dst, FileOptions::default())
- .or_raise(&format!("Could not add file {:?} to archive", dst))?;
-
- self.output.write_all(content.as_bytes())
- .or_raise(&format!("Could not write {:?} content", dst))?;
-
- Ok(())
- }
-
- fn write_str(
+ fn write_bytes(
&mut self,
dst : &PathBuf,
- input : &str
+ input : &[u8]
) -> Result<(), Error> {
self.create_parent(dst)?;
self.output.start_file_from_path(dst, FileOptions::default())
.or_raise(&format!("Could not add file {:?} to archive", dst))?;
- self.output.write_all(input.as_bytes())
+ self.output.write_all(input)
.or_raise(&format!("Could not write {:?} content", dst))?;
Ok(())
diff --git a/src/error.rs b/lib/src/error.rs
index d92077e..d92077e 100644
--- a/src/error.rs
+++ b/lib/src/error.rs
diff --git a/lib/src/lib.rs b/lib/src/lib.rs
new file mode 100644
index 0000000..e0a9644
--- /dev/null
+++ b/lib/src/lib.rs
@@ -0,0 +1,14 @@
+extern crate ogmarkup;
+#[macro_use] extern crate tera;
+extern crate zip;
+extern crate serde_derive;
+extern crate serde_json;
+
+mod render;
+mod error;
+mod project;
+mod epub;
+
+pub use error::{Error, Raise};
+pub use project::{Project, Chapter, Cover, Loader};
+pub use epub::{EpubWriter, Zip};
diff --git a/lib/src/project.rs b/lib/src/project.rs
new file mode 100644
index 0000000..367aca9
--- /dev/null
+++ b/lib/src/project.rs
@@ -0,0 +1,107 @@
+use ogmarkup::typography::Typography;
+use serde_derive::{Deserialize, Serialize};
+
+use crate::render::Html;
+use crate::error::{Raise, Error};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Cover {
+ pub extension : String,
+ pub content : Vec<u8>,
+}
+
+pub trait Loader {
+ type CovId;
+ type DocId;
+ type ProjId;
+
+ fn load_cover(
+ &self,
+ id : &Self::CovId
+ ) -> Result<Cover, Error>;
+
+ fn load_document(
+ &self,
+ id : &Self::DocId
+ ) -> Result<String, Error>;
+
+ fn load_project(
+ &self,
+ id : &Self::ProjId
+ ) -> Result<Project<Self::CovId, Vec<Self::DocId>>, Error>;
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Chapter<I> {
+ pub title : Option<String>,
+ pub content : I,
+}
+
+impl<I> Chapter<Vec<I>> {
+ fn load_and_render<T, L>(
+ &self,
+ loader : &L,
+ typo : &T,
+ ) -> Result<Chapter<String>, Error>
+ where
+ T : Typography,
+ L : Loader<DocId = I>
+ {
+ let title = &self.title;
+ let content = &self.content;
+
+ let doc = content.iter()
+ .map(|ref x| {
+ let input = loader.load_document(x)?;
+ ogmarkup::compile(&input, typo)
+ .or_raise("Cannot parse an ogmarkup document for some reason")
+ .map(Html::to_string)
+ })
+ .collect::<Result<Vec<String>, Error>>()?
+ .join("");
+
+ Ok(Chapter {
+ title: title.clone(),
+ content: doc,
+ })
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct Project<C, I> {
+ pub author: String,
+ pub title: String,
+ pub chapters: Vec<Chapter<I>>,
+ pub cover: Option<C>,
+ pub numbering: Option<bool>,
+}
+
+impl<C, I> Project<C, Vec<I>> {
+ pub fn load_and_render<'input, T, L> (
+ self,
+ loader : &L,
+ typo : &T,
+ ) -> Result<Project<Cover, String>, Error>
+ where
+ T : Typography,
+ L : Loader<CovId = C, DocId = I>,
+ {
+ let numbering = self.numbering;
+ let author = self.author;
+ let title = self.title;
+ let cover = self.cover
+ .map(|x| loader.load_cover(&x).or_raise("cannot load the cover"))
+ .map_or(Ok(None), |r| r.map(Some))?;
+
+ self.chapters.into_iter()
+ .map(|chapter| chapter.load_and_render(loader, typo))
+ .collect::<Result<Vec<Chapter<String>>, Error>>()
+ .map(|x| Project {
+ author: author,
+ title: title,
+ chapters: x,
+ cover: cover,
+ numbering: numbering,
+ })
+ }
+}
diff --git a/src/render.rs b/lib/src/render.rs
index 3e737b0..3e737b0 100644
--- a/src/render.rs
+++ b/lib/src/render.rs
diff --git a/src/project.rs b/src/project.rs
deleted file mode 100644
index da8cd35..0000000
--- a/src/project.rs
+++ /dev/null
@@ -1,129 +0,0 @@
-use std::fs;
-use std::path::PathBuf;
-use std::env::{current_dir, set_current_dir};
-
-use serde_derive::{Deserialize, Serialize};
-
-use ogmarkup::typography::Typography;
-
-use crate::render::Html;
-use crate::error::{Raise, Error};
-
-const PROJECT_FILE: &'static str = "Book.toml";
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Chapter<A> {
- pub title: Option<String>,
- pub content: A,
-}
-
-fn compile_file <'input, T> (
- path : PathBuf,
- typo : &T,
-) -> Result<String, Error>
-where
- T : Typography,
-{
- let input = fs::read_to_string(path.as_path())
- .or_raise(&format!("cannot open {:?}", path))?;
-
- ogmarkup::compile(input.as_str(), typo)
- .map(|x: Html| x.to_string())
- .or_raise(&format!("cannot render {:?}", path))
-}
-
-impl Chapter<Vec<PathBuf>> {
- pub fn load_and_render <'input, T> (
- self,
- typo : &T,
- ) -> Result<Chapter<String>, Error>
- where
- T : Typography
- {
-
- self.content.iter()
- .map(|path| compile_file(path.to_path_buf(), typo))
- .collect::<Result<Vec<String>, Error>>()
- .map(|x| Chapter {
- title: self.title,
- content: x.join(""),
- })
- }
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Project<A> {
- pub author: String,
- pub title: String,
- pub chapters: Vec<Chapter<A>>,
- pub cover: Option<PathBuf>,
- pub numbering: Option<bool>,
-}
-
-impl Project<Vec<PathBuf>> {
- pub fn cd_root() -> Result<(), Error> {
- let mut cwd: PathBuf = current_dir().or_raise("cannot get current directory")?;
-
- loop {
- cwd.push(PROJECT_FILE); // (*)
-
- if cwd.exists() {
- cwd.pop();
-
- set_current_dir(cwd.as_path())
- .or_raise(&format!("cannot set current directory to {:?}", cwd))?;
-
- return Ok(());
- } else {
- // We `pop` a first time for `Book.toml`, since we have pushed
- // previously it (see (*))
- cwd.pop();
-
- // We `pop` a second time to get the parent directory of cwd. If
- // `pop` returns false, we are at the root of the current FS, and
- // there is no project file to find.
- if !cwd.pop() {
- return Err(Error::new("could not find Book.toml"))
- }
- }
- }
- }
-
- /// This function tries to open `./Book.toml`. If it succeeds, it tries to
- /// read it as a TOML file.
- pub fn find_project() -> Result<Self, Error> {
- let input = fs::read_to_string(PROJECT_FILE)
- .or_raise("found Book.toml, but cannot read it")?;
-
- toml::from_str(input.as_str())
- .or_raise(&format!("could not parse Book.toml"))
- }
-
- pub fn load_and_render<'input, T> (
- self,
- typo : &T,
- ) -> Result<Project<String>, Error>
- where
- T : Typography
- {
- let numbering = self.numbering;
- let author = self.author;
- let title = self.title;
- let cover = self.cover
- .map(|x| fs::canonicalize(&x)
- .or_raise("cannot compute a canonical path for the cover"))
- // from Option<Result<_, E>> to Result<Option<_>, E>
- .map_or(Ok(None), |r| r.map(Some))?;
-
- self.chapters.into_iter()
- .map(|chapter| chapter.load_and_render(typo))
- .collect::<Result<Vec<Chapter<String>>, Error>>()
- .map(|x| Project {
- author: author,
- title: title,
- chapters: x,
- cover: cover,
- numbering: numbering,
- })
- }
-}