diff --git a/CHANGELOG.md b/CHANGELOG.md index ae72273a..bfbb17fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog + +## 0.15.0 (2021-12-05) + +- Fix config file watching +- Support custom syntax highlighting themes +- Add a `required` argument to taxonomy template functions to allow them to return empty taxonomies +- Support colocating subfolders +- Shortcodes and `anchor-link.html` can now access the `lang` context +- Add prompt before replacing the output directory with `zola build` if the `output-dir` flag is given +- Shortcode handling has been completely rewritten, solving many issues +- Also add internal links starting with `#` without any internal Zola link + ## 0.14.1 (2021-08-24) - HTML minification now respects HTML spec (it still worked before because browsers can handle invalid HTML well and minifiers take advantage of it) diff --git a/Cargo.lock b/Cargo.lock index 30af561f..f126700f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,12 +14,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" -[[package]] -name = "ahash" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" - [[package]] name = "aho-corasick" version = "0.7.18" @@ -46,9 +40,9 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi 0.3.9", ] @@ -59,6 +53,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e" +[[package]] +name = "anyhow" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" + [[package]] name = "arrayvec" version = "0.4.12" @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ "lazy_static", "memchr", @@ -166,9 +166,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.7.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" +checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" [[package]] name = "byte-tools" @@ -212,24 +212,24 @@ dependencies = [ [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.69" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" dependencies = [ "jobserver", ] [[package]] name = "cedarwood" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963e82c7b94163808ca3a452608d260b64ba5bc7b5653b4af1af59887899f48d" +checksum = "fa312498f9f41452998d984d3deb84c84f86aeb8a2499d7505bb8106d78d147d" dependencies = [ "smallvec", ] @@ -256,25 +256,37 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.43", "winapi 0.3.9", ] [[package]] name = "chrono-tz" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2554a3155fec064362507487171dcc4edc3df60cb10f3a1fb10ed8094822b120" +checksum = "64c01c1c607d25c71bbaa67c113d6c6b36c434744b4fd66691d711b5b1bc0c8b" dependencies = [ "chrono", + "chrono-tz-build", + "phf 0.10.0", +] + +[[package]] +name = "chrono-tz-build" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" +dependencies = [ "parse-zoneinfo", + "phf 0.10.0", + "phf_codegen 0.10.0", ] [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", @@ -320,9 +332,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" dependencies = [ "core-foundation-sys", "libc", @@ -330,24 +342,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.1.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" dependencies = [ "cfg-if 1.0.0", ] @@ -420,9 +432,9 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377c9b002a72a0b2c1a18c62e2f3864bdfea4a015e3683a96e24aa45dd6c02d1" +checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf" dependencies = [ "nix", "winapi 0.3.9", @@ -488,13 +500,14 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elasticlunr-rs" -version = "2.3.13" +version = "2.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "515a402b5acb08002194dd926065be7733003bb37ac0f030dfd39160028238e1" +checksum = "60eee99ae400fb1c4521ea3bd678994cb66572754d240449368e8ecd40281569" dependencies = [ "jieba-rs", "lazy_static", "lindera", + "lindera-core", "regex", "rust-stemmers", "serde", @@ -570,9 +583,9 @@ checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" [[package]] name = "encoding_rs" -version = "0.8.28" +version = "0.8.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746" dependencies = [ "cfg-if 1.0.0", ] @@ -607,9 +620,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ "cfg-if 1.0.0", "crc32fast", @@ -712,69 +725,61 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" +checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" +checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445" [[package]] name = "futures-io" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" - -[[package]] -name = "futures-macro" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" -dependencies = [ - "autocfg", - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] +checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11" [[package]] name = "futures-sink" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53" +checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af" [[package]] name = "futures-task" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" +checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12" [[package]] name = "futures-util" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" +checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e" dependencies = [ - "autocfg", "futures-core", "futures-io", - "futures-macro", "futures-task", "memchr", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.12.4" @@ -828,9 +833,9 @@ dependencies = [ [[package]] name = "gif" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a668f699973d0f573d15749b7002a9ac9e1f9c6b220e7b165601334c173d8de" +checksum = "c3a7187e78088aead22ceedeee99779455b23fc231fe13ec443f99bb71694e5b" dependencies = [ "color_quant", "weezl", @@ -868,11 +873,11 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.4" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" +checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "fnv", "futures-core", "futures-sink", @@ -885,16 +890,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "hashbrown" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "ahash", - "autocfg", -] - [[package]] name = "hashbrown" version = "0.11.2" @@ -935,22 +930,22 @@ dependencies = [ [[package]] name = "http" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" +checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "http", "pin-project-lite", ] @@ -963,9 +958,9 @@ checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humansize" @@ -975,11 +970,11 @@ checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026" [[package]] name = "hyper" -version = "0.14.11" +version = "0.14.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b61cf2d1aebcf6e6352c97b81dc2244ca29194be1b276f5d8ad5c6330fffb11" +checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "futures-channel", "futures-core", "futures-util", @@ -999,17 +994,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ - "futures-util", + "http", "hyper", - "log", "rustls", "tokio", "tokio-rustls", - "webpki", ] [[package]] @@ -1018,7 +1011,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "hyper", "native-tls", "tokio", @@ -1099,7 +1092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown", ] [[package]] @@ -1122,6 +1115,15 @@ dependencies = [ "libc", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "iovec" version = "0.1.4" @@ -1145,15 +1147,16 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "jieba-rs" -version = "0.5.1" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ca2de723e93727460917d9542f7ae35a74d03d93923f03380a0238d860d137c" +checksum = "8c7e12f50325401dde50c29ca32cff44bae20873135b39f4e19ecf305226dd80" dependencies = [ "cedarwood", - "hashbrown 0.8.2", + "fxhash", + "hashbrown", "lazy_static", - "phf 0.8.0", - "phf_codegen", + "phf 0.10.0", + "phf_codegen 0.10.0", "regex", ] @@ -1177,9 +1180,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.53" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ "wasm-bindgen", ] @@ -1206,12 +1209,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" -[[package]] -name = "levenshtein_automata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73a004f877f468548d8d0ac4977456a249d8fabbdb8416c36db163dfc8f2e8ca" - [[package]] name = "lexical-core" version = "0.7.6" @@ -1236,9 +1233,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.100" +version = "0.2.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5" +checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01" [[package]] name = "library" @@ -1261,6 +1258,7 @@ dependencies = [ "tera", "toml", "utils", + "walkdir", ] [[package]] @@ -1274,66 +1272,81 @@ dependencies = [ [[package]] name = "lindera" -version = "0.3.5" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b867cd68f5fc19a6d8b8361a6aba55ed2485f243044b70da14b6ba5a128c00" +checksum = "4e067b79992ab4ee575f5113ca7ccc1b011f67378f7627169e9bf95d48a8d481" dependencies = [ + "anyhow", "bincode", "byteorder", "encoding", "lindera-core", "lindera-dictionary", - "lindera-fst", "lindera-ipadic", + "lindera-ipadic-builder", "serde", "serde_json", ] [[package]] name = "lindera-core" -version = "0.3.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b7f132a5d361c1236b28434c632097fb8867ebdf4e4c9ab4f793525bb681ff" +checksum = "09d34134111feb8c9424de5743a9ead4c22cb1c5a48cb90322ebbe21a2bc27c1" dependencies = [ + "anyhow", "bincode", "byteorder", "encoding", - "lindera-fst", "serde", + "thiserror", + "yada", ] [[package]] name = "lindera-dictionary" -version = "0.3.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78a61a066057d24faab043586633274fa3468c5c54cb8191895659811218a8ec" +checksum = "68ac4ac60f3ca650e4ab1280a5b6d57f73267902477ab9c9fd3b6609a7fb5888" dependencies = [ + "anyhow", "bincode", "byteorder", "lindera-core", ] -[[package]] -name = "lindera-fst" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6098a7ca6679296cd2d227efa232f990552c5278394c845bec8a70ab0284ae0" -dependencies = [ - "byteorder", - "levenshtein_automata", - "regex-syntax 0.4.2", - "utf8-ranges", -] - [[package]] name = "lindera-ipadic" -version = "0.3.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f12f44c385a6f4c1ff0863a2f0a91ce5f1ff6c2e0e44c69b37051b56fece112" +checksum = "266fda136179e607d6ebcf2ef326fbdb2a133f9bdea9a68e6ac4fa8627e47ced" dependencies = [ "bincode", "byteorder", + "encoding", + "flate2", "lindera-core", + "lindera-ipadic-builder", + "reqwest", + "tar", + "tokio", +] + +[[package]] +name = "lindera-ipadic-builder" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ede56e474b8fda9d4df2b9dc7683018111d3298260e1f594655e34287f26c64" +dependencies = [ + "anyhow", + "bincode", + "byteorder", + "clap", + "encoding", + "glob", + "lindera-core", + "serde", + "yada", ] [[package]] @@ -1362,6 +1375,15 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "lock_api" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.14" @@ -1391,7 +1413,7 @@ checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" dependencies = [ "log", "phf 0.8.0", - "phf_codegen", + "phf_codegen 0.8.0", "string_cache", "string_cache_codegen", "tendril", @@ -1423,9 +1445,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -1448,9 +1470,9 @@ dependencies = [ [[package]] name = "minify-html" -version = "0.6.8" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af97b0ff1a328e6877ad03266f51d0ee9d8b8b31aa05da6566dc1ca4ed921f0f" +checksum = "1cac5b6b3e2eebc4c99750325b106990cf5334afcdcde6b4479e5f2c6be5ceb8" dependencies = [ "aho-corasick", "lazy_static", @@ -1497,9 +1519,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ "libc", "log", @@ -1596,9 +1618,9 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "nix" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1e25ee6b412c2a1e3fcb6a4499a5c1bfe7f43e014bdce9a6b6666e5aa2d187" +checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188" dependencies = [ "bitflags", "cc", @@ -1776,9 +1798,9 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "onig" -version = "6.2.0" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16fd3c0e73b516af509c13c4ba76ec0c987ce20d78b38cff356b8d01fc6a6c0" +checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" dependencies = [ "bitflags", "lazy_static", @@ -1788,9 +1810,9 @@ dependencies = [ [[package]] name = "onig_sys" -version = "69.7.0" +version = "69.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd9442a09e4fbd08d196ddf419b2c79a43c3a46c800320cc841d45c2449a240" +checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" dependencies = [ "cc", "pkg-config", @@ -1810,9 +1832,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46b233de7d83bc167fe43ae2dda3b5b84e80e09cceba581e4decb958a4896bf" +checksum = "176ee4b630d174d2da8241336763bb459281dddc0f4d87f72c3b1efc9a6109b7" dependencies = [ "pathdiff", "winapi 0.3.9", @@ -1820,9 +1842,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.36" +version = "0.10.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1840,9 +1862,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.66" +version = "0.9.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" +checksum = "7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73" dependencies = [ "autocfg", "cc", @@ -1851,6 +1873,31 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi 0.3.9", +] + [[package]] name = "parse-zoneinfo" version = "0.3.0" @@ -1868,9 +1915,9 @@ checksum = "3cacbb3c4ff353b534a67fb8d7524d00229da4cb1dc8c79f4db96e375ab5b619" [[package]] name = "pathdiff" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877630b3de15c0b64cc52f659345724fbf6bdad9bd9566699fc53688f3c34a34" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "percent-encoding" @@ -1945,10 +1992,20 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" dependencies = [ - "phf_generator", + "phf_generator 0.8.0", "phf_shared 0.8.0", ] +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + [[package]] name = "phf_generator" version = "0.8.0" @@ -1959,6 +2016,16 @@ dependencies = [ "rand 0.7.3", ] +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.4", +] + [[package]] name = "phf_shared" version = "0.8.0" @@ -1975,6 +2042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ "siphasher", + "uncased", ] [[package]] @@ -1991,21 +2059,21 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" [[package]] name = "plist" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38d026d73eeaf2ade76309d0c65db5a35ecf649e3cec428db316243ea9d6711" +checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" dependencies = [ "base64", - "chrono", "indexmap", "line-wrap", "serde", + "time 0.3.5", "xml-rs", ] @@ -2023,9 +2091,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" [[package]] name = "precomputed-hash" @@ -2033,23 +2101,11 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ "unicode-xid", ] @@ -2073,9 +2129,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ "proc-macro2", ] @@ -2213,7 +2269,7 @@ checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.6.25", + "regex-syntax", ] [[package]] @@ -2222,12 +2278,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -[[package]] -name = "regex-syntax" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" - [[package]] name = "regex-syntax" version = "0.6.25" @@ -2236,9 +2286,9 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "relative-path" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9629de8974fd69c97684736786b807edd3da456d3e3f95341dd9d4cbd8f5ad6" +checksum = "73d4caf086b102ab49d0525b721594a555ab55c6556086bbe52a430ad26c3bd7" [[package]] name = "remove_dir_all" @@ -2273,12 +2323,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.4" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" +checksum = "07bea77bc708afa10e59905c3d4af7c8fd43c9214251673095ff8b14345fcbc5" dependencies = [ "base64", - "bytes 1.0.1", + "bytes 1.1.0", "encoding_rs", "futures-core", "futures-util", @@ -2296,7 +2346,9 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls", + "rustls-pemfile", "serde", + "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", @@ -2345,22 +2397,30 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" dependencies = [ - "base64", "log", "ring", "sct", - "webpki", + "webpki 0.22.0", +] + +[[package]] +name = "rustls-pemfile" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +dependencies = [ + "base64", ] [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568" [[package]] name = "safemem" @@ -2423,9 +2483,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sct" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ "ring", "untrusted", @@ -2445,9 +2505,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.3.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" dependencies = [ "bitflags", "core-foundation", @@ -2458,9 +2518,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.3.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" dependencies = [ "core-foundation-sys", "libc", @@ -2468,18 +2528,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.129" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1f72836d2aa753853178eda473a3b9d8e4eefdaf20523b919677e6de489f8f1" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.129" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57ae87ad533d9a56427558b516d0adac283614e347abf85b0dc0cbbf0a249f3" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -2488,9 +2548,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.66" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" +checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527" dependencies = [ "indexmap", "itoa", @@ -2512,9 +2572,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.19" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6375dbd828ed6964c3748e4ef6d18e7a175d408ffe184bca01698d0c73f915a9" +checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af" dependencies = [ "dtoa", "indexmap", @@ -2536,9 +2596,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -2548,10 +2608,19 @@ dependencies = [ ] [[package]] -name = "siphasher" -version = "0.3.6" +name = "signal-hook-registry" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729a25c17d72b06c68cb47955d44fda88ad2d3e7d77e025663fdd69b93dd71a1" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "siphasher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" [[package]] name = "site" @@ -2583,15 +2652,15 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "slotmap" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a952280edbecfb1d4bd3cf2dbc309dc6ab523e53487c438ae21a6df09fe84bc4" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" dependencies = [ "version_check", ] @@ -2607,15 +2676,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "socket2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ "libc", "winapi 0.3.9", @@ -2635,12 +2704,13 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_cache" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ddb1139b5353f96e429e1a5e19fbaf663bddedaa06d1dbd49f82e352601209a" +checksum = "923f0f39b6267d37d23ce71ae7235602134b250ace715dd2c90421998ddac0c6" dependencies = [ "lazy_static", "new_debug_unreachable", + "parking_lot", "phf_shared 0.8.0", "precomputed-hash", "serde", @@ -2652,7 +2722,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" dependencies = [ - "phf_generator", + "phf_generator 0.8.0", "phf_shared 0.8.0", "proc-macro2", "quote", @@ -2696,9 +2766,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.75" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" +checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" dependencies = [ "proc-macro2", "quote", @@ -2719,7 +2789,7 @@ dependencies = [ "lazycell", "onig", "plist", - "regex-syntax 0.6.25", + "regex-syntax", "serde", "serde_derive", "serde_json", @@ -2727,6 +2797,17 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "tar" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "tempfile" version = "3.2.0" @@ -2781,9 +2862,9 @@ dependencies = [ [[package]] name = "tera" -version = "1.12.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf95b0d8a46da5fe3ea119394a6c7f1e745f9de359081641c99946e2bf55d4f2" +checksum = "d3cac831b615c25bcef632d1cabf864fa05813baad3d526829db18eb70e8b58d" dependencies = [ "chrono", "chrono-tz", @@ -2812,9 +2893,9 @@ dependencies = [ [[package]] name = "test-case" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b114ece25254e97bf48dd4bfc2a12bad0647adacfe4cae1247a9ca6ad302cec" +checksum = "c7cad0a06f9a61e94355aa3b3dc92d85ab9c83406722b1ca5e918d4297c12c23" dependencies = [ "cfg-if 1.0.0", "proc-macro2", @@ -2832,6 +2913,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.1.3" @@ -2862,6 +2963,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad" +dependencies = [ + "itoa", + "libc", +] + [[package]] name = "tinystr" version = "0.3.4" @@ -2870,9 +2981,9 @@ checksum = "29738eedb4388d9ea620eeab9384884fc3f06f586a2eddb56bedc5885126c7c1" [[package]] name = "tinyvec" -version = "1.3.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" dependencies = [ "tinyvec_macros", ] @@ -2885,20 +2996,35 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.10.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" +checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" dependencies = [ "autocfg", - "bytes 1.0.1", + "bytes 1.1.0", "libc", "memchr", - "mio 0.7.13", + "mio 0.7.14", "num_cpus", + "once_cell", + "parking_lot", "pin-project-lite", + "signal-hook-registry", + "tokio-macros", "winapi 0.3.9", ] +[[package]] +name = "tokio-macros" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tokio-native-tls" version = "0.3.0" @@ -2911,22 +3037,22 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "4baa378e417d780beff82bf54ceb0d195193ea6a00c14e22359e7f39456b5689" dependencies = [ "rustls", "tokio", - "webpki", + "webpki 0.22.0", ] [[package]] name = "tokio-util" -version = "0.6.7" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" dependencies = [ - "bytes 1.0.1", + "bytes 1.1.0", "futures-core", "futures-sink", "log", @@ -2951,9 +3077,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.26" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", @@ -2962,9 +3088,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" dependencies = [ "lazy_static", ] @@ -2977,9 +3103,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "typenum" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "ucd-trie" @@ -2987,6 +3113,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +[[package]] +name = "uncased" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" +dependencies = [ + "version_check", +] + [[package]] name = "unic-char-property" version = "0.9.0" @@ -3066,9 +3201,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" [[package]] name = "unicode-normalization" @@ -3087,9 +3222,9 @@ checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" @@ -3121,12 +3256,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" -[[package]] -name = "utf8-ranges" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" - [[package]] name = "utils" version = "0.1.0" @@ -3197,21 +3326,19 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.76" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ "cfg-if 1.0.0", - "serde", - "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.76" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", @@ -3224,9 +3351,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.26" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fded345a6559c2cfee778d562300c581f7d4ff3edb9b0d230d69800d213972" +checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3236,9 +3363,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.76" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3246,9 +3373,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.76" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", @@ -3259,15 +3386,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.76" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "web-sys" -version = "0.3.53" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" dependencies = [ "js-sys", "wasm-bindgen", @@ -3293,13 +3420,23 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki-roots" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" dependencies = [ - "webpki", + "webpki 0.21.4", ] [[package]] @@ -3388,6 +3525,15 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +dependencies = [ + "libc", +] + [[package]] name = "xml-rs" version = "0.8.4" @@ -3396,14 +3542,14 @@ checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" [[package]] name = "xml5ever" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1b52e6e8614d4a58b8e70cf51ec0cc21b256ad8206708bcff8139b5bbd6a59" +checksum = "9234163818fd8e2418fcde330655e757900d4236acd8cc70fef345ef91f6d865" dependencies = [ "log", "mac", "markup5ever", - "time", + "time 0.1.43", ] [[package]] @@ -3412,6 +3558,12 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8" +[[package]] +name = "yada" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d12cb7a57bbf2ab670ed9545bae3648048547f9039279a89ce000208e585c1" + [[package]] name = "yaml-rust" version = "0.4.5" @@ -3423,7 +3575,7 @@ dependencies = [ [[package]] name = "zola" -version = "0.14.1" +version = "0.15.0" dependencies = [ "atty", "chrono", @@ -3437,6 +3589,7 @@ dependencies = [ "mime_guess", "notify", "open", + "pathdiff", "percent-encoding", "relative-path", "same-file", diff --git a/Cargo.toml b/Cargo.toml index 33837707..8175ddda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zola" -version = "0.14.1" +version = "0.15.0" authors = ["Vincent Prouillet "] edition = "2018" license = "MIT" @@ -28,7 +28,7 @@ termcolor = "1.0.4" url = "2" # Below is for the serve cmd hyper = { version = "0.14.1", default-features = false, features = ["runtime", "server", "http2", "http1"] } -tokio = { version = "1.0.1", default-features = false, features = ["rt", "fs"] } +tokio = { version = "1.0.1", default-features = false, features = ["rt", "fs", "time"] } percent-encoding = "2" notify = "4" ws = "0.9" @@ -36,6 +36,7 @@ ctrlc = "3" open = "2" globset = "0.4" relative-path = "1" +pathdiff = "0.2" serde_json = "1.0" # For mimetype detection in serve mode mime_guess = "2.0" diff --git a/Dockerfile b/Dockerfile index 2db2d144..369b10ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ FROM rust:slim AS builder RUN apt-get update -y && \ - apt-get install -y python-pip make g++ python-setuptools libssl-dev pkg-config rsync && \ - pip install dockerize && \ + apt-get install -y make g++ libssl-dev && \ rustup target add x86_64-unknown-linux-gnu WORKDIR /app @@ -10,12 +9,7 @@ COPY . . RUN cargo build --release --target x86_64-unknown-linux-gnu -RUN mv target/x86_64-unknown-linux-gnu/release/zola /usr/bin -RUN mkdir -p /workdir -WORKDIR /workdir -RUN dockerize -n -o /workdir /usr/bin/zola - -FROM scratch -COPY --from=builder /workdir . -ENTRYPOINT [ "/usr/bin/zola" ] +FROM gcr.io/distroless/cc +COPY --from=builder /app/target/x86_64-unknown-linux-gnu/release/zola /bin/zola +ENTRYPOINT [ "/bin/zola" ] diff --git a/README.md b/README.md index da4dddac..9603d577 100644 --- a/README.md +++ b/README.md @@ -7,53 +7,27 @@ A fast static site generator in a single binary with everything built-in. Documentation is available on [its site](https://www.getzola.org/documentation/getting-started/installation/) or in the `docs/content` folder of the repository and the community can use [its forum](https://zola.discourse.group). -## Comparisons with other static site generators +This tool and the template engine it is using were born from an intense dislike of the (insane) Golang template engine and therefore of +Hugo that I was using before for 6+ sites. -| | Zola | Cobalt | Hugo | Pelican | -|:--------------------------------|:------:|:------:|:------:|:-------:| -| Single binary | ![yes] | ![yes] | ![yes] | ![no] | -| Language | Rust | Rust | Go | Python | -| Syntax highlighting | ![yes] | ![yes] | ![yes] | ![yes] | -| Sass compilation | ![yes] | ![yes] | ![yes] | ![yes] | -| Assets co-location | ![yes] | ![yes] | ![yes] | ![yes] | -| Multilingual site | ![ehh] | ![no] | ![yes] | ![yes] | -| Image processing | ![yes] | ![no] | ![yes] | ![yes] | -| Sane & powerful template engine | ![yes] | ![yes] | ![ehh] | ![yes] | -| Themes | ![yes] | ![no] | ![yes] | ![yes] | -| Shortcodes | ![yes] | ![no] | ![yes] | ![yes] | -| Internal links | ![yes] | ![no] | ![yes] | ![yes] | -| Link checker | ![yes] | ![no] | ![no] | ![yes] | -| Table of contents | ![yes] | ![no] | ![yes] | ![yes] | -| Automatic header anchors | ![yes] | ![no] | ![yes] | ![yes] | -| Aliases | ![yes] | ![no] | ![yes] | ![yes] | -| Pagination | ![yes] | ![no] | ![yes] | ![yes] | -| Custom taxonomies | ![yes] | ![no] | ![yes] | ![no] | -| Search | ![yes] | ![no] | ![no] | ![yes] | -| Data files | ![yes] | ![yes] | ![yes] | ![no] | -| LiveReload | ![yes] | ![no] | ![yes] | ![yes] | -| Netlify support | ![yes] | ![no] | ![yes] | ![no] | -| Vercel support | ![yes] | ![no] | ![yes] | ![yes] | -| Cloudflare Pages support | ![yes] | ![no] | ![yes] | ![yes] | -| Breadcrumbs | ![yes] | ![no] | ![no] | ![yes] | -| Custom output formats | ![no] | ![no] | ![yes] | ![no] | +# List of features -### Supported content formats - -- Zola: markdown -- Cobalt: markdown -- Hugo: markdown, asciidoc, org-mode -- Pelican: reStructuredText, markdown, asciidoc, org-mode, whatever-you-want - -### ![ehh] explanations - -Hugo gets ![ehh] for the template engine because while it is probably the most powerful template engine in the list (after Jinja2) it personally drives me insane, to the point of writing my own template engine and static site generator. Yes, this is a bit biased. - -Zola gets ![ehh] for multi-language support as it only has a basic support and does not (yet) offer things like i18n in templates. - -### Pelican notes - -Many features of Pelican come from plugins, which might be tricky to use because of a version mismatch or inadequate documentation. Netlify supports Python and Pipenv but you still need to install your dependencies manually. - -[yes]: ./is-yes.svg -[ehh]: ./is-ehh.svg -[no]: ./is-no.svg +- Single binary +- Syntax highlighting +- Sass compilation +- Assets co-location +- (Basic currently) multilingual site suport +- Image processing +- Themes +- Shortcodes +- Internal links +- External link checker +- Table of contents automatic generation +- Automatic header anchors +- Aliases +- Pagination +- Custom taxonomies +- Search with no servers or any third parties involved +- Live reload +- Deploy on many platforms easily: Netlify, Vercel, Cloudflare +- Breadcrumbs diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87e7dec3..6763de5e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,7 +21,7 @@ stages: rustup_toolchain: stable linux-pinned: imageName: 'ubuntu-20.04' - rustup_toolchain: 1.49.0 + rustup_toolchain: 1.52.0 pool: vmImage: $(imageName) steps: diff --git a/components/config/src/config/markup.rs b/components/config/src/config/markup.rs index b6fa0e2d..57894f23 100644 --- a/components/config/src/config/markup.rs +++ b/components/config/src/config/markup.rs @@ -1,9 +1,15 @@ -use std::path::Path; +use std::{path::Path, sync::Arc}; use serde_derive::{Deserialize, Serialize}; -use syntect::parsing::{SyntaxSet, SyntaxSetBuilder}; +use syntect::{ + highlighting::{Theme, ThemeSet}, + html::css_for_theme_with_class_style, + parsing::{SyntaxSet, SyntaxSetBuilder}, +}; -use errors::Result; +use errors::{bail, Result}; + +use crate::highlighting::{CLASS_STYLE, THEME_SET}; pub const DEFAULT_HIGHLIGHT_THEME: &str = "base16-ocean-dark"; @@ -43,26 +49,106 @@ pub struct Markdown { pub external_links_no_referrer: bool, /// Whether smart punctuation is enabled (changing quotes, dashes, dots etc in their typographic form) pub smart_punctuation: bool, - - /// A list of directories to search for additional `.sublime-syntax` files in. - pub extra_syntaxes: Vec, + /// A list of directories to search for additional `.sublime-syntax` and `.tmTheme` files in. + pub extra_syntaxes_and_themes: Vec, /// The compiled extra syntaxes into a syntax set #[serde(skip_serializing, skip_deserializing)] // not a typo, 2 are need pub extra_syntax_set: Option, + /// The compiled extra themes into a theme set + #[serde(skip_serializing, skip_deserializing)] // not a typo, 2 are need + pub extra_theme_set: Arc>, } impl Markdown { - /// Attempt to load any extra syntax found in the extra syntaxes of the config - pub fn load_extra_syntaxes(&mut self, base_path: &Path) -> Result<()> { - if self.extra_syntaxes.is_empty() { - return Ok(()); + /// Gets the configured highlight theme from the THEME_SET or the config's extra_theme_set + /// Returns None if the configured highlighting theme is set to use css + pub fn get_highlight_theme(&self) -> Option<&Theme> { + if self.highlight_theme == "css" { + None + } else { + Some(self.get_highlight_theme_by_name(&self.highlight_theme)) + } + } + + /// Gets an arbitrary theme from the THEME_SET or the extra_theme_set + pub fn get_highlight_theme_by_name(&self, theme_name: &str) -> &Theme { + (*self.extra_theme_set) + .as_ref() + .and_then(|ts| ts.themes.get(theme_name)) + .unwrap_or_else(|| &THEME_SET.themes[theme_name]) + } + + /// Attempt to load any extra syntaxes and themes found in the extra_syntaxes_and_themes folders + pub fn load_extra_syntaxes_and_highlight_themes( + &self, + base_path: &Path, + ) -> Result<(Option, Option)> { + if self.extra_syntaxes_and_themes.is_empty() { + return Ok((None, None)); } let mut ss = SyntaxSetBuilder::new(); - for dir in &self.extra_syntaxes { + let mut ts = ThemeSet::new(); + for dir in &self.extra_syntaxes_and_themes { ss.add_from_folder(base_path.join(dir), true)?; + ts.add_from_folder(base_path.join(dir))?; + } + let ss = ss.build(); + + Ok(( + if ss.syntaxes().is_empty() { None } else { Some(ss) }, + if ts.themes.is_empty() { None } else { Some(ts) }, + )) + } + + pub fn export_theme_css(&self, theme_name: &str) -> String { + let theme = self.get_highlight_theme_by_name(theme_name); + css_for_theme_with_class_style(theme, CLASS_STYLE) + } + + pub fn init_extra_syntaxes_and_highlight_themes(&mut self, path: &Path) -> Result<()> { + if self.highlight_theme == "css" { + return Ok(()); + } + + let (loaded_extra_syntaxes, loaded_extra_highlight_themes) = + self.load_extra_syntaxes_and_highlight_themes(path)?; + + if let Some(extra_syntax_set) = loaded_extra_syntaxes { + self.extra_syntax_set = Some(extra_syntax_set); + } + if let Some(extra_theme_set) = loaded_extra_highlight_themes { + self.extra_theme_set = Arc::new(Some(extra_theme_set)); + } + + // Validate that the chosen highlight_theme exists in the loaded highlight theme sets + if !THEME_SET.themes.contains_key(&self.highlight_theme) { + if let Some(extra) = &*self.extra_theme_set { + if !extra.themes.contains_key(&self.highlight_theme) { + bail!( + "Highlight theme {} not found in the extra theme set", + self.highlight_theme + ) + } + } else { + bail!("Highlight theme {} not available.\n\ + You can load custom themes by configuring `extra_syntaxes_and_themes` to include a list of folders containing '.tmTheme' files", self.highlight_theme) + } + } + + // Validate that all exported highlight themes exist as well + for theme in self.highlight_themes_css.iter() { + let theme_name = &theme.theme; + if !THEME_SET.themes.contains_key(theme_name) { + // Check extra themes + if let Some(extra) = &*self.extra_theme_set { + if !extra.themes.contains_key(theme_name) { + bail!("Can't export highlight theme {}, as it does not exist.\n\ + Make sure it's spelled correctly, or your custom .tmTheme' is defined properly.", theme_name) + } + } + } } - self.extra_syntax_set = Some(ss.build()); Ok(()) } @@ -110,8 +196,9 @@ impl Default for Markdown { external_links_no_follow: false, external_links_no_referrer: false, smart_punctuation: false, - extra_syntaxes: Vec::new(), + extra_syntaxes_and_themes: vec![], extra_syntax_set: None, + extra_theme_set: Arc::new(None), } } } diff --git a/components/config/src/config/mod.rs b/components/config/src/config/mod.rs index cc6b858c..e68c4ac9 100644 --- a/components/config/src/config/mod.rs +++ b/components/config/src/config/mod.rs @@ -12,7 +12,6 @@ use globset::{Glob, GlobSet, GlobSetBuilder}; use serde_derive::{Deserialize, Serialize}; use toml::Value as Toml; -use crate::highlighting::THEME_SET; use crate::theme::Theme; use errors::{bail, Error, Result}; use utils::fs::read_file; @@ -97,6 +96,7 @@ pub struct SerializedConfig<'a> { title: &'a Option, description: &'a Option, languages: HashMap<&'a String, &'a languages::LanguageOptions>, + default_language: &'a str, generate_feed: bool, feed_filename: &'a str, taxonomies: &'a [taxonomies::Taxonomy], @@ -105,6 +105,7 @@ pub struct SerializedConfig<'a> { } impl Config { + // any extra syntax and highlight themes have been loaded and validated already by the from_file method before parsing the config /// Parses a string containing TOML to our Config struct /// Any extra parameter will end up in the extra field pub fn parse(content: &str) -> Result { @@ -117,15 +118,6 @@ impl Config { bail!("A base URL is required in config.toml with key `base_url`"); } - if config.markdown.highlight_theme != "css" - && !THEME_SET.themes.contains_key(&config.markdown.highlight_theme) - { - bail!( - "Highlight theme {} defined in config does not exist.", - config.markdown.highlight_theme - ); - } - languages::validate_code(&config.default_language)?; for code in config.languages.keys() { languages::validate_code(code)?; @@ -165,7 +157,16 @@ impl Config { let path = path.as_ref(); let content = read_file(path).map_err(|e| errors::Error::chain("Failed to load config", e))?; - Config::parse(&content) + + let mut config = Config::parse(&content)?; + let config_dir = path + .parent() + .ok_or_else(|| Error::msg("Failed to find directory containing the config file."))?; + + // this is the step at which missing extra syntax and highlighting themes are raised as errors + config.markdown.init_extra_syntaxes_and_highlight_themes(config_dir)?; + + Ok(config) } /// Makes a url, taking into account that the base url might have a trailing slash @@ -291,6 +292,7 @@ impl Config { title: &options.title, description: &options.description, languages: self.languages.iter().filter(|(k, _)| k.as_str() != lang).collect(), + default_language: &self.default_language, generate_feed: options.generate_feed, feed_filename: &options.feed_filename, taxonomies: &options.taxonomies, @@ -330,7 +332,7 @@ pub fn merge(into: &mut Toml, from: &Toml) -> Result<()> { impl Default for Config { fn default() -> Config { - Config { + let mut conf = Config { base_url: DEFAULT_BASE_URL.to_string(), title: None, description: None, @@ -355,7 +357,9 @@ impl Default for Config { search: search::Search::default(), markdown: markup::Markdown::default(), extra: HashMap::new(), - } + }; + conf.add_default_language(); + conf } } @@ -675,4 +679,32 @@ output_dir = "docs" let config = Config::parse(config).unwrap(); assert_eq!(config.output_dir, "docs".to_string()); } + + // TODO: Tests for valid themes; need extra scaffolding (test site) for custom themes. + + #[test] + fn invalid_highlight_theme() { + let config = r#" +[markup] +highlight_code = true +highlight_theme = "asdf" + "#; + + let config = Config::parse(config); + assert_eq!(config.is_err(), true); + } + + #[test] + fn invalid_highlight_theme_css_export() { + let config = r#" +[markup] +highlight_code = true +highlight_themes_css = [ + { theme = "asdf", filename = "asdf.css" }, +] + "#; + + let config = Config::parse(config); + assert_eq!(config.is_err(), true); + } } diff --git a/components/config/src/highlighting.rs b/components/config/src/highlighting.rs index 08cbe85e..40e778a3 100644 --- a/components/config/src/highlighting.rs +++ b/components/config/src/highlighting.rs @@ -1,10 +1,12 @@ use lazy_static::lazy_static; use syntect::dumps::from_binary; use syntect::highlighting::{Theme, ThemeSet}; +use syntect::html::ClassStyle; use syntect::parsing::{SyntaxReference, SyntaxSet}; use crate::config::Config; -use syntect::html::{css_for_theme_with_class_style, ClassStyle}; + +pub const CLASS_STYLE: ClassStyle = ClassStyle::SpacedPrefixed { prefix: "z-" }; lazy_static! { pub static ref SYNTAX_SET: SyntaxSet = { @@ -16,8 +18,6 @@ lazy_static! { from_binary(include_bytes!("../../../sublime/themes/all.themedump")); } -pub const CLASS_STYLE: ClassStyle = ClassStyle::SpacedPrefixed { prefix: "z-" }; - #[derive(Clone, Debug, PartialEq, Eq)] pub enum HighlightSource { /// One of the built-in Zola syntaxes @@ -42,11 +42,7 @@ pub fn resolve_syntax_and_theme<'config>( language: Option<&'_ str>, config: &'config Config, ) -> SyntaxAndTheme<'config> { - let theme = if config.markdown.highlight_theme != "css" { - Some(&THEME_SET.themes[&config.markdown.highlight_theme]) - } else { - None - }; + let theme = config.markdown.get_highlight_theme(); if let Some(ref lang) = language { if let Some(ref extra_syntaxes) = config.markdown.extra_syntax_set { @@ -88,8 +84,3 @@ pub fn resolve_syntax_and_theme<'config>( } } } - -pub fn export_theme_css(theme_name: &str) -> String { - let theme = &THEME_SET.themes[theme_name]; - css_for_theme_with_class_style(theme, CLASS_STYLE) -} diff --git a/components/library/Cargo.toml b/components/library/Cargo.toml index bfaac903..d7122e0e 100644 --- a/components/library/Cargo.toml +++ b/components/library/Cargo.toml @@ -14,6 +14,7 @@ serde_derive = "1" regex = "1" lazy_static = "1" lexical-sort = "0.3" +walkdir = "2" front_matter = { path = "../front_matter" } config = { path = "../config" } diff --git a/components/library/src/content/mod.rs b/components/library/src/content/mod.rs index 161a1ab9..8a165974 100644 --- a/components/library/src/content/mod.rs +++ b/components/library/src/content/mod.rs @@ -3,9 +3,10 @@ mod page; mod section; mod ser; -use std::fs::read_dir; use std::path::{Path, PathBuf}; +use walkdir::WalkDir; + pub use self::file_info::FileInfo; pub use self::page::Page; pub use self::section::Section; @@ -29,10 +30,17 @@ pub fn has_anchor(headings: &[Heading], anchor: &str) -> bool { /// Looks into the current folder for the path and see if there's anything that is not a .md /// file. Those will be copied next to the rendered .html file -pub fn find_related_assets(path: &Path, config: &Config) -> Vec { +/// If `recursive` is set to `true`, it will add all subdirectories assets as well. This should +/// only be set when finding page assets currently. +/// TODO: remove this flag once sections with assets behave the same as pages with assets +pub fn find_related_assets(path: &Path, config: &Config, recursive: bool) -> Vec { let mut assets = vec![]; - for entry in read_dir(path).unwrap().filter_map(std::result::Result::ok) { + let mut builder = WalkDir::new(path); + if !recursive { + builder = builder.max_depth(1); + } + for entry in builder.into_iter().filter_map(std::result::Result::ok) { let entry_path = entry.path(); if entry_path.is_file() { match entry_path.extension() { @@ -46,18 +54,11 @@ pub fn find_related_assets(path: &Path, config: &Config) -> Vec { } if let Some(ref globset) = config.ignored_content_globset { - // `find_related_assets` only scans the immediate directory (it is not recursive) so our - // filtering only needs to work against the file_name component, not the full suffix. If - // `find_related_assets` was changed to also return files in subdirectories, we could - // use `PathBuf.strip_prefix` to remove the parent directory and then glob-filter - // against the remaining path. Note that the current behaviour effectively means that - // the `ignored_content` setting in the config file is limited to single-file glob - // patterns (no "**" patterns). assets = assets .into_iter() - .filter(|path| match path.file_name() { - None => false, - Some(file) => !globset.is_match(file), + .filter(|p| match p.strip_prefix(path) { + Err(_) => false, + Ok(file) => !globset.is_match(file), }) .collect(); } @@ -68,27 +69,58 @@ pub fn find_related_assets(path: &Path, config: &Config) -> Vec { #[cfg(test)] mod tests { use super::*; - use std::fs::File; + use std::fs::{create_dir, File}; use config::Config; use tempfile::tempdir; #[test] - fn can_find_related_assets() { + fn can_find_related_assets_recursive() { let tmp_dir = tempdir().expect("create temp dir"); - File::create(tmp_dir.path().join("index.md")).unwrap(); - File::create(tmp_dir.path().join("example.js")).unwrap(); - File::create(tmp_dir.path().join("graph.jpg")).unwrap(); - File::create(tmp_dir.path().join("fail.png")).unwrap(); + let path = tmp_dir.path(); + File::create(path.join("index.md")).unwrap(); + File::create(path.join("example.js")).unwrap(); + File::create(path.join("graph.jpg")).unwrap(); + File::create(path.join("fail.png")).unwrap(); + create_dir(path.join("subdir")).expect("create subdir temp dir"); + File::create(path.join("subdir").join("index.md")).unwrap(); + File::create(path.join("subdir").join("example.js")).unwrap(); - let assets = find_related_assets(tmp_dir.path(), &Config::default()); - assert_eq!(assets.len(), 3); - assert_eq!(assets.iter().filter(|p| p.extension().unwrap() != "md").count(), 3); - assert_eq!(assets.iter().filter(|p| p.file_name().unwrap() == "example.js").count(), 1); - assert_eq!(assets.iter().filter(|p| p.file_name().unwrap() == "graph.jpg").count(), 1); - assert_eq!(assets.iter().filter(|p| p.file_name().unwrap() == "fail.png").count(), 1); + let assets = find_related_assets(path, &Config::default(), true); + assert_eq!(assets.len(), 4); + assert_eq!(assets.iter().filter(|p| p.extension().unwrap() != "md").count(), 4); + + for asset in vec!["example.js", "graph.jpg", "fail.png", "subdir/example.js"] { + assert!(assets + .iter() + .find(|p| p.strip_prefix(path).unwrap() == Path::new(asset)) + .is_some()) + } } + #[test] + fn can_find_related_assets_non_recursive() { + let tmp_dir = tempdir().expect("create temp dir"); + let path = tmp_dir.path(); + File::create(path.join("index.md")).unwrap(); + File::create(path.join("example.js")).unwrap(); + File::create(path.join("graph.jpg")).unwrap(); + File::create(path.join("fail.png")).unwrap(); + create_dir(path.join("subdir")).expect("create subdir temp dir"); + File::create(path.join("subdir").join("index.md")).unwrap(); + File::create(path.join("subdir").join("example.js")).unwrap(); + + let assets = find_related_assets(path, &Config::default(), false); + assert_eq!(assets.len(), 3); + assert_eq!(assets.iter().filter(|p| p.extension().unwrap() != "md").count(), 3); + + for asset in vec!["example.js", "graph.jpg", "fail.png"] { + assert!(assets + .iter() + .find(|p| p.strip_prefix(path).unwrap() == Path::new(asset)) + .is_some()) + } + } #[test] fn can_find_anchor_at_root() { let input = vec![ diff --git a/components/library/src/content/page.rs b/components/library/src/content/page.rs index c8bcd0aa..64d9a82c 100644 --- a/components/library/src/content/page.rs +++ b/components/library/src/content/page.rs @@ -14,7 +14,7 @@ use front_matter::{split_page_content, InsertAnchor, PageFrontMatter}; use rendering::{render_content, Heading, RenderContext}; use utils::site::get_reading_analytics; use utils::slugs::slugify_paths; -use utils::templates::render_template; +use utils::templates::{render_template, ShortcodeDefinition}; use crate::content::file_info::FileInfo; use crate::content::ser::SerializingPage; @@ -208,7 +208,7 @@ impl Page { if page.file.name == "index" { let parent_dir = path.parent().unwrap(); - page.assets = find_related_assets(parent_dir, config); + page.assets = find_related_assets(parent_dir, config, true); page.serialized_assets = page.serialize_assets(base_path); } else { page.assets = vec![]; @@ -225,6 +225,7 @@ impl Page { tera: &Tera, config: &Config, anchor_insert: InsertAnchor, + shortcode_definitions: &HashMap, ) -> Result<()> { let mut context = RenderContext::new( tera, @@ -234,7 +235,8 @@ impl Page { permalinks, anchor_insert, ); - + context.set_shortcode_definitions(shortcode_definitions); + context.set_current_page_path(&self.file.relative); context.tera_context.insert("page", &SerializingPage::from_page_basic(self, None)); let res = render_content(&self.raw_content, &context).map_err(|e| { @@ -276,7 +278,7 @@ impl Page { fn serialize_assets(&self, base_path: &Path) -> Vec { self.assets .iter() - .filter_map(|asset| asset.file_name()) + .filter_map(|asset| asset.strip_prefix(&self.file.path.parent().unwrap()).ok()) .filter_map(|filename| filename.to_str()) .map(|filename| { let mut path = self.file.path.clone(); @@ -336,8 +338,14 @@ Hello world"#; let res = Page::parse(Path::new("post.md"), content, &config, &PathBuf::new()); assert!(res.is_ok()); let mut page = res.unwrap(); - page.render_markdown(&HashMap::default(), &Tera::default(), &config, InsertAnchor::None) - .unwrap(); + page.render_markdown( + &HashMap::default(), + &Tera::default(), + &config, + InsertAnchor::None, + &HashMap::new(), + ) + .unwrap(); assert_eq!(page.meta.title.unwrap(), "Hello".to_string()); assert_eq!(page.meta.slug.unwrap(), "hello-world".to_string()); @@ -502,8 +510,14 @@ Hello world let res = Page::parse(Path::new("hello.md"), &content, &config, &PathBuf::new()); assert!(res.is_ok()); let mut page = res.unwrap(); - page.render_markdown(&HashMap::default(), &Tera::default(), &config, InsertAnchor::None) - .unwrap(); + page.render_markdown( + &HashMap::default(), + &Tera::default(), + &config, + InsertAnchor::None, + &HashMap::new(), + ) + .unwrap(); assert_eq!(page.summary, Some("

