Some fix and use toml master branch for now

This commit is contained in:
Vincent Prouillet 2017-05-01 14:55:42 +09:00
parent a0b70bfc7e
commit 9669c3562c
5 changed files with 12 additions and 11 deletions

6
Cargo.lock generated
View file

@ -21,7 +21,7 @@ dependencies = [
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", "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)", "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)", "ws 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -895,7 +895,7 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/alexcrichton/toml-rs#95b3545938f67ca98d313be5c9c8930ee2407a30"
dependencies = [ dependencies = [
"serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "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-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 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 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)" = "<none>"
"checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "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 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" "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6"

View file

@ -28,7 +28,8 @@ tera = "0.10"
slug = "0.1" slug = "0.1"
syntect = { version = "1", features = ["static-onig"] } syntect = { version = "1", features = ["static-onig"] }
chrono = "0.3" chrono = "0.3"
toml = "0.4" # toml = "0.4"
toml = { git = "https://github.com/alexcrichton/toml-rs" }
term-painter = "0.2" term-painter = "0.2"
base64 = "0.5" base64 = "0.5"

View file

@ -111,8 +111,8 @@ impl FrontMatter {
impl Default for FrontMatter { impl Default for FrontMatter {
fn default() -> FrontMatter { fn default() -> FrontMatter {
FrontMatter { FrontMatter {
title: "default".to_string(), title: None,
description: " A default front matter".to_string(), description: None,
date: None, date: None,
slug: None, slug: None,
url: None, url: None,

View file

@ -32,7 +32,7 @@ mod filters;
pub use site::{Site, GUTENBERG_TERA}; pub use site::{Site, GUTENBERG_TERA};
pub use config::{Config, get_config}; 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 page::{Page, populate_previous_and_next_pages};
pub use section::{Section}; pub use section::{Section};
pub use utils::{create_file}; pub use utils::{create_file};

View file

@ -3,7 +3,7 @@ extern crate tera;
use std::path::Path; use std::path::Path;
use gutenberg::{FrontMatter, split_content}; use gutenberg::{FrontMatter, split_content, SortBy};
use tera::to_value; use tera::to_value;
@ -156,7 +156,7 @@ description = "hey there"
sort_by = "date""#; sort_by = "date""#;
let res = FrontMatter::parse(content).unwrap(); let res = FrontMatter::parse(content).unwrap();
assert!(res.sort_by.is_some()); assert!(res.sort_by.is_some());
assert!(res.sort_by.unwrap(), SortBy::Date); assert_eq!(res.sort_by.unwrap(), SortBy::Date);
} }
#[test] #[test]
@ -167,7 +167,7 @@ description = "hey there"
sort_by = "order""#; sort_by = "order""#;
let res = FrontMatter::parse(content).unwrap(); let res = FrontMatter::parse(content).unwrap();
assert!(res.sort_by.is_some()); assert!(res.sort_by.is_some());
assert!(res.sort_by.unwrap(), SortBy::Order); assert_eq!(res.sort_by.unwrap(), SortBy::Order);
} }
#[test] #[test]
@ -178,7 +178,7 @@ description = "hey there"
sort_by = "none""#; sort_by = "none""#;
let res = FrontMatter::parse(content).unwrap(); let res = FrontMatter::parse(content).unwrap();
assert!(res.sort_by.is_some()); assert!(res.sort_by.is_some());
assert!(res.sort_by.unwrap(), SortBy::None); assert_eq!(res.sort_by.unwrap(), SortBy::None);
} }
#[test] #[test]