diff --git a/CHANGELOG.md b/CHANGELOG.md index 031403e..c3b4c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Breaking - Change names of individual taxonomies to be plural (ie `tags/my-tag` instead of `tag/my-tag`) +- Front matter now uses TOML dates rather strings: remove quotes from your date value to fix it. +For example: `date = "2001-10-10"` becomes `date = 2001-10-10` ### Others - Add `get_taxonomy_url` to retrieve the permalink of a tag/category @@ -13,6 +15,7 @@ - Add `output-dir` to `build` and `serve` to generate the site in a folder other than `public` - Add Prolog syntax highlighting and update all current syntaxes - Live reloading now works on shortcode template changes +- `gutenberg serve` now reloads site on `config.toml` changes: you will need to F5 to see them though ## 0.2.2 (2017-11-01) diff --git a/Cargo.lock b/Cargo.lock index 4b6782f..fd92856 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,7 @@ name = "atty" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -28,7 +28,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -39,7 +39,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -138,7 +138,7 @@ dependencies = [ [[package]] name = "clap" -version = "2.29.0" +version = "2.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -191,7 +191,8 @@ dependencies = [ "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -206,7 +207,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "os_pipe 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "shared_child 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -229,7 +230,7 @@ name = "errors" version = "0.1.0" dependencies = [ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -239,7 +240,7 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -248,7 +249,7 @@ name = "flate2" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -267,7 +268,7 @@ dependencies = [ "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -278,7 +279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -286,7 +287,7 @@ name = "fsevent-sys" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -323,7 +324,7 @@ name = "gutenberg" version = "0.2.2" dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)", "content 0.1.0", "errors 0.1.0", "front_matter 0.1.0", @@ -390,7 +391,7 @@ name = "inotify" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -398,7 +399,7 @@ name = "iovec" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -458,7 +459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.35" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -492,7 +493,7 @@ name = "memchr" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -520,7 +521,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -529,7 +530,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", @@ -549,7 +550,7 @@ dependencies = [ "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", @@ -600,7 +601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -611,7 +612,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -621,7 +622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -636,7 +637,7 @@ dependencies = [ "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "inotify 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -679,7 +680,7 @@ name = "num_cpus" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -689,7 +690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "onig_sys 66.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -700,7 +701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "duct 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -724,7 +725,7 @@ dependencies = [ "front_matter 0.1.0", "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -828,7 +829,7 @@ version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -847,7 +848,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -897,7 +898,7 @@ dependencies = [ "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "syntect 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "templates 0.1.0", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -913,7 +914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "same-file" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -924,7 +925,7 @@ name = "sass-rs" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "sass-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -934,7 +935,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -994,7 +995,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1020,7 +1021,7 @@ dependencies = [ "taxonomies 0.1.0", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "templates 0.1.0", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", "walkdir 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1117,7 +1118,7 @@ dependencies = [ "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] @@ -1140,20 +1141,20 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "taxonomies 0.1.0", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", "utils 0.1.0", ] [[package]] name = "tera" -version = "0.11.0-beta.1" +version = "0.11.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (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 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pest 1.0.0-beta.17 (registry+https://github.com/rust-lang/crates.io-index)", "pest_derive 1.0.0-beta.17 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1185,7 +1186,7 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1212,7 +1213,7 @@ name = "time" version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1316,7 +1317,7 @@ version = "0.1.0" dependencies = [ "errors 0.1.0", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1339,7 +1340,7 @@ name = "walkdir" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "same-file 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1432,7 +1433,7 @@ dependencies = [ "checksum cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9" -"checksum clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "110d43e343eb29f4f51c1db31beb879d546db27998577e5715270a54bcf41d3f" +"checksum clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f4a2b3bb7ef3c672d7c13d15613211d5a6976b6892c598b0fcb5d40765f19c2" "checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" @@ -1463,7 +1464,7 @@ dependencies = [ "checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" "checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b" "checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" -"checksum libc 0.2.35 (registry+https://github.com/rust-lang/crates.io-index)" = "96264e9b293e95d25bfcbbf8a88ffd1aedc85b754eba8b7d78012f638ba220eb" +"checksum libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "1e5d97d6708edaa407429faa671b942dc0f2727222fb6b6539bf1db936e4b121" "checksum linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2aab0478615bb586559b0114d94dd8eca4fdbb73b443adcb0d00b61692b4bf" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" @@ -1511,7 +1512,7 @@ dependencies = [ "checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" -"checksum same-file 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3257af0472da4b8b8902102a57bafffd9991f0f43772a8af6153d597e6e4ae2" +"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" "checksum sass-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90f8cf6e645aa843ffffcbdc1e8752b1f221dfa314c81895aeb229a77aea7e05" "checksum sass-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8bc8cb11c6906ced0e62751f93fa1f30216612a182d4e9a7d8ace302834b1742" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" @@ -1533,7 +1534,7 @@ dependencies = [ "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum syntect 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db9fffcb25a761118df53811bd1cfcd54cf57fcbc51e1ea3167ae263477129ad" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" -"checksum tera 0.11.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be9012fd155ae1d0bebc4eb58db8847b516be042b2b779821768def1560a037e" +"checksum tera 0.11.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e4035bf251d9ba49ec5e2ae68f862be60b221c0fcead5d21df6fd72bdc90b81f" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum term-painter 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dcaa948f0e3e38470cd8dc8dcfe561a75c9e43f28075bb183845be2b9b3c08cf" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" diff --git a/components/content/Cargo.toml b/components/content/Cargo.toml index 6d83bcd..5c4656c 100644 --- a/components/content/Cargo.toml +++ b/components/content/Cargo.toml @@ -17,3 +17,4 @@ front_matter = { path = "../front_matter" } [dev-dependencies] tempdir = "0.3" +toml = "0.4" diff --git a/components/content/src/lib.rs b/components/content/src/lib.rs index 9197066..3552fbc 100644 --- a/components/content/src/lib.rs +++ b/components/content/src/lib.rs @@ -11,6 +11,8 @@ extern crate utils; #[cfg(test)] extern crate tempdir; +#[cfg(test)] +extern crate toml; mod file_info; mod page; diff --git a/components/content/src/page.rs b/components/content/src/page.rs index aa385c1..41ad47f 100644 --- a/components/content/src/page.rs +++ b/components/content/src/page.rs @@ -103,7 +103,6 @@ impl Page { if let Some(ref p) = page.meta.path { page.path = p.trim().trim_left_matches('/').to_string(); - } else { page.path = if page.file.components.is_empty() { page.slug.clone() @@ -207,7 +206,12 @@ impl ser::Serialize for Page { state.serialize_field("content", &self.content)?; state.serialize_field("title", &self.meta.title)?; state.serialize_field("description", &self.meta.description)?; - state.serialize_field("date", &self.meta.date)?; + // From a TOML datetime to a String first + let date = match self.meta.date { + Some(ref d) => Some(d.to_string()), + None => None, + }; + state.serialize_field("date", &date)?; state.serialize_field("slug", &self.slug)?; state.serialize_field("path", &self.path)?; state.serialize_field("components", &self.components)?; diff --git a/components/content/src/sorting.rs b/components/content/src/sorting.rs index 6bb8870..eec1204 100644 --- a/components/content/src/sorting.rs +++ b/components/content/src/sorting.rs @@ -98,13 +98,16 @@ pub fn populate_previous_and_next_pages(input: &[Page]) -> Vec { #[cfg(test)] mod tests { + use std::str::FromStr; + use toml::value::Datetime; + use front_matter::{PageFrontMatter, SortBy}; use page::Page; use super::{sort_pages, populate_previous_and_next_pages}; fn create_page_with_date(date: &str) -> Page { let mut front_matter = PageFrontMatter::default(); - front_matter.date = Some(date.to_string()); + front_matter.date = Some(Datetime::from_str(date).unwrap()); Page::new("content/hello.md", front_matter) } @@ -136,9 +139,9 @@ mod tests { ]; let (pages, _) = sort_pages(input, SortBy::Date); // Should be sorted by date - assert_eq!(pages[0].clone().meta.date.unwrap(), "2019-01-01"); - assert_eq!(pages[1].clone().meta.date.unwrap(), "2018-01-01"); - assert_eq!(pages[2].clone().meta.date.unwrap(), "2017-01-01"); + assert_eq!(pages[0].clone().meta.date.unwrap().to_string(), "2019-01-01"); + assert_eq!(pages[1].clone().meta.date.unwrap().to_string(), "2018-01-01"); + assert_eq!(pages[2].clone().meta.date.unwrap().to_string(), "2017-01-01"); } #[test] diff --git a/components/front_matter/src/lib.rs b/components/front_matter/src/lib.rs index 4340e5d..6cf79f0 100644 --- a/components/front_matter/src/lib.rs +++ b/components/front_matter/src/lib.rs @@ -92,7 +92,7 @@ mod tests { +++ title = "Title" description = "hey there" -date = "2002/10/12" +date = 2002-10-12 +++ Hello "#; @@ -120,7 +120,7 @@ Hello +++ title = "Title" description = "hey there" -date = "2002/10/12" +date = 2002-10-12 +++"#; let (front_matter, content) = split_page_content(Path::new(""), content).unwrap(); assert_eq!(content, ""); @@ -133,7 +133,7 @@ date = "2002/10/12" +++ title = "Title" description = "hey there" -date = "2002-10-02T15:00:00Z" +date = 2002-10-02T15:00:00Z +++ +++"#; let (front_matter, content) = split_page_content(Path::new(""), content).unwrap(); @@ -147,7 +147,7 @@ date = "2002-10-02T15:00:00Z" +++ title = "Title" description = "hey there" -date = "2002/10/12""#; +date = 2002-10-12"#; let res = split_page_content(Path::new(""), content); assert!(res.is_err()); } diff --git a/components/front_matter/src/page.rs b/components/front_matter/src/page.rs index 6f20b58..f768f59 100644 --- a/components/front_matter/src/page.rs +++ b/components/front_matter/src/page.rs @@ -6,6 +6,7 @@ use toml; use errors::Result; + /// The front matter of every page #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct PageFrontMatter { @@ -14,7 +15,7 @@ pub struct PageFrontMatter { /// Description in that appears when linked, e.g. on twitter pub description: Option, /// Date if we want to order pages (ie blog post) - pub date: Option, + pub date: Option, /// Whether this page is a draft and should be ignored for pagination etc pub draft: Option, /// The page slug. Will be used instead of the filename if present @@ -71,17 +72,17 @@ impl PageFrontMatter { Ok(f) } - /// Converts the date in the front matter, which can be in 2 formats, into a NaiveDateTime + /// Converts the TOML datetime to a Chrono naive datetime pub fn date(&self) -> Option { - match self.date { - Some(ref d) => { - if d.contains('T') { - DateTime::parse_from_rfc3339(d).ok().and_then(|s| Some(s.naive_local())) - } else { - NaiveDate::parse_from_str(d, "%Y-%m-%d").ok().and_then(|s| Some(s.and_hms(0,0,0))) - } - }, - None => None, + if let Some(ref d) = self.date { + let d2 = d.to_string(); + if d2.contains('T') { + DateTime::parse_from_rfc3339(&d2).ok().and_then(|s| Some(s.naive_local())) + } else { + NaiveDate::parse_from_str(&d2, "%Y-%m-%d").ok().and_then(|s| Some(s.and_hms(0, 0, 0))) + } + } else { + None } } @@ -121,6 +122,7 @@ impl Default for PageFrontMatter { } } + #[cfg(test)] mod tests { use super::PageFrontMatter; @@ -203,9 +205,10 @@ mod tests { let content = r#" title = "Hello" description = "hey there" - date = "2016-10-10""#; + date = 2016-10-10 + "#; let res = PageFrontMatter::parse(content).unwrap(); - assert!(res.date().is_some()); + assert!(res.date.is_some()); } #[test] @@ -213,9 +216,10 @@ mod tests { let content = r#" title = "Hello" description = "hey there" - date = "2002-10-02T15:00:00Z""#; + date = 2002-10-02T15:00:00Z + "#; let res = PageFrontMatter::parse(content).unwrap(); - assert!(res.date().is_some()); + assert!(res.date.is_some()); } #[test] @@ -223,9 +227,18 @@ mod tests { let content = r#" title = "Hello" description = "hey there" - date = "2002/10/12""#; - let res = PageFrontMatter::parse(content).unwrap(); - assert!(res.date().is_none()); + date = 2002/10/12"#; + let res = PageFrontMatter::parse(content); + assert!(res.is_err()); } + #[test] + fn cannot_parse_invalid_date_format() { + let content = r#" + title = "Hello" + description = "hey there" + date = 2002-14-01"#; + let res = PageFrontMatter::parse(content); + assert!(res.is_err()); + } } diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 423d68a..3eb011c 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -636,7 +636,13 @@ impl Site { &self.pages .values() .filter(|p| !p.is_draft()) - .map(|p| SitemapEntry::new(p.permalink.clone(), p.meta.date.clone())) + .map(|p| { + let date = match p.meta.date { + Some(ref d) => Some(d.to_string()), + None => None, + }; + SitemapEntry::new(p.permalink.clone(), date) + }) .collect::>() ); context.add( @@ -694,9 +700,10 @@ impl Site { } let (sorted_pages, _) = sort_pages(pages, SortBy::Date); - context.add("last_build_date", &sorted_pages[0].meta.date); + context.add("last_build_date", &sorted_pages[0].meta.date.clone().map(|d| d.to_string())); // limit to the last n elements) context.add("pages", &sorted_pages.iter().take(self.config.rss_limit.unwrap()).collect::>()); + println!("{:?}", context.as_json()); context.add("config", &self.config); let rss_feed_url = if self.config.base_url.ends_with('/') { diff --git a/components/site/test_site/content/posts/draft.md b/components/site/test_site/content/posts/draft.md index ba61214..c66b835 100644 --- a/components/site/test_site/content/posts/draft.md +++ b/components/site/test_site/content/posts/draft.md @@ -1,6 +1,6 @@ +++ title = "A draft" draft = true -date = "2016-03-01" +date = 2016-03-01 +++ diff --git a/components/site/test_site/content/posts/fixed-slug.md b/components/site/test_site/content/posts/fixed-slug.md index ccba64a..ca932bd 100644 --- a/components/site/test_site/content/posts/fixed-slug.md +++ b/components/site/test_site/content/posts/fixed-slug.md @@ -2,7 +2,7 @@ title = "Fixed slug" description = "" slug = "something-else" -date = "2017-01-01" +date = 2017-01-01 aliases = ["/an-old-url/old-page"] +++ diff --git a/components/site/test_site/content/posts/fixed-url.md b/components/site/test_site/content/posts/fixed-url.md index 0718d52..075e2c7 100644 --- a/components/site/test_site/content/posts/fixed-url.md +++ b/components/site/test_site/content/posts/fixed-url.md @@ -2,7 +2,7 @@ title = "Fixed URL" description = "" path = "a-fixed-url" -date = "2017-02-01" +date = 2017-02-01 +++ A simple page with fixed url diff --git a/components/site/test_site/content/posts/python.md b/components/site/test_site/content/posts/python.md index e8d0a24..aa39b4e 100644 --- a/components/site/test_site/content/posts/python.md +++ b/components/site/test_site/content/posts/python.md @@ -1,7 +1,7 @@ +++ title = "Python in posts" description = "" -date = "2017-03-01" +date = 2017-03-01 +++ Same filename but different path diff --git a/components/site/test_site/content/posts/simple.md b/components/site/test_site/content/posts/simple.md index 48fe505..3593cec 100644 --- a/components/site/test_site/content/posts/simple.md +++ b/components/site/test_site/content/posts/simple.md @@ -1,7 +1,7 @@ +++ title = "Simple article with shortcodes" description = "" -date = "2017-04-01" +date = 2017-04-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/devops/docker.md b/components/site/test_site/content/posts/tutorials/devops/docker.md index 4135b4a..ad19af5 100644 --- a/components/site/test_site/content/posts/tutorials/devops/docker.md +++ b/components/site/test_site/content/posts/tutorials/devops/docker.md @@ -1,7 +1,7 @@ +++ title = "Docker" order = 1 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/devops/nix.md b/components/site/test_site/content/posts/tutorials/devops/nix.md index 4facb79..004ad58 100644 --- a/components/site/test_site/content/posts/tutorials/devops/nix.md +++ b/components/site/test_site/content/posts/tutorials/devops/nix.md @@ -1,7 +1,7 @@ +++ title = "Nix" order = 2 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/programming/python.md b/components/site/test_site/content/posts/tutorials/programming/python.md index 149042c..d65d52f 100644 --- a/components/site/test_site/content/posts/tutorials/programming/python.md +++ b/components/site/test_site/content/posts/tutorials/programming/python.md @@ -1,7 +1,7 @@ +++ title = "Python tutorial" order = 1 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page diff --git a/components/site/test_site/content/posts/tutorials/programming/rust.md b/components/site/test_site/content/posts/tutorials/programming/rust.md index b242136..3582c4b 100644 --- a/components/site/test_site/content/posts/tutorials/programming/rust.md +++ b/components/site/test_site/content/posts/tutorials/programming/rust.md @@ -1,7 +1,7 @@ +++ title = "Rust" order = 2 -date = "2017-01-01" +date = 2017-01-01 +++ A simple page