Hello world

\n".to_string())); } @@ -526,8 +540,14 @@ And here's another. [^2] let res = Page::parse(Path::new("hello.md"), &content, &config, &PathBuf::new()); assert!(res.is_ok()); let mut page = res.unwrap(); - page.render_markdown(&HashMap::default(), &Tera::default(), &config, InsertAnchor::None) - .unwrap(); + page.render_markdown( + &HashMap::default(), + &Tera::default(), + &config, + InsertAnchor::None, + &HashMap::new(), + ) + .unwrap(); assert_eq!( page.summary, Some("

This page has footnotes, here\'s one.

\n".to_string()) diff --git a/components/library/src/content/section.rs b/components/library/src/content/section.rs index 5f9e93bf..d2fb636d 100644 --- a/components/library/src/content/section.rs +++ b/components/library/src/content/section.rs @@ -10,7 +10,7 @@ use front_matter::{split_section_content, SectionFrontMatter}; use rendering::{render_content, Heading, RenderContext}; use utils::fs::read_file; use utils::site::get_reading_analytics; -use utils::templates::render_template; +use utils::templates::{render_template, ShortcodeDefinition}; use crate::content::file_info::FileInfo; use crate::content::ser::SerializingSection; @@ -122,7 +122,7 @@ impl Section { let mut section = Section::parse(path, &content, config, base_path)?; let parent_dir = path.parent().unwrap(); - section.assets = find_related_assets(parent_dir, config); + section.assets = find_related_assets(parent_dir, config, false); section.serialized_assets = section.serialize_assets(); Ok(section) @@ -147,6 +147,7 @@ impl Section { permalinks: &HashMap, tera: &Tera, config: &Config, + shortcode_definitions: &HashMap, ) -> Result<()> { let mut context = RenderContext::new( tera, @@ -156,7 +157,8 @@ impl Section { permalinks, self.meta.insert_anchor_links, ); - + context.set_shortcode_definitions(shortcode_definitions); + context.set_current_page_path(&self.file.relative); context.tera_context.insert("section", &SerializingSection::from_section_basic(self, None)); let res = render_content(&self.raw_content, &context).map_err(|e| { @@ -195,7 +197,7 @@ impl Section { fn serialize_assets(&self) -> Vec { self.assets .iter() - .filter_map(|asset| asset.file_name()) + .filter_map(|asset| asset.strip_prefix(&self.file.path.parent().unwrap()).ok()) .filter_map(|filename| filename.to_str()) .map(|filename| format!("{}{}", self.path, filename)) .collect() diff --git a/components/library/src/pagination/mod.rs b/components/library/src/pagination/mod.rs index 26bc8a3e..899b20bb 100644 --- a/components/library/src/pagination/mod.rs +++ b/components/library/src/pagination/mod.rs @@ -6,7 +6,7 @@ use tera::{to_value, Context, Tera, Value}; use config::Config; use errors::{Error, Result}; -use utils::templates::render_template; +use utils::templates::{check_template_fallbacks, render_template}; use crate::content::{Section, SerializingPage, SerializingSection}; use crate::library::Library; @@ -94,8 +94,16 @@ impl<'a> Paginator<'a> { taxonomy: &'a Taxonomy, item: &'a TaxonomyItem, library: &'a Library, + tera: &Tera, + theme: &Option, ) -> Paginator<'a> { let paginate_by = taxonomy.kind.paginate_by.unwrap(); + // Check for taxon-specific template, or use generic as fallback. + let specific_template = format!("{}/single.html", taxonomy.kind.name); + let template = match check_template_fallbacks(&specific_template, tera, theme) { + Some(template) => template, + None => "taxonomy_single.html", + }; let mut paginator = Paginator { all_pages: Cow::Borrowed(&item.pages), pagers: Vec::with_capacity(item.pages.len() / paginate_by), @@ -110,7 +118,7 @@ impl<'a> Paginator<'a> { .clone() .unwrap_or_else(|| "page".to_string()), is_index: false, - template: format!("{}/single.html", taxonomy.kind.name), + template: template.to_string(), }; // taxonomy paginators have no sorting so we won't have to reverse @@ -249,7 +257,7 @@ impl<'a> Paginator<'a> { #[cfg(test)] mod tests { use std::path::PathBuf; - use tera::to_value; + use tera::{to_value, Tera}; use crate::content::{Page, Section}; use crate::library::Library; @@ -408,6 +416,7 @@ mod tests { #[test] fn test_can_create_paginator_for_taxonomy() { let (_, library) = create_library(false, 3, false); + let tera = Tera::default(); let taxonomy_def = TaxonomyConfig { name: "tags".to_string(), paginate_by: Some(2), @@ -427,7 +436,7 @@ mod tests { permalink: "/tags/".to_string(), items: vec![taxonomy_item.clone()], }; - let paginator = Paginator::from_taxonomy(&taxonomy, &taxonomy_item, &library); + let paginator = Paginator::from_taxonomy(&taxonomy, &taxonomy_item, &library, &tera, &None); assert_eq!(paginator.pagers.len(), 2); assert_eq!(paginator.pagers[0].index, 1); @@ -444,6 +453,7 @@ mod tests { #[test] fn test_can_create_paginator_for_slugified_taxonomy() { let (_, library) = create_library(false, 3, false); + let tera = Tera::default(); let taxonomy_def = TaxonomyConfig { name: "some tags".to_string(), paginate_by: Some(2), @@ -463,7 +473,7 @@ mod tests { permalink: "/some-tags/".to_string(), items: vec![taxonomy_item.clone()], }; - let paginator = Paginator::from_taxonomy(&taxonomy, &taxonomy_item, &library); + let paginator = Paginator::from_taxonomy(&taxonomy, &taxonomy_item, &library, &tera, &None); assert_eq!(paginator.pagers.len(), 2); assert_eq!(paginator.pagers[0].index, 1); diff --git a/components/library/src/taxonomies/mod.rs b/components/library/src/taxonomies/mod.rs index f2d96ad1..99ed14c5 100644 --- a/components/library/src/taxonomies/mod.rs +++ b/components/library/src/taxonomies/mod.rs @@ -7,7 +7,7 @@ use tera::{Context, Tera}; use config::{Config, Taxonomy as TaxonomyConfig}; use errors::{bail, Error, Result}; -use utils::templates::render_template; +use utils::templates::{check_template_fallbacks, render_template}; use crate::content::SerializingPage; use crate::library::Library; @@ -202,10 +202,16 @@ impl Taxonomy { ); context.insert("current_path", &format!("/{}/{}/", self.kind.name, item.slug)); - 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) - }) + // Check for taxon-specific template, or use generic as fallback. + let specific_template = format!("{}/single.html", self.kind.name); + let template = match check_template_fallbacks(&specific_template, tera, &config.theme) { + Some(template) => template, + None => "taxonomy_single.html", + }; + + render_template(&template, tera, context, &config.theme).map_err(|e| { + Error::chain(format!("Failed to render single term {} page.", self.kind.name), e) + }) } pub fn render_all_terms( @@ -224,10 +230,16 @@ impl Taxonomy { context.insert("current_url", &config.make_permalink(&self.kind.name)); context.insert("current_path", &format!("/{}/", self.kind.name)); - 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) - }) + // Check for taxon-specific template, or use generic as fallback. + let specific_template = format!("{}/list.html", self.kind.name); + let template = match check_template_fallbacks(&specific_template, tera, &config.theme) { + Some(template) => template, + None => "taxonomy_list.html", + }; + + render_template(&template, tera, context, &config.theme).map_err(|e| { + Error::chain(format!("Failed to render a list of {} page.", self.kind.name), e) + }) } pub fn to_serialized<'a>(&'a self, library: &'a Library) -> SerializedTaxonomy<'a> { diff --git a/components/rendering/benches/all.rs b/components/rendering/benches/all.rs index dcf080d0..2c30bfb3 100644 --- a/components/rendering/benches/all.rs +++ b/components/rendering/benches/all.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use config::Config; use front_matter::InsertAnchor; -use rendering::{render_content, render_shortcodes, RenderContext}; +use rendering::{render_content, RenderContext}; use tera::Tera; static CONTENT: &str = r#" @@ -85,12 +85,13 @@ fn bench_render_content_with_highlighting(b: &mut test::Bencher) { let mut tera = Tera::default(); tera.add_raw_template("shortcodes/youtube.html", "{{id}}").unwrap(); let permalinks_ctx = HashMap::new(); - let config = Config::default(); + let mut config = Config::default(); + config.markdown.highlight_code = true; let current_page_permalink = ""; let context = RenderContext::new( &tera, &config, - "", + &config.default_language, current_page_permalink, &permalinks_ctx, InsertAnchor::None, @@ -109,7 +110,7 @@ fn bench_render_content_without_highlighting(b: &mut test::Bencher) { let context = RenderContext::new( &tera, &config, - "", + &config.default_language, current_page_permalink, &permalinks_ctx, InsertAnchor::None, @@ -117,7 +118,6 @@ fn bench_render_content_without_highlighting(b: &mut test::Bencher) { b.iter(|| render_content(CONTENT, &context).unwrap()); } -#[bench] fn bench_render_content_no_shortcode(b: &mut test::Bencher) { let tera = Tera::default(); let content2 = CONTENT.replace(r#"{{ youtube(id="my_youtube_id") }}"#, ""); @@ -128,7 +128,7 @@ fn bench_render_content_no_shortcode(b: &mut test::Bencher) { let context = RenderContext::new( &tera, &config, - "", + &config.default_language, current_page_permalink, &permalinks_ctx, InsertAnchor::None, @@ -138,26 +138,7 @@ fn bench_render_content_no_shortcode(b: &mut test::Bencher) { } #[bench] -fn bench_render_shortcodes_one_present(b: &mut test::Bencher) { - let mut tera = Tera::default(); - tera.add_raw_template("shortcodes/youtube.html", "{{id}}").unwrap(); - let config = Config::default(); - let permalinks_ctx = HashMap::new(); - let current_page_permalink = ""; - let context = RenderContext::new( - &tera, - &config, - "", - current_page_permalink, - &permalinks_ctx, - InsertAnchor::None, - ); - - b.iter(|| render_shortcodes(CONTENT, &context)); -} - -#[bench] -fn bench_render_content_no_shortcode_with_emoji(b: &mut test::Bencher) { +fn bench_render_content_with_emoji(b: &mut test::Bencher) { let tera = Tera::default(); let content2 = CONTENT.replace(r#"{{ youtube(id="my_youtube_id") }}"#, ""); let mut config = Config::default(); @@ -168,7 +149,7 @@ fn bench_render_content_no_shortcode_with_emoji(b: &mut test::Bencher) { let context = RenderContext::new( &tera, &config, - "", + &config.default_language, current_page_permalink, &permalinks_ctx, InsertAnchor::None, diff --git a/components/rendering/src/codeblock/highlight.rs b/components/rendering/src/codeblock/highlight.rs index bdf4e8ff..1262e26f 100644 --- a/components/rendering/src/codeblock/highlight.rs +++ b/components/rendering/src/codeblock/highlight.rs @@ -26,7 +26,7 @@ pub(crate) struct ClassHighlighter<'config> { } impl<'config> ClassHighlighter<'config> { - pub fn new(syntax: &'config SyntaxReference, syntax_set: &'config SyntaxSet) -> Self { + pub fn new(syntax: &SyntaxReference, syntax_set: &'config SyntaxSet) -> Self { let parse_state = ParseState::new(syntax); Self { syntax_set, open_spans: 0, parse_state, scope_stack: ScopeStack::new() } } @@ -236,7 +236,7 @@ mod tests { let syntax_and_theme = resolve_syntax_and_theme(Some("py"), &config); let mut highlighter = SyntaxHighlighter::new(false, syntax_and_theme); let mut out = String::new(); - for line in LinesWithEndings::from(&code) { + for line in LinesWithEndings::from(code) { out.push_str(&highlighter.highlight_line(line)); } assert!(!out.contains("