Browse Source

Update tera to v1 alpha

index-subcmd
Vincent Prouillet 5 years ago
parent
commit
1e2dd9ce03
21 changed files with 432 additions and 338 deletions
  1. +127
    -105
      Cargo.lock
  2. +1
    -1
      components/errors/Cargo.toml
  3. +1
    -1
      components/front_matter/Cargo.toml
  4. +1
    -1
      components/imageproc/Cargo.toml
  5. +1
    -1
      components/library/Cargo.toml
  6. +1
    -1
      components/library/src/content/page.rs
  7. +1
    -1
      components/library/src/content/section.rs
  8. +1
    -1
      components/library/src/pagination/mod.rs
  9. +2
    -2
      components/library/src/taxonomies/mod.rs
  10. +1
    -1
      components/rendering/Cargo.toml
  11. +4
    -2
      components/rendering/src/markdown.rs
  12. +1
    -1
      components/rendering/src/shortcode.rs
  13. +1
    -1
      components/site/Cargo.toml
  14. +12
    -12
      components/site/src/lib.rs
  15. +1
    -1
      components/templates/Cargo.toml
  16. +10
    -10
      components/templates/src/filters.rs
  17. +43
    -34
      components/templates/src/global_fns/load_data.rs
  18. +219
    -158
      components/templates/src/global_fns/mod.rs
  19. +1
    -1
      components/templates/src/lib.rs
  20. +1
    -1
      components/utils/Cargo.toml
  21. +2
    -2
      components/utils/src/templates.rs

+ 127
- 105
Cargo.lock View File

