From 9669c3562cee13f10c36b17584c1fe1e8f255f6c Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Mon, 1 May 2017 14:55:42 +0900 Subject: [PATCH] Some fix and use toml master branch for now --- Cargo.lock | 6 +++--- Cargo.toml | 3 ++- src/front_matter.rs | 4 ++-- src/lib.rs | 2 +- tests/front_matter.rs | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41a08351..8d178e9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ dependencies = [ "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "tera 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "term-painter 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.0 (git+https://github.com/alexcrichton/toml-rs)", "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "ws 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -895,7 +895,7 @@ dependencies = [ [[package]] name = "toml" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/alexcrichton/toml-rs#95b3545938f67ca98d313be5c9c8930ee2407a30" dependencies = [ "serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1172,7 +1172,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a" "checksum thread_local 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7" "checksum time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "ffd7ccbf969a892bf83f1e441126968a07a3941c24ff522a26af9f9f4585d1a3" -"checksum toml 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3063405db158de3dce8efad5fc89cf1baffb9501a3647dc9505ba109694ce31f" +"checksum toml 0.4.0 (git+https://github.com/alexcrichton/toml-rs)" = "" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" diff --git a/Cargo.toml b/Cargo.toml index 62e971fe..abf8fd88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,8 @@ tera = "0.10" slug = "0.1" syntect = { version = "1", features = ["static-onig"] } chrono = "0.3" -toml = "0.4" +# toml = "0.4" +toml = { git = "https://github.com/alexcrichton/toml-rs" } term-painter = "0.2" base64 = "0.5" diff --git a/src/front_matter.rs b/src/front_matter.rs index 2d138d86..d8e45264 100644 --- a/src/front_matter.rs +++ b/src/front_matter.rs @@ -111,8 +111,8 @@ impl FrontMatter { impl Default for FrontMatter { fn default() -> FrontMatter { FrontMatter { - title: "default".to_string(), - description: " A default front matter".to_string(), + title: None, + description: None, date: None, slug: None, url: None, diff --git a/src/lib.rs b/src/lib.rs index 03ed1093..5c73dc1d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ mod filters; pub use site::{Site, GUTENBERG_TERA}; pub use config::{Config, get_config}; -pub use front_matter::{FrontMatter, split_content}; +pub use front_matter::{FrontMatter, split_content, SortBy}; pub use page::{Page, populate_previous_and_next_pages}; pub use section::{Section}; pub use utils::{create_file}; diff --git a/tests/front_matter.rs b/tests/front_matter.rs index 575d4738..9467779a 100644 --- a/tests/front_matter.rs +++ b/tests/front_matter.rs @@ -3,7 +3,7 @@ extern crate tera; use std::path::Path; -use gutenberg::{FrontMatter, split_content}; +use gutenberg::{FrontMatter, split_content, SortBy}; use tera::to_value; @@ -156,7 +156,7 @@ description = "hey there" sort_by = "date""#; let res = FrontMatter::parse(content).unwrap(); assert!(res.sort_by.is_some()); - assert!(res.sort_by.unwrap(), SortBy::Date); + assert_eq!(res.sort_by.unwrap(), SortBy::Date); } #[test] @@ -167,7 +167,7 @@ description = "hey there" sort_by = "order""#; let res = FrontMatter::parse(content).unwrap(); assert!(res.sort_by.is_some()); - assert!(res.sort_by.unwrap(), SortBy::Order); + assert_eq!(res.sort_by.unwrap(), SortBy::Order); } #[test] @@ -178,7 +178,7 @@ description = "hey there" sort_by = "none""#; let res = FrontMatter::parse(content).unwrap(); assert!(res.sort_by.is_some()); - assert!(res.sort_by.unwrap(), SortBy::None); + assert_eq!(res.sort_by.unwrap(), SortBy::None); } #[test]