@@ -3,7 +3,7 @@ name = "MacTypes-sys"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -18,7 +18,7 @@ dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -76,7 +76,7 @@ dependencies = [
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"h2 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -176,7 +176,7 @@ name = "atty"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (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.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -194,7 +194,7 @@ dependencies = [
"autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -205,7 +205,7 @@ version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -355,7 +355,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -363,7 +363,7 @@ name = "core-foundation-sys"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -600,21 +600,13 @@ dependencies = [
"backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "error-chain"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "errors"
version = "0.1.0"
dependencies = [
"image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syntect 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -649,7 +641,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -659,9 +651,9 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -692,7 +684,7 @@ dependencies = [
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0",
]
@@ -709,7 +701,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.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -717,7 +709,7 @@ name = "fsevent-sys"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -799,6 +791,15 @@ dependencies = [
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "globwalk"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "h2"
version = "0.1.15"
@@ -808,7 +809,7 @@ dependencies = [
"bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -829,7 +830,7 @@ name = "hostname"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -848,7 +849,7 @@ dependencies = [

[[package]]
name = "http"
version = "0.1.14"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -883,7 +884,7 @@ dependencies = [
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"h2 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -919,7 +920,24 @@ 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.7 (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 = "ignore"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -949,7 +967,7 @@ dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0",
]

@@ -974,7 +992,7 @@ dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -985,7 +1003,7 @@ name = "inotify-sys"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -993,7 +1011,7 @@ name = "iovec"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1049,7 +1067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "libc"
version = "0.2.47"
version = "0.2.48"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
@@ -1080,7 +1098,7 @@ dependencies = [
"slotmap 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0",
]
@@ -1169,7 +1187,7 @@ version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -1202,12 +1220,12 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "miniz_oxide"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1215,13 +1233,13 @@ dependencies = [

[[package]]
name = "miniz_oxide_c_api"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -1234,7 +1252,7 @@ dependencies = [
"iovec 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)",
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (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.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1259,7 +1277,7 @@ version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1280,7 +1298,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1297,7 +1315,7 @@ version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1317,7 +1335,7 @@ dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1336,7 +1354,7 @@ dependencies = [

[[package]]
name = "notify"
version = "4.0.6"
version = "4.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1345,7 +1363,7 @@ dependencies = [
"fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"inotify 0.6.1 (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.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1399,7 +1417,7 @@ name = "num_cpus"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -1409,7 +1427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1431,7 +1449,7 @@ dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1446,7 +1464,7 @@ version = "0.9.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1473,7 +1491,7 @@ name = "parking_lot_core"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1628,7 +1646,7 @@ version = "0.4.5"
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.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1641,7 +1659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1652,7 +1670,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1708,7 +1726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1748,7 +1766,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1831,7 +1849,7 @@ dependencies = [
"slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"syntect 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"templates 0.1.0",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0",
]

@@ -1844,7 +1862,7 @@ dependencies = [
"bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding_rs 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.21 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-tls 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1923,7 +1941,7 @@ name = "sass-rs"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"sass-sys 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1933,7 +1951,7 @@ version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1974,7 +1992,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -1985,7 +2003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"MacTypes-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -2060,7 +2078,7 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -2085,7 +2103,7 @@ dependencies = [
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"templates 0.1.0",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0",
]

@@ -2121,7 +2139,7 @@ version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2236,7 +2254,7 @@ version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
"remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2257,7 +2275,7 @@ dependencies = [
"pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"utils 0.1.0",
@@ -2275,12 +2293,11 @@ dependencies = [

[[package]]
name = "tera"
version = "0.11.20"
version = "1.0.0-alpha.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"globwalk 0.6.0 (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.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2289,8 +2306,9 @@ dependencies = [
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.36 (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)",
"unic-segment 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -2306,7 +2324,7 @@ name = "termion"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2343,7 +2361,7 @@ name = "time"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2441,7 +2459,7 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2512,7 +2530,7 @@ dependencies = [
"bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2623,46 +2641,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "unic-char-property"
version = "0.7.0"
version = "0.8.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)",
"unic-char-range 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unic-char-range"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "unic-common"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "unic-segment"
version = "0.7.0"
version = "0.8.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)",
"unic-ucd-segment 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unic-ucd-segment"
version = "0.7.0"
version = "0.8.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)",
"unic-char-property 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unic-char-range 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unic-ucd-version 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unic-ucd-version"
version = "0.7.0"
version = "0.8.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)",
"unic-common 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -2691,8 +2709,11 @@ dependencies = [

[[package]]
name = "unicode-normalization"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unicode-segmentation"
@@ -2745,7 +2766,7 @@ dependencies = [
"errors 0.1.0",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)",
"tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2950,7 +2971,7 @@ dependencies = [
"errors 0.1.0",
"front_matter 0.1.0",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"notify 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"rebuild 0.1.0",
"site 0.1.0",
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3022,7 +3043,6 @@ dependencies = [
"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
"checksum encoding_rs 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)" = "a69d152eaa438a291636c1971b0a370212165ca8a75759eb66818c5ce9b538f7"
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
@@ -3045,17 +3065,19 @@ dependencies = [
"checksum gif 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4bca55ac1f213920ce3527ccd62386f1f15fa3f1714aeee1cf93f2c416903f"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4743617a7464bbda3c8aec8558ff2f9429047e025771037df561d383337ff865"
"checksum globwalk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4be0267260c9bb4e278dfb2291de9518a595cb625cf6f5f385c4b7d8d1aa7112"
"checksum h2 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "30e0b8e55b4d7ffedade2b9605851f8e85f5010663e7ad170ef3c0f0681bc43f"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e"
"checksum html5ever 0.22.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c213fa6a618dc1da552f54f85cba74b05d8e883c92ec4e89067736938084c26e"
"checksum http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "02096a6d2c55e63f7fcb800690e4f889a25f6ec342e3adb4594e293b625215ab"
"checksum http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "1a10e5b573b9a0146545010f50772b9e8b1dd0a256564cc4307694c68832a2f5"
"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83"
"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
"checksum hyper 0.12.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6d6b1a3d01ac8035b8d2d94e0e5254eab82746f09046baed763751b00253232b"
"checksum hyper-tls 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "32cd73f14ad370d3b4d4b7dce08f69b81536c82e39fcc89731930fe5788cd661"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum ignore 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ad03ca67dc12474ecd91fdb94d758cbd20cb4e7a78ebe831df26a9b7511e1162"
"checksum image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "52fb0666a1273dac46f9725aa4859bcd5595fc3554cf3495051b4de8db745e7d"
"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
"checksum inflate 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "84c683bde2d8413b8f1be3e459c30e4817672b6e7a31d9212b0323154e76eba7"
@@ -3069,7 +3091,7 @@ dependencies = [
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476"
"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047"
"checksum libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "bff3ac7d6f23730d3b533c35ed75eef638167634476a499feef16c428d74b57b"
"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939"
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
@@ -3086,8 +3108,8 @@ dependencies = [
"checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
"checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed"
"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c"
"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e"
"checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e"
"checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab"
"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432"
"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40"
"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
@@ -3098,7 +3120,7 @@ dependencies = [
"checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a"
"checksum notify 4.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "873ecfd8c174964ae30f401329d140142312c8e5590719cf1199d5f1717d8078"
"checksum notify 4.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c968cf37cf949114b00d51b0b23536d1c3a4a3963767cf4c969c65a6af78dc7d"
"checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d"
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"
"checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124"
@@ -3193,7 +3215,7 @@ dependencies = [
"checksum syntect 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e02dd9df97a68a2d005ace28ff24c610abfc3ce17afcfdb22a077645dabb599a"
"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2"
"checksum tendril 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "707feda9f2582d5d680d733e38755547a3e8fb471e7ba11452ecfd9ce93a5d3b"
"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
"checksum tera 1.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5847f6a7882d3068732f542fd9144314233f3e9eed3e1223518994e951683d"
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
@@ -3222,16 +3244,16 @@ dependencies = [
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
"checksum ucd-trie 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "71a9c5b1fe77426cf144cc30e49e955270f5086e31a6441dfa8b32efc09b9d77"
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
"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 unic-char-property 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70aaa0e0c676362a3a4945c9f69b095201b11fbe967c7fc0e414b9c8dba89b20"
"checksum unic-char-range 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7232ba52475caa78979e29fcfd596f502e035bca9f8b42ae0061b24f7960c282"
"checksum unic-common 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "927243420dad0c87b8aa487c84d28dc2d66088d5383c1c3f1c352043a4b33b2a"
"checksum unic-segment 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bf6ab996840832e606c29f54e9b37c2ceb03c24af640b6022b09fdeb0067f7f"
"checksum unic-ucd-segment 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54959cc93f681cae3d977532c42181a5f363cb95625bfcc71854486e8a5640ff"
"checksum unic-ucd-version 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6bfaa7ddcc6772ec63932876639daf4b1eeff7683e15c7f9247724d4a6c910"
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
"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"


+ 1
- 1
components/errors/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "0.11"
tera = "1.0.0-alpha.3"
toml = "0.4"
image = "0.21"
syntect = "3"

+ 1
- 1
components/front_matter/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "0.11"
tera = "1.0.0-alpha.3"
chrono = "0.4"
serde = "1"
serde_derive = "1"


+ 1
- 1
components/imageproc/Cargo.toml View File

@@ -6,7 +6,7 @@ authors = ["Vojtěch Král <vojtech@kral.hk>"]
[dependencies]
lazy_static = "1"
regex = "1.0"
tera = "0.11"
tera = "1.0.0-alpha.3"
image = "0.21"
rayon = "1"



+ 1
- 1
components/library/Cargo.toml View File

@@ -7,7 +7,7 @@ authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
slotmap = "0.2"
rayon = "1"
chrono = { version = "0.4", features = ["serde"] }
tera = "0.11"
tera = "1.0.0-alpha.3"
serde = "1"
serde_derive = "1"
slug = "0.1"


+ 1
- 1
components/library/src/content/page.rs View File

@@ -257,7 +257,7 @@ impl Page {
context.insert("page", &self.to_serialized(library));
context.insert("lang", &self.lang);

render_template(&tpl_name, tera, &context, &config.theme)
render_template(&tpl_name, tera, context, &config.theme)
.map_err(|e| Error::chain(format!("Failed to render page '{}'", self.file.path.display()), e))
}



+ 1
- 1
components/library/src/content/section.rs View File

@@ -189,7 +189,7 @@ impl Section {
context.insert("section", &self.to_serialized(library));
context.insert("lang", &self.lang);

render_template(tpl_name, tera, &context, &config.theme)
render_template(tpl_name, tera, context, &config.theme)
.map_err(|e| Error::chain(format!("Failed to render section '{}'", self.file.path.display()), e))
}



+ 1
- 1
components/library/src/pagination/mod.rs View File

@@ -221,7 +221,7 @@ impl<'a> Paginator<'a> {
context.insert("current_path", &pager.path);
context.insert("paginator", &self.build_paginator_context(pager));

render_template(&self.template, tera, &context, &config.theme)
render_template(&self.template, tera, context, &config.theme)
.map_err(|e| Error::chain(format!("Failed to render pager {}", pager.index), e))
}
}


+ 2
- 2
components/library/src/taxonomies/mod.rs View File

@@ -144,7 +144,7 @@ impl Taxonomy {
);
context.insert("current_path", &format!("/{}/{}", self.kind.name, item.slug));

render_template(&format!("{}/single.html", self.kind.name), tera, &context, &config.theme)
render_template(&format!("{}/single.html", self.kind.name), tera, context, &config.theme)
.map_err(|e| Error::chain(format!("Failed to render single term {} page.", self.kind.name), e))
}

@@ -163,7 +163,7 @@ impl Taxonomy {
context.insert("current_url", &config.make_permalink(&self.kind.name));
context.insert("current_path", &self.kind.name);

render_template(&format!("{}/list.html", self.kind.name), tera, &context, &config.theme)
render_template(&format!("{}/list.html", self.kind.name), tera, context, &config.theme)
.map_err(|e| Error::chain(format!("Failed to render a list of {} page.", self.kind.name), e))
}



+ 1
- 1
components/rendering/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = { version = "0.11", features = ["preserve_order"] }
tera = { version = "1.0.0-alpha.3", features = ["preserve_order"] }
syntect = "3"
pulldown-cmark = "0.2"
slug = "0.1"


+ 4
- 2
components/rendering/src/markdown.rs View File

@@ -9,7 +9,7 @@ use syntect::html::{

use config::highlighting::{get_highlighter, SYNTAX_SET, THEME_SET};
use context::RenderContext;
use errors::Result;
use errors::{Error, Result};
use front_matter::InsertAnchor;
use link_checker::check_url;
use table_of_contents::{Header, make_table_of_contents, TempHeader};
@@ -245,7 +245,9 @@ pub fn markdown_to_html(content: &str, context: &RenderContext) -> Result<Render
};
let mut c = tera::Context::new();
c.insert("id", &id);
let anchor_link = context.tera.render(ANCHOR_LINK_TEMPLATE, &c).unwrap();

let anchor_link = utils::templates::render_template(&ANCHOR_LINK_TEMPLATE, context.tera, c, &None)
.map_err(|e| Error::chain("Failed to render anchor link template", e))?;
anchors_to_insert.push((anchor_idx, Event::Html(Owned(anchor_link))));
}



+ 1
- 1
components/rendering/src/shortcode.rs View File

@@ -115,7 +115,7 @@ fn render_shortcode(
let template_name = format!("shortcodes/{}.html", name);

let res =
utils::templates::render_template(&template_name, &context.tera, &tera_context, &None)
utils::templates::render_template(&template_name, &context.tera, tera_context, &None)
.map_err(|e| Error::chain(format!("Failed to render {} shortcode", name), e))?;

// Small hack to avoid having multiple blank lines because of Tera tags for example


+ 1
- 1
components/site/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "0.11"
tera = "1.0.0-alpha.3"
glob = "0.2"
rayon = "1"
serde = "1"


+ 12
- 12
components/site/src/lib.rs View File

@@ -329,29 +329,29 @@ impl Site {
pub fn register_early_global_fns(&mut self) {
self.tera.register_function(
"get_url",
global_fns::make_get_url(self.permalinks.clone(), self.config.clone()),
global_fns::GetUrl::new(self.config.clone(), self.permalinks.clone()),
);
self.tera.register_function(
"resize_image",
global_fns::make_resize_image(self.imageproc.clone()),
global_fns::ResizeImage::new(self.imageproc.clone()),
);
self.tera.register_function(
"load_data",
global_fns::make_load_data(self.content_path.clone(), self.base_path.clone()),
global_fns::LoadData::new(self.content_path.clone(), self.base_path.clone()),
);
self.tera.register_function("trans", global_fns::make_trans(self.config.clone()));
self.tera.register_function("trans", global_fns::Trans::new(self.config.clone()));
self.tera.register_function(
"get_taxonomy_url",
global_fns::make_get_taxonomy_url(&self.taxonomies),
global_fns::GetTaxonomyUrl::new(&self.taxonomies),
);
}

pub fn register_tera_global_fns(&mut self) {
self.tera.register_function("get_page", global_fns::make_get_page(&self.library));
self.tera.register_function("get_section", global_fns::make_get_section(&self.library));
self.tera.register_function("get_page", global_fns::GetPage::new(&self.library));
self.tera.register_function("get_section", global_fns::GetSection::new(&self.library));
self.tera.register_function(
"get_taxonomy",
global_fns::make_get_taxonomy(&self.taxonomies, &self.library),
global_fns::GetTaxonomy::new(&self.taxonomies, &self.library),
);
}

@@ -693,7 +693,7 @@ impl Site {
ensure_directory_exists(&self.output_path)?;
let mut context = Context::new();
context.insert("config", &self.config);
let output = render_template("404.html", &self.tera, &context, &self.config.theme)?;
let output = render_template("404.html", &self.tera, context, &self.config.theme)?;
create_file(&self.output_path.join("404.html"), &self.inject_livereload(output))
}

@@ -704,7 +704,7 @@ impl Site {
context.insert("config", &self.config);
create_file(
&self.output_path.join("robots.txt"),
&render_template("robots.txt", &self.tera, &context, &self.config.theme)?,
&render_template("robots.txt", &self.tera, context, &self.config.theme)?,
)
}

@@ -841,7 +841,7 @@ impl Site {
context.insert("taxonomies", &taxonomies);
context.insert("config", &self.config);

let sitemap = &render_template("sitemap.xml", &self.tera, &context, &self.config.theme)?;
let sitemap = &render_template("sitemap.xml", &self.tera, context, &self.config.theme)?;

create_file(&self.output_path.join("sitemap.xml"), sitemap)?;

@@ -891,7 +891,7 @@ impl Site {

context.insert("feed_url", &rss_feed_url);

let feed = &render_template("rss.xml", &self.tera, &context, &self.config.theme)?;
let feed = &render_template("rss.xml", &self.tera, context, &self.config.theme)?;

if let Some(ref base) = base_path {
let mut output_path = self.output_path.clone();


+ 1
- 1
components/templates/Cargo.toml View File

@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
tera = "0.11"
tera = "1.0.0-alpha.3"
base64 = "0.10"
lazy_static = "1"
pulldown-cmark = "0.2"


+ 10
- 10
components/templates/src/filters.rs View File

@@ -4,7 +4,7 @@ use base64::{decode, encode};
use pulldown_cmark as cmark;
use tera::{to_value, Result as TeraResult, Value};

pub fn markdown(value: Value, args: HashMap<String, Value>) -> TeraResult<Value> {
pub fn markdown(value: &Value, args: &HashMap<String, Value>) -> TeraResult<Value> {
let s = try_get_value!("markdown", "value", String, value);
let inline = match args.get("inline") {
Some(val) => try_get_value!("markdown", "inline", bool, val),
@@ -30,12 +30,12 @@ pub fn markdown(value: Value, args: HashMap<String, Value>) -> TeraResult<Value>
Ok(to_value(&html).unwrap())
}

pub fn base64_encode(value: Value, _: HashMap<String, Value>) -> TeraResult<Value> {
pub fn base64_encode(value: &Value, _: &HashMap<String, Value>) -> TeraResult<Value> {
let s = try_get_value!("base64_encode", "value", String, value);
Ok(to_value(&encode(s.as_bytes())).unwrap())
}

pub fn base64_decode(value: Value, _: HashMap<String, Value>) -> TeraResult<Value> {
pub fn base64_decode(value: &Value, _: &HashMap<String, Value>) -> TeraResult<Value> {
let s = try_get_value!("base64_decode", "value", String, value);
Ok(to_value(&String::from_utf8(decode(s.as_bytes()).unwrap()).unwrap()).unwrap())
}
@@ -50,7 +50,7 @@ mod tests {

#[test]
fn markdown_filter() {
let result = markdown(to_value(&"# Hey").unwrap(), HashMap::new());
let result = markdown(&to_value(&"# Hey").unwrap(), &HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(&"<h1>Hey</h1>\n").unwrap());
}
@@ -60,8 +60,8 @@ mod tests {
let mut args = HashMap::new();
args.insert("inline".to_string(), to_value(true).unwrap());
let result = markdown(
to_value(&"Using `map`, `filter`, and `fold` instead of `for`").unwrap(),
args,
&to_value(&"Using `map`, `filter`, and `fold` instead of `for`").unwrap(),
&args,
);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(&"Using <code>map</code>, <code>filter</code>, and <code>fold</code> instead of <code>for</code>").unwrap());
@@ -73,7 +73,7 @@ mod tests {
let mut args = HashMap::new();
args.insert("inline".to_string(), to_value(true).unwrap());
let result = markdown(
to_value(
&to_value(
&r#"
|id|author_id| timestamp_created|title |content |
|-:|--------:|-----------------------:|:---------------------|:-----------------|
@@ -82,7 +82,7 @@ mod tests {
"#,
)
.unwrap(),
args,
&args,
);
assert!(result.is_ok());
assert!(result.unwrap().as_str().unwrap().contains("<table>"));
@@ -102,7 +102,7 @@ mod tests {
];
for (input, expected) in tests {
let args = HashMap::new();
let result = base64_encode(to_value(input).unwrap(), args);
let result = base64_encode(&to_value(input).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}
@@ -121,7 +121,7 @@ mod tests {
];
for (input, expected) in tests {
let args = HashMap::new();
let result = base64_decode(to_value(input).unwrap(), args);
let result = base64_decode(&to_value(input).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}


+ 43
- 34
components/templates/src/global_fns/load_data.rs View File

@@ -16,7 +16,7 @@ use std::sync::{Arc, Mutex};

use csv::Reader;
use std::collections::HashMap;
use tera::{from_value, to_value, Error, GlobalFn, Map, Result, Value};
use tera::{from_value, to_value, Error, Function as TeraFn, Map, Result, Value};

static GET_DATA_ARGUMENT_ERROR_MESSAGE: &str =
"`load_data`: requires EITHER a `path` or `url` argument";
@@ -170,28 +170,37 @@ fn get_output_format_from_args(
OutputFormat::from_str(from_extension)
}

/// A global function to load data from a file or from a URL
/// A Tera function to load data from a file or from a URL
/// Currently the supported formats are json, toml, csv and plain text
pub fn make_load_data(content_path: PathBuf, base_path: PathBuf) -> GlobalFn {
let mut headers = header::HeaderMap::new();
headers.insert(header::USER_AGENT, "zola".parse().unwrap());
let client = Arc::new(Mutex::new(Client::builder().build().expect("reqwest client build")));
let result_cache: Arc<Mutex<HashMap<u64, Value>>> = Arc::new(Mutex::new(HashMap::new()));
Box::new(move |args| -> Result<Value> {
let data_source = get_data_source_from_args(&content_path, &args)?;
#[derive(Debug)]
pub struct LoadData {
content_path: PathBuf,
base_path: PathBuf,
client: Arc<Mutex<Client>>,
result_cache: Arc<Mutex<HashMap<u64, Value>>>,
}
impl LoadData {
pub fn new(content_path: PathBuf, base_path: PathBuf) -> Self {
let client = Arc::new(Mutex::new(Client::builder().build().expect("reqwest client build")));
let result_cache = Arc::new(Mutex::new(HashMap::new()));
Self {content_path, base_path, client, result_cache}
}
}

impl TeraFn for LoadData {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let data_source = get_data_source_from_args(&self.content_path, &args)?;
let file_format = get_output_format_from_args(&args, &data_source)?;

let cache_key = data_source.get_cache_key(&file_format);

let mut cache = result_cache.lock().expect("result cache lock");
let response_client = client.lock().expect("response client lock");
let mut cache = self.result_cache.lock().expect("result cache lock");
let response_client = self.client.lock().expect("response client lock");
if let Some(cached_result) = cache.get(&cache_key) {
return Ok(cached_result.clone());
}

let data = match data_source {
DataSource::Path(path) => read_data_file(&base_path, path),
DataSource::Path(path) => read_data_file(&self.base_path, path),
DataSource::Url(url) => {
let mut response = response_client
.get(url.as_str())
@@ -223,7 +232,7 @@ pub fn make_load_data(content_path: PathBuf, base_path: PathBuf) -> GlobalFn {
}

result_value
})
}
}

/// Parse a JSON string and convert it to a Tera Value
@@ -301,12 +310,12 @@ fn load_csv(csv_data: String) -> Result<Value> {

#[cfg(test)]
mod tests {
use super::{make_load_data, DataSource, OutputFormat};
use super::{LoadData, DataSource, OutputFormat};

use std::collections::HashMap;
use std::path::PathBuf;

use tera::to_value;
use tera::{to_value, Function};

fn get_test_file(filename: &str) -> PathBuf {
let test_files = PathBuf::from("../utils/test-files").canonicalize().unwrap();
@@ -316,26 +325,26 @@ mod tests {
#[test]
fn fails_when_missing_file() {
let static_fn =
make_load_data(PathBuf::from("../utils/test-files"), PathBuf::from("../utils"));
LoadData::new(PathBuf::from("../utils/test-files"), PathBuf::from("../utils"));
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("../../../READMEE.md").unwrap());
let result = static_fn(args);
let result = static_fn.call(&args);
assert!(result.is_err());
assert!(result.unwrap_err().description().contains("READMEE.md doesn't exist"));
assert!(result.unwrap_err().to_string().contains("READMEE.md doesn't exist"));
}

#[test]
fn cant_load_outside_content_dir() {
let static_fn =
make_load_data(PathBuf::from("../utils/test-files"), PathBuf::from("../utils"));
LoadData::new(PathBuf::from("../utils/test-files"), PathBuf::from("../utils"));
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("../../../README.md").unwrap());
args.insert("format".to_string(), to_value("plain").unwrap());
let result = static_fn(args);
let result = static_fn.call(&args);
assert!(result.is_err());
assert!(result
.unwrap_err()
.description()
.to_string()
.contains("README.md is not inside the base site directory"));
}

@@ -377,11 +386,11 @@ mod tests {

#[test]
fn can_load_remote_data() {
let static_fn = make_load_data(PathBuf::new(), PathBuf::new());
let static_fn = LoadData::new(PathBuf::new(), PathBuf::new());
let mut args = HashMap::new();
args.insert("url".to_string(), to_value("https://httpbin.org/json").unwrap());
args.insert("format".to_string(), to_value("json").unwrap());
let result = static_fn(args).unwrap();
let result = static_fn.call(&args).unwrap();
assert_eq!(
result.get("slideshow").unwrap().get("title").unwrap(),
&to_value("Sample Slide Show").unwrap()
@@ -390,29 +399,29 @@ mod tests {

#[test]
fn fails_when_request_404s() {
let static_fn = make_load_data(PathBuf::new(), PathBuf::new());
let static_fn = LoadData::new(PathBuf::new(), PathBuf::new());
let mut args = HashMap::new();
args.insert("url".to_string(), to_value("https://httpbin.org/status/404/").unwrap());
args.insert("format".to_string(), to_value("json").unwrap());
let result = static_fn(args);
let result = static_fn.call(&args);
assert!(result.is_err());
assert_eq!(
result.unwrap_err().description(),
result.unwrap_err().to_string(),
"Failed to request https://httpbin.org/status/404/: 404 Not Found"
);
}

#[test]
fn can_load_toml() {
let static_fn = make_load_data(
let static_fn = LoadData::new(
PathBuf::from("../utils/test-files"),
PathBuf::from("../utils/test-files"),
);
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("test.toml").unwrap());
let result = static_fn(args.clone()).unwrap();
let result = static_fn.call(&args.clone()).unwrap();

//TOML does not load in order
// TOML does not load in order
assert_eq!(
result,
json!({
@@ -426,13 +435,13 @@ mod tests {

#[test]
fn can_load_csv() {
let static_fn = make_load_data(
let static_fn = LoadData::new(
PathBuf::from("../utils/test-files"),
PathBuf::from("../utils/test-files"),
);
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("test.csv").unwrap());
let result = static_fn(args.clone()).unwrap();
let result = static_fn.call(&args.clone()).unwrap();

assert_eq!(
result,
@@ -448,13 +457,13 @@ mod tests {

#[test]
fn can_load_json() {
let static_fn = make_load_data(
let static_fn = LoadData::new(
PathBuf::from("../utils/test-files"),
PathBuf::from("../utils/test-files"),
);
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("test.json").unwrap());
let result = static_fn(args.clone()).unwrap();
let result = static_fn.call(&args.clone()).unwrap();

assert_eq!(
result,


+ 219
- 158
components/templates/src/global_fns/mod.rs View File

@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::sync::{Arc, Mutex};

use tera::{from_value, to_value, GlobalFn, Result, Value};
use tera::{from_value, to_value, Function as TeraFn, Result, Value};

use config::Config;
use library::{Library, Taxonomy};
@@ -14,82 +14,39 @@ mod macros;

mod load_data;

pub use self::load_data::make_load_data;
pub use self::load_data::LoadData;

pub fn make_trans(config: Config) -> GlobalFn {
let translations_config = config.translations;
let default_lang = config.default_language.clone();

Box::new(move |args| -> Result<Value> {
#[derive(Debug)]
pub struct Trans {
config: Config,
}
impl Trans {
pub fn new(config: Config) -> Self {
Self {config}
}
}
impl TeraFn for Trans {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let key = required_arg!(String, args.get("key"), "`trans` requires a `key` argument.");
let lang = optional_arg!(String, args.get("lang"), "`trans`: `lang` must be a string.")
.unwrap_or_else(|| default_lang.clone());
let translations = &translations_config[lang.as_str()];
.unwrap_or_else(|| self.config.default_language.clone());
let translations = &self.config.translations[lang.as_str()];
Ok(to_value(&translations[key.as_str()]).unwrap())
})
}

pub fn make_get_page(library: &Library) -> GlobalFn {
let mut pages = HashMap::new();
for page in library.pages_values() {
pages.insert(
page.file.relative.clone(),
to_value(library.get_page(&page.file.path).unwrap().to_serialized(library)).unwrap(),
);
}

Box::new(move |args| -> Result<Value> {
let path = required_arg!(
String,
args.get("path"),
"`get_page` requires a `path` argument with a string value"
);
match pages.get(&path) {
Some(p) => Ok(p.clone()),
None => Err(format!("Page `{}` not found.", path).into()),
}
})
}

pub fn make_get_section(library: &Library) -> GlobalFn {
let mut sections = HashMap::new();
let mut sections_basic = HashMap::new();
for section in library.sections_values() {
sections.insert(
section.file.relative.clone(),
to_value(library.get_section(&section.file.path).unwrap().to_serialized(library))
.unwrap(),
);

sections_basic.insert(
section.file.relative.clone(),
to_value(library.get_section(&section.file.path).unwrap().to_serialized_basic(library))
.unwrap(),
);
#[derive(Debug)]
pub struct GetUrl {
config: Config,
permalinks: HashMap<String, String>,
}
impl GetUrl {
pub fn new(config: Config, permalinks: HashMap<String, String>) -> Self {
Self {config, permalinks}
}

Box::new(move |args| -> Result<Value> {
let path = required_arg!(
String,
args.get("path"),
"`get_section` requires a `path` argument with a string value"
);

let metadata_only = args
.get("metadata_only")
.map_or(false, |c| from_value::<bool>(c.clone()).unwrap_or(false));

let container = if metadata_only { &sections_basic } else { &sections };

match container.get(&path) {
Some(p) => Ok(p.clone()),
None => Err(format!("Section `{}` not found.", path).into()),
}
})
}

pub fn make_get_url(permalinks: HashMap<String, String>, config: Config) -> GlobalFn {
Box::new(move |args| -> Result<Value> {
impl TeraFn for GetUrl {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let cachebust =
args.get("cachebust").map_or(false, |c| from_value::<bool>(c.clone()).unwrap_or(false));

@@ -103,7 +60,7 @@ pub fn make_get_url(permalinks: HashMap<String, String>, config: Config) -> Glob
"`get_url` requires a `path` argument with a string value"
);
if path.starts_with("./") {
match resolve_internal_link(&path, &permalinks) {
match resolve_internal_link(&path, &self.permalinks) {
Ok(url) => Ok(to_value(url).unwrap()),
Err(_) => {
Err(format!("Could not resolve URL for link `{}` not found.", path).into())
@@ -111,58 +68,96 @@ pub fn make_get_url(permalinks: HashMap<String, String>, config: Config) -> Glob
}
} else {
// anything else
let mut permalink = config.make_permalink(&path);
let mut permalink = self.config.make_permalink(&path);
if !trailing_slash && permalink.ends_with('/') {
permalink.pop(); // Removes the slash
}

if cachebust {
permalink = format!("{}?t={}", permalink, config.build_timestamp.unwrap());
permalink = format!("{}?t={}", permalink, self.config.build_timestamp.unwrap());
}
Ok(to_value(permalink).unwrap())
}
})
}
}

pub fn make_get_taxonomy(all_taxonomies: &[Taxonomy], library: &Library) -> GlobalFn {
let mut taxonomies = HashMap::new();
for taxonomy in all_taxonomies {
taxonomies
.insert(taxonomy.kind.name.clone(), to_value(taxonomy.to_serialized(library)).unwrap());
#[derive(Debug)]
pub struct ResizeImage {
imageproc: Arc<Mutex<imageproc::Processor>>,
}
impl ResizeImage {
pub fn new(imageproc: Arc<Mutex<imageproc::Processor>>) -> Self {
Self {imageproc}
}
}

Box::new(move |args| -> Result<Value> {
let kind = required_arg!(
static DEFAULT_OP: &'static str = "fill";
static DEFAULT_FMT: &'static str = "auto";
const DEFAULT_Q: u8 = 75;

impl TeraFn for ResizeImage {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let path = required_arg!(
String,
args.get("kind"),
"`get_taxonomy` requires a `kind` argument with a string value"
args.get("path"),
"`resize_image` requires a `path` argument with a string value"
);
let container = match taxonomies.get(&kind) {
Some(c) => c,
None => {
return Err(format!(
"`get_taxonomy` received an unknown taxonomy as kind: {}",
kind
)
.into());
}
};
let width = optional_arg!(
u32,
args.get("width"),
"`resize_image`: `width` must be a non-negative integer"
);
let height = optional_arg!(
u32,
args.get("height"),
"`resize_image`: `height` must be a non-negative integer"
);
let op = optional_arg!(String, args.get("op"), "`resize_image`: `op` must be a string")
.unwrap_or_else(|| DEFAULT_OP.to_string());

Ok(to_value(container).unwrap())
})
}
let format =
optional_arg!(String, args.get("format"), "`resize_image`: `format` must be a string")
.unwrap_or_else(|| DEFAULT_FMT.to_string());

pub fn make_get_taxonomy_url(all_taxonomies: &[Taxonomy]) -> GlobalFn {
let mut taxonomies = HashMap::new();
for taxonomy in all_taxonomies {
let mut items = HashMap::new();
for item in &taxonomy.items {
items.insert(item.name.clone(), item.permalink.clone());
let quality =
optional_arg!(u8, args.get("quality"), "`resize_image`: `quality` must be a number")
.unwrap_or(DEFAULT_Q);
if quality == 0 || quality > 100 {
return Err("`resize_image`: `quality` must be in range 1-100".to_string().into());
}

let mut imageproc = self.imageproc.lock().unwrap();
if !imageproc.source_exists(&path) {
return Err(format!("`resize_image`: Cannot find path: {}", path).into());
}
taxonomies.insert(taxonomy.kind.name.clone(), items);

let imageop = imageproc::ImageOp::from_args(path, &op, width, height, &format, quality)
.map_err(|e| format!("`resize_image`: {}", e))?;
let url = imageproc.insert(imageop);

to_value(url).map_err(|err| err.into())
}
}

Box::new(move |args| -> Result<Value> {
#[derive(Debug)]
pub struct GetTaxonomyUrl {
taxonomies: HashMap<String, HashMap<String, String>>,
}
impl GetTaxonomyUrl {
pub fn new(all_taxonomies: &[Taxonomy]) -> Self {
let mut taxonomies = HashMap::new();
for taxonomy in all_taxonomies {
let mut items = HashMap::new();
for item in &taxonomy.items {
items.insert(item.name.clone(), item.permalink.clone());
}
taxonomies.insert(taxonomy.kind.name.clone(), items);
}
Self {taxonomies}
}
}
impl TeraFn for GetTaxonomyUrl {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let kind = required_arg!(
String,
args.get("kind"),
@@ -173,7 +168,7 @@ pub fn make_get_taxonomy_url(all_taxonomies: &[Taxonomy]) -> GlobalFn {
args.get("name"),
"`get_taxonomy_url` requires a `name` argument with a string value"
);
let container = match taxonomies.get(&kind) {
let container = match self.taxonomies.get(&kind) {
Some(c) => c,
None => {
return Err(format!(
@@ -189,64 +184,130 @@ pub fn make_get_taxonomy_url(all_taxonomies: &[Taxonomy]) -> GlobalFn {
}

Err(format!("`get_taxonomy_url`: couldn't find `{}` in `{}` taxonomy", name, kind).into())
})
}
}

pub fn make_resize_image(imageproc: Arc<Mutex<imageproc::Processor>>) -> GlobalFn {
static DEFAULT_OP: &'static str = "fill";
static DEFAULT_FMT: &'static str = "auto";
const DEFAULT_Q: u8 = 75;

Box::new(move |args| -> Result<Value> {
#[derive(Debug)]
pub struct GetPage {
pages: HashMap<String, Value>,
}
impl GetPage {
pub fn new(library: &Library) -> Self {
let mut pages = HashMap::new();
for page in library.pages_values() {
pages.insert(
page.file.relative.clone(),
to_value(library.get_page(&page.file.path).unwrap().to_serialized(library)).unwrap(),
);
}
Self {pages}
}
}
impl TeraFn for GetPage {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let path = required_arg!(
String,
args.get("path"),
"`resize_image` requires a `path` argument with a string value"
);
let width = optional_arg!(
u32,
args.get("width"),
"`resize_image`: `width` must be a non-negative integer"
"`get_page` requires a `path` argument with a string value"
);
let height = optional_arg!(
u32,
args.get("height"),
"`resize_image`: `height` must be a non-negative integer"
match self.pages.get(&path) {
Some(p) => Ok(p.clone()),
None => Err(format!("Page `{}` not found.", path).into()),
}
}
}

#[derive(Debug)]
pub struct GetSection {
sections: HashMap<String, Value>,
sections_basic: HashMap<String, Value>,
}
impl GetSection {
pub fn new(library: &Library) -> Self {
let mut sections = HashMap::new();
let mut sections_basic = HashMap::new();
for section in library.sections_values() {
sections.insert(
section.file.relative.clone(),
to_value(library.get_section(&section.file.path).unwrap().to_serialized(library))
.unwrap(),
);

sections_basic.insert(
section.file.relative.clone(),
to_value(library.get_section(&section.file.path).unwrap().to_serialized_basic(library))
.unwrap(),
);
}
Self {sections, sections_basic}
}
}
impl TeraFn for GetSection {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let path = required_arg!(
String,
args.get("path"),
"`get_section` requires a `path` argument with a string value"
);
let op = optional_arg!(String, args.get("op"), "`resize_image`: `op` must be a string")
.unwrap_or_else(|| DEFAULT_OP.to_string());

let format =
optional_arg!(String, args.get("format"), "`resize_image`: `format` must be a string")
.unwrap_or_else(|| DEFAULT_FMT.to_string());
let metadata_only = args
.get("metadata_only")
.map_or(false, |c| from_value::<bool>(c.clone()).unwrap_or(false));

let quality =
optional_arg!(u8, args.get("quality"), "`resize_image`: `quality` must be a number")
.unwrap_or(DEFAULT_Q);
if quality == 0 || quality > 100 {
return Err("`resize_image`: `quality` must be in range 1-100".to_string().into());
}
let container = if metadata_only { &self.sections_basic } else { &self.sections };

let mut imageproc = imageproc.lock().unwrap();
if !imageproc.source_exists(&path) {
return Err(format!("`resize_image`: Cannot find path: {}", path).into());
match container.get(&path) {
Some(p) => Ok(p.clone()),
None => Err(format!("Section `{}` not found.", path).into()),
}
}
}

let imageop = imageproc::ImageOp::from_args(path, &op, width, height, &format, quality)
.map_err(|e| format!("`resize_image`: {}", e))?;
let url = imageproc.insert(imageop);

to_value(url).map_err(|err| err.into())
})
#[derive(Debug)]
pub struct GetTaxonomy {
taxonomies: HashMap<String, Value>,
}
impl GetTaxonomy {
pub fn new(all_taxonomies: &[Taxonomy], library: &Library) -> Self {
let mut taxonomies = HashMap::new();
for taxonomy in all_taxonomies {
taxonomies
.insert(taxonomy.kind.name.clone(), to_value(taxonomy.to_serialized(library)).unwrap());
}
Self {taxonomies}
}
}
impl TeraFn for GetTaxonomy {
fn call(&self, args: &HashMap<String, Value>) -> Result<Value> {
let kind = required_arg!(
String,
args.get("kind"),
"`get_taxonomy` requires a `kind` argument with a string value"
);
let container = match self.taxonomies.get(&kind) {
Some(c) => c,
None => {
return Err(format!(
"`get_taxonomy` received an unknown taxonomy as kind: {}",
kind
)
.into());
}
};

Ok(to_value(container).unwrap())
}
}

#[cfg(test)]
mod tests {
use super::{make_get_taxonomy, make_get_taxonomy_url, make_get_url, make_trans};
use super::{GetTaxonomy, GetTaxonomyUrl, GetUrl, Trans};

use std::collections::HashMap;

use tera::{to_value, Value};
use tera::{to_value, Value, Function};

use config::{Config, Taxonomy as TaxonomyConfig};
use library::{Library, Taxonomy, TaxonomyItem};
@@ -254,41 +315,41 @@ mod tests {
#[test]
fn can_add_cachebust_to_url() {
let config = Config::default();
let static_fn = make_get_url(HashMap::new(), config);
let static_fn = GetUrl::new(config, HashMap::new());
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("app.css").unwrap());
args.insert("cachebust".to_string(), to_value(true).unwrap());
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css?t=1");
assert_eq!(static_fn.call(&args).unwrap(), "http://a-website.com/app.css?t=1");
}

#[test]
fn can_add_trailing_slashes() {
let config = Config::default();
let static_fn = make_get_url(HashMap::new(), config);
let static_fn = GetUrl::new(config, HashMap::new());
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("app.css").unwrap());
args.insert("trailing_slash".to_string(), to_value(true).unwrap());
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/");
assert_eq!(static_fn.call(&args).unwrap(), "http://a-website.com/app.css/");
}

#[test]
fn can_add_slashes_and_cachebust() {
let config = Config::default();
let static_fn = make_get_url(HashMap::new(), config);
let static_fn = GetUrl::new(config, HashMap::new());
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("app.css").unwrap());
args.insert("trailing_slash".to_string(), to_value(true).unwrap());
args.insert("cachebust".to_string(), to_value(true).unwrap());
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css/?t=1");
assert_eq!(static_fn.call(&args).unwrap(), "http://a-website.com/app.css/?t=1");
}

#[test]
fn can_link_to_some_static_file() {
let config = Config::default();
let static_fn = make_get_url(HashMap::new(), config);
let static_fn = GetUrl::new(config, HashMap::new());
let mut args = HashMap::new();
args.insert("path".to_string(), to_value("app.css").unwrap());
assert_eq!(static_fn(args).unwrap(), "http://a-website.com/app.css");
assert_eq!(static_fn.call(&args).unwrap(), "http://a-website.com/app.css");
}

#[test]
@@ -299,11 +360,11 @@ mod tests {
let tags = Taxonomy { kind: taxo_config, items: vec![tag] };

let taxonomies = vec![tags.clone()];
let static_fn = make_get_taxonomy(&taxonomies, &library);
let static_fn = GetTaxonomy::new(&taxonomies, &library);
// can find it correctly
let mut args = HashMap::new();
args.insert("kind".to_string(), to_value("tags").unwrap());
let res = static_fn(args).unwrap();
let res = static_fn.call(&args).unwrap();
let res_obj = res.as_object().unwrap();
assert_eq!(res_obj["kind"], to_value(tags.kind).unwrap());
assert_eq!(res_obj["items"].clone().as_array().unwrap().len(), 1);
@@ -327,7 +388,7 @@ mod tests {
// and errors if it can't find it
let mut args = HashMap::new();
args.insert("kind".to_string(), to_value("something-else").unwrap());
assert!(static_fn(args).is_err());
assert!(static_fn.call(&args).is_err());
}

#[test]
@@ -338,20 +399,20 @@ mod tests {
let tags = Taxonomy { kind: taxo_config, items: vec![tag] };

let taxonomies = vec![tags.clone()];
let static_fn = make_get_taxonomy_url(&taxonomies);
let static_fn = GetTaxonomyUrl::new(&taxonomies);
// can find it correctly
let mut args = HashMap::new();
args.insert("kind".to_string(), to_value("tags").unwrap());
args.insert("name".to_string(), to_value("Programming").unwrap());
assert_eq!(
static_fn(args).unwrap(),
static_fn.call(&args).unwrap(),
to_value("http://a-website.com/tags/programming/").unwrap()
);
// and errors if it can't find it
let mut args = HashMap::new();
args.insert("kind".to_string(), to_value("tags").unwrap());
args.insert("name".to_string(), to_value("random").unwrap());
assert!(static_fn(args).is_err());
assert!(static_fn.call(&args).is_err());
}

#[test]
@@ -370,16 +431,16 @@ title = "A title"
"#;

let config = Config::parse(trans_config).unwrap();
let static_fn = make_trans(config);
let static_fn = Trans::new(config);
let mut args = HashMap::new();

args.insert("key".to_string(), to_value("title").unwrap());
assert_eq!(static_fn(args.clone()).unwrap(), "Un titre");
assert_eq!(static_fn.call(&args).unwrap(), "Un titre");

args.insert("lang".to_string(), to_value("en").unwrap());
assert_eq!(static_fn(args.clone()).unwrap(), "A title");
assert_eq!(static_fn.call(&args).unwrap(), "A title");

args.insert("lang".to_string(), to_value("fr").unwrap());
assert_eq!(static_fn(args.clone()).unwrap(), "Un titre");
assert_eq!(static_fn.call(&args).unwrap(), "Un titre");
}
}

+ 1
- 1
components/templates/src/lib.rs View File

@@ -65,6 +65,6 @@ pub fn render_redirect_template(url: &str, tera: &Tera) -> Result<String> {
let mut context = Context::new();
context.insert("url", &url);

tera.render("internal/alias.html", &context)
tera.render("internal/alias.html", context)
.map_err(|e| Error::chain(format!("Failed to render alias for '{}'", url), e))
}

+ 1
- 1
components/utils/Cargo.toml View File

@@ -5,7 +5,7 @@ authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]

[dependencies]
errors = { path = "../errors" }
tera = "0.11"
tera = "1.0.0-alpha.3"
unicode-segmentation = "1.2"
walkdir = "2"
toml = "0.4"


+ 2
- 2
components/utils/src/templates.rs View File

@@ -11,7 +11,7 @@ macro_rules! render_default_tpl {
let mut context = Context::new();
context.insert("filename", $filename);
context.insert("url", $url);
Tera::one_off(DEFAULT_TPL, &context, true).map_err(|e| e.into())
Tera::one_off(DEFAULT_TPL, context, true).map_err(|e| e.into())
}};
}

@@ -22,7 +22,7 @@ macro_rules! render_default_tpl {
pub fn render_template(
name: &str,
tera: &Tera,
context: &Context,
context: Context,
theme: &Option<String>,
) -> Result<String> {
// check if it is in the templates


Loading…
Cancel
Save