summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
commit2ff14448863ac1a1dd9533461708e29aae170c2d (patch)
tree85b9fea2bbfe3f06473cfa381eed11f273b57c5c /vendor/handlebars
parentAdding debian version 1.64.0+dfsg1-1. (diff)
downloadrustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz
rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/handlebars')
-rw-r--r--vendor/handlebars/.cargo-checksum.json2
-rw-r--r--vendor/handlebars/CHANGELOG.md75
-rw-r--r--vendor/handlebars/Cargo.lock1368
-rw-r--r--vendor/handlebars/Cargo.toml89
-rw-r--r--vendor/handlebars/README.md26
-rw-r--r--vendor/handlebars/examples/dev_mode.rs24
-rw-r--r--vendor/handlebars/examples/error.rs52
-rw-r--r--vendor/handlebars/examples/helper_macro.rs63
-rw-r--r--vendor/handlebars/examples/partials.rs19
-rw-r--r--vendor/handlebars/examples/script.rs7
-rw-r--r--vendor/handlebars/release.toml2
-rw-r--r--vendor/handlebars/src/context.rs19
-rw-r--r--vendor/handlebars/src/decorators/mod.rs12
-rw-r--r--vendor/handlebars/src/error.rs98
-rw-r--r--vendor/handlebars/src/grammar.pest27
-rw-r--r--vendor/handlebars/src/grammar.rs29
-rw-r--r--vendor/handlebars/src/helpers/helper_each.rs94
-rw-r--r--vendor/handlebars/src/helpers/helper_if.rs40
-rw-r--r--vendor/handlebars/src/helpers/helper_lookup.rs12
-rw-r--r--vendor/handlebars/src/helpers/helper_with.rs15
-rw-r--r--vendor/handlebars/src/helpers/mod.rs3
-rw-r--r--vendor/handlebars/src/helpers/scripting.rs14
-rw-r--r--vendor/handlebars/src/json/path.rs4
-rw-r--r--vendor/handlebars/src/lib.rs21
-rw-r--r--vendor/handlebars/src/macros.rs7
-rw-r--r--vendor/handlebars/src/output.rs6
-rw-r--r--vendor/handlebars/src/partial.rs363
-rw-r--r--vendor/handlebars/src/registry.rs272
-rw-r--r--vendor/handlebars/src/render.rs93
-rw-r--r--vendor/handlebars/src/support.rs58
-rw-r--r--vendor/handlebars/src/template.rs233
-rw-r--r--vendor/handlebars/tests/embed.rs29
-rw-r--r--vendor/handlebars/tests/escape.rs42
-rw-r--r--vendor/handlebars/tests/helper_macro.rs13
-rw-r--r--vendor/handlebars/tests/helper_with_space.rs54
-rw-r--r--vendor/handlebars/tests/templates/hello.hbs1
-rw-r--r--vendor/handlebars/tests/whitespace.rs24
37 files changed, 1932 insertions, 1378 deletions
diff --git a/vendor/handlebars/.cargo-checksum.json b/vendor/handlebars/.cargo-checksum.json
index d41808a41..b1031c230 100644
--- a/vendor/handlebars/.cargo-checksum.json
+++ b/vendor/handlebars/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"ab776bc63c83489640577a611f7df181de9a3191bf6e5fb449012fd5f6b5e770","Cargo.lock":"fb81e47543e26596ba74d5c165e26f70ec1532911dd638dc6bee65e572b09182","Cargo.toml":"5c6beb2539b6d5e038a5beeead3ed4c044b9be7fdcd4fab60b5a16ce31121bdf","LICENSE":"63b308fad3db82dc12067a8d7ff4b672fae97d12d0b4b3bb59179e27d640b3a4","README.md":"e9dfd89edf514c3613b5b2f47c05f2ba48bf1c9afee8eca1ba395887c8a85c9d","benches/bench.rs":"276ac8c581db35dbdc00e9e4cc1e2e1940fe95522a8f5a19ab088a2c68da61ed","build-wasm.sh":"9f7226d7d0768fe0fba97f698642a4c13a600468ba7d57abcfad9285efd9f4ce","examples/decorator.rs":"010762d337c64a8ade120c66ccb97ac176653d2fc1265c6f77c35d2a7693176f","examples/decorator/template.hbs":"76fd24f08b28b469529f4727321c7cc940198abb5c1aa24d7a6dd2ab42bdda66","examples/dev_mode.rs":"8e28b0f354e14006481faba76f32401a18476472b2e4c9faeea54f222980a9ba","examples/dev_mode/template.hbs":"4a5e1b81565572e26986d890e4a431953b81893a99ce07cef303e366dd84243c","examples/error.rs":"85219ee57a7bc739185862d04c7eff203743ddf730b940f92492894e3ebb5746","examples/error/error.hbs":"4e8fac806d444a5bc41436fe0a51b4d7850c7645f8996db7a99a821c88622eef","examples/error/template.hbs":"48313b522ddb0dd4285874b96d1b705b841dc141514f440790e904a262955951","examples/partials.rs":"e102f0bdacb80a08ac9ae3c92c415991095a1a2142d55420457706823a67fba0","examples/partials/base0.hbs":"6674275ef68faaeab8a4128da0983c9d732d7552f1791c2e3563fa8c5c66fb5a","examples/partials/base1.hbs":"97b1089705f5a21a6f344190e26133d920d56d4a7fdc1fa2fb7359a720bfe182","examples/partials/template2.hbs":"6f83bc48b774a3b83f9ce5a54bf014fb03514720f9e32834dc68000d06a17618","examples/quick.rs":"96df03fc1742504afae34c6da9da05206adc41f771406da2825b41725329cb2d","examples/render.rs":"eadc1aff65d96c7f95c948fbccfb79981276075f83e19a22214fe0772ef17496","examples/render/template.hbs":"2512ef3362379633790985fe2c40e7efab3ad0f431b7cbec5b7cc644dbbef8f5","examples/render_cli/simple.hbs":"a2e0df51e7c1a25c4e9e1bbe0f4911c7c86200d358fc6c9195b61e89adddc970","examples/render_file.rs":"f5b8e788ac6a71a170c5b315120e8779896df8d9b290fb3d785f51307f5d3c45","examples/render_file/template.hbs":"8ec8d0b61a996391ad7f8b6a914f84d0ac06c62e6d7c9c5fa054ca5e2c64a52e","examples/script.rs":"df869a15d6cd8c478f74582018c54e20545b9451e84cdec2f8bb71c31a618da0","examples/script/goals.rhai":"d756fd7d39f11fae148a6e11d23160da0cdac91c29f716dcb854c07a7db09c80","examples/script/template.hbs":"1f39785157a112bc5c4e94db1361c45a73b024bc8bd0fea0a9d5da8102afb310","profile.sh":"b8e80c59bc12fca93daa67c09001c1c045e594e532831cc957c9ac313f8b2390","release.toml":"968ff7e0a0f8b99d0b91a06cb007fcee55427ccbd05012b46202829336287151","rustfmt.toml":"8e99dabd6aadb112f9f9ed8709e7388b57bf43d19cd08342c093c870534a3f97","src/block.rs":"da38a572a95c3858685e4af82a7e1920c6b3311acf8c118c53c8531b091de391","src/cli.rs":"63aed9a8fb2135ee03bd2b49330be20d2018fe3c36265c14dbdc0da9b73cb6d0","src/context.rs":"5007324a0655daa994e1b64f0eed160e67e4a4d8fb02d21eca4c549d5dcea7c2","src/decorators/inline.rs":"73b8ba6ed98dbf8b3bca228796f47c9139d49f1a1c8d5b4603cc6354098b56c2","src/decorators/mod.rs":"322d4d692331a1e3a2806780cbe1e7a3a82b343486f1182d2e8a017a8bf11085","src/error.rs":"7da2635fdb0005437d8c4a7cb889336d0039665d7627544f600d473f5b90eab8","src/grammar.pest":"aed7ff83953551d48e4e94edc25d51f7e418ec79b62df1ca8f7e728444430d0b","src/grammar.rs":"848d1b56bc1d887e8c42836c37d41b2a634ec6eb9e3880be7dde31d84a38460d","src/helpers/block_util.rs":"11a295215f9c0d14b89f97161468425405386214f050bad07683669a162f9aa1","src/helpers/helper_each.rs":"75b536114f954287936e9f02a54b0c182144e2e6a4ad0970e66cc644cc8f3a0f","src/helpers/helper_extras.rs":"0575a1518eba51cafe91ec2b09666e1c987c9a9bc98cb00193d1e0d203a8b681","src/helpers/helper_if.rs":"37c81b7000948f601398b7163b37397020d191642021077bd7eb15c181632d32","src/helpers/helper_log.rs":"272f7c1f873b97974cce156c04281f2bd8c44ccc885b4c59dd2b43e8d7cc6ef6","src/helpers/helper_lookup.rs":"a9f000e36d0e9339930b3d94dabd4f123cdbdaa85e8d77d15e4a772a99ffe9d4","src/helpers/helper_raw.rs":"6b0b5b3774a1d5c3ebf30b1e0b8cac825f6ffb8a18cb9e08bd40786258e4b597","src/helpers/helper_with.rs":"9964ec02b56ad8fb6f3aa9abb535c0d3f6f2cf3eaeba59a5afd8687ea6df2209","src/helpers/mod.rs":"31eefbd1f302b852e43a3aa8432ce4faad04db37eba7fc1bfa8cf9c25967b899","src/helpers/scripting.rs":"6b9e7e08bdbf3e2716bb82b69e0f10efd4de1174842742215aba18fb2cc507e2","src/json/mod.rs":"ef2fc8fe98e9761e2e2a4b2d2293bb29cdb689db2f44f939fc61c48c6b52f0a7","src/json/path.rs":"818bc5f002839a529ffe5d5f8eddd815ac3808a5f9ce3bac79f1f71f5702599b","src/json/value.rs":"390ea4fa8b5131a3d00ff1c80d06359220f16d851a5e836192026ea32acbb02e","src/lib.rs":"ecbb4099b2c0cc77e746083181a8ed32b7f76671aa8e54d079eb4196b24d167c","src/local_vars.rs":"91d3a16bbfabe2eccecaa9a0dd866ebe88d70ce438d2f18581d1b7d231ba0644","src/macros.rs":"86eed922319644176e8464023455b78440b8e5d0d9b13a0ce61b2edf0f10984e","src/output.rs":"10c28874f78cddba70b24eb984a849c7750b207ac605f2aa46f2abe02846b3a2","src/partial.rs":"ddcd49436b6c653b3e5db44a997c5cd9006755dd1e6c07aa5996fa495aecd382","src/registry.rs":"56d613a72ca9e4ad15953cf5b74bf6df912e81f8f008780bebe93375fb1569ed","src/render.rs":"cec805cd1396bc87f1c2bcd9d45b8c6236a65cb99c6d45f14199fab99b94d38d","src/sources.rs":"46989eb76f36edff9dcb5d27488e8bd9c7ff1749f368a70e855f4808c58d7bcf","src/support.rs":"b3d1d99440182548ff9bfcffbd9a7e08507f740ed68382f9c74ab0a92a79eab7","src/template.rs":"61625e52f43c9df92fce25f626db6c61b31a42310c06a8158b13b9f960339e12","src/util.rs":"2ebc845de5ca47455442a1b6bd664565a52e29928e82c526fbfe56ed5196410f","tests/block_context.rs":"4dce11312d2b6c0c5c2f3104516e5567e5a370611e08f4055fa3653293580385","tests/data_helper.rs":"a7f9d1d42d5415ba1dba459840067acc1294f6f6057d9a5a13d9f7e19469e850","tests/escape.rs":"a4bd25c4268a306dc09dc17806f86895c4932753a585219902f0dd85c7e65cba","tests/helper_function_lifetime.rs":"635cbd0b44742539bdf36e803a19c6a1a698399f8b765415d53f28df1acfbc2b","tests/helper_macro.rs":"4660cfb782c03e70f536bedbb2ed5afed5e8fe841d77c1812e4b2ef55d81a6a6","tests/helper_with_space.rs":"c64952ea031f964e558cb323df1bf731bb7c0bf7b226142cea61afa2fd4efbfd","tests/root_var.rs":"fda5b30bac1e692fb010f9f98e052d5a525420fece9dcc3821a4e5aeee3a8841","tests/subexpression.rs":"b36ab31adf45272ca984c0c5ed9497820ca072a8805444d69bd089b766786bb5","tests/template_names.rs":"4bbe6b48c974ae7ea1e61806794d846e2f0e8505e1568c5305fa2364dceef68a","wasm/LICENSE":"63b308fad3db82dc12067a8d7ff4b672fae97d12d0b4b3bb59179e27d640b3a4","wasm/README.md":"d67bad452550d34e9317fb8f4884b8bc07939fbb0dfdcf1be6bfce52a6851fa6","wasm/wapm.toml":"bdb286ccaa18c5c8aa0d2db25755aba9b0e3e83a59fc4d2334c1854933000ea1"},"package":"72a0ffab8c36d0436114310c7e10b59b3307e650ddfabf6d006028e29a70c6e6"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"1c33d57ecdf48bcc7011c1e7306d05359a3fca61f3c48324e5cb5b378d406ef6","Cargo.lock":"81ba21eaf5647124881eacf240b9c34ae15c4f3b56072d7ff3ec665f269c3843","Cargo.toml":"afbdf3fe79ae8e5a434f6cb126f3441e8750a499f2b159226cd86e48e4d5424e","LICENSE":"63b308fad3db82dc12067a8d7ff4b672fae97d12d0b4b3bb59179e27d640b3a4","README.md":"ae8924a77607ab2439ef2cb87a93c49b51a4da228ea144bc847ec6d2a4acffba","benches/bench.rs":"276ac8c581db35dbdc00e9e4cc1e2e1940fe95522a8f5a19ab088a2c68da61ed","build-wasm.sh":"9f7226d7d0768fe0fba97f698642a4c13a600468ba7d57abcfad9285efd9f4ce","examples/decorator.rs":"010762d337c64a8ade120c66ccb97ac176653d2fc1265c6f77c35d2a7693176f","examples/decorator/template.hbs":"76fd24f08b28b469529f4727321c7cc940198abb5c1aa24d7a6dd2ab42bdda66","examples/dev_mode.rs":"7c8cebbc56da3e834688719f5c10df1c372c059259e40df8534c79a0dda01aab","examples/dev_mode/template.hbs":"4a5e1b81565572e26986d890e4a431953b81893a99ce07cef303e366dd84243c","examples/error.rs":"6f3d4dc945628778d3ef63dccdc7abbf367e214a5ff62a5dcbeb11d8f34317d7","examples/error/error.hbs":"4e8fac806d444a5bc41436fe0a51b4d7850c7645f8996db7a99a821c88622eef","examples/error/template.hbs":"48313b522ddb0dd4285874b96d1b705b841dc141514f440790e904a262955951","examples/helper_macro.rs":"ca0c7b7a45e8f3f8c7fe25d59a5bb3189b067189dab642bfb02dda416f20774d","examples/partials.rs":"0b3ee03668338b9900705b1162ac1f602255d4b691d1827cb603efff318d3166","examples/partials/base0.hbs":"6674275ef68faaeab8a4128da0983c9d732d7552f1791c2e3563fa8c5c66fb5a","examples/partials/base1.hbs":"97b1089705f5a21a6f344190e26133d920d56d4a7fdc1fa2fb7359a720bfe182","examples/partials/template2.hbs":"6f83bc48b774a3b83f9ce5a54bf014fb03514720f9e32834dc68000d06a17618","examples/quick.rs":"96df03fc1742504afae34c6da9da05206adc41f771406da2825b41725329cb2d","examples/render.rs":"eadc1aff65d96c7f95c948fbccfb79981276075f83e19a22214fe0772ef17496","examples/render/template.hbs":"2512ef3362379633790985fe2c40e7efab3ad0f431b7cbec5b7cc644dbbef8f5","examples/render_cli/simple.hbs":"a2e0df51e7c1a25c4e9e1bbe0f4911c7c86200d358fc6c9195b61e89adddc970","examples/render_file.rs":"f5b8e788ac6a71a170c5b315120e8779896df8d9b290fb3d785f51307f5d3c45","examples/render_file/template.hbs":"8ec8d0b61a996391ad7f8b6a914f84d0ac06c62e6d7c9c5fa054ca5e2c64a52e","examples/script.rs":"5e16423dc4c8ae0e383f0d8b9e1a652850fa5e48dbc57cca3757661c3e0476bb","examples/script/goals.rhai":"d756fd7d39f11fae148a6e11d23160da0cdac91c29f716dcb854c07a7db09c80","examples/script/template.hbs":"1f39785157a112bc5c4e94db1361c45a73b024bc8bd0fea0a9d5da8102afb310","profile.sh":"b8e80c59bc12fca93daa67c09001c1c045e594e532831cc957c9ac313f8b2390","release.toml":"d1c1f8e31be9268666c07a2c3f244e73c3db7474a2a64218fac71f7ad1f20b5d","rustfmt.toml":"8e99dabd6aadb112f9f9ed8709e7388b57bf43d19cd08342c093c870534a3f97","src/block.rs":"da38a572a95c3858685e4af82a7e1920c6b3311acf8c118c53c8531b091de391","src/cli.rs":"63aed9a8fb2135ee03bd2b49330be20d2018fe3c36265c14dbdc0da9b73cb6d0","src/context.rs":"6d594b5c93cdc1e8ee08c3858f50dddc312eaa20b9ea3f4c14906bc6ebee318f","src/decorators/inline.rs":"73b8ba6ed98dbf8b3bca228796f47c9139d49f1a1c8d5b4603cc6354098b56c2","src/decorators/mod.rs":"a9189648fd11609fc6681d6df4af0deb1a1958e12c447485a0455d7e67f70fa3","src/error.rs":"a101458e111478fd6c3749910ca7af8afa973d51eb9a4bd13569e66d0aa8ae8f","src/grammar.pest":"a6754e1b61ba282f325af30f907e9e175ad21f0bec322d42e6f975a6f3bf2c7e","src/grammar.rs":"d572c6507f673c1e5c7c018f485672e6c10671d6749d0d9182f26d62e2e1537e","src/helpers/block_util.rs":"11a295215f9c0d14b89f97161468425405386214f050bad07683669a162f9aa1","src/helpers/helper_each.rs":"827de9ba0224cdd361ce52f02a9f301e879d738d6837672798517b83db68b331","src/helpers/helper_extras.rs":"0575a1518eba51cafe91ec2b09666e1c987c9a9bc98cb00193d1e0d203a8b681","src/helpers/helper_if.rs":"2fe6cc5f3b44a42611d02137e5a11466850d44b6a41a803e7a9268f3a545e487","src/helpers/helper_log.rs":"272f7c1f873b97974cce156c04281f2bd8c44ccc885b4c59dd2b43e8d7cc6ef6","src/helpers/helper_lookup.rs":"34e57dbe6a4c65afa8978d32db1b9adfb783990ec951b4833a9986a86cb38ff1","src/helpers/helper_raw.rs":"6b0b5b3774a1d5c3ebf30b1e0b8cac825f6ffb8a18cb9e08bd40786258e4b597","src/helpers/helper_with.rs":"554373544f1aff16799cde954e37a945e26b452414436f612e12b538ec8e1893","src/helpers/mod.rs":"f8c24abb40739935225acdfad97f4bc808eb1fec77d09fda1ff5779b632b7650","src/helpers/scripting.rs":"3716d77e6e11993741885a15dcddaedc11e076f0b5e9a0b844416d3fbb0a834c","src/json/mod.rs":"ef2fc8fe98e9761e2e2a4b2d2293bb29cdb689db2f44f939fc61c48c6b52f0a7","src/json/path.rs":"49b821765da4aa305e51478527898ad4038c3952c7f07c639e8b71a59732e34a","src/json/value.rs":"390ea4fa8b5131a3d00ff1c80d06359220f16d851a5e836192026ea32acbb02e","src/lib.rs":"9374528d680b4cefdfcef945529a5f9c6b03b22ba09503135cc18914ff621d56","src/local_vars.rs":"91d3a16bbfabe2eccecaa9a0dd866ebe88d70ce438d2f18581d1b7d231ba0644","src/macros.rs":"0e2d174bb155da5df279ba15ef65b92519ca890949acc8231c72196bc8364a7c","src/output.rs":"f85acedeb124a1d344c5f73b309bd32d925de5dbed701b5fdebcadbd42f3c7ad","src/partial.rs":"6362967d77d29eea5ba7000ec741774288f08afe7c685e9d28b801b603599401","src/registry.rs":"388ebf2e28734963cd04f6622109e009ab22f7377236f6042aa5441875b22cef","src/render.rs":"17594a82a37295d4887945f18dc12eebe261094078e699b53ff6b7e193fcf986","src/sources.rs":"46989eb76f36edff9dcb5d27488e8bd9c7ff1749f368a70e855f4808c58d7bcf","src/support.rs":"f9328a0674984fcc3c6e93e8a43ec63bf9b502176283f60a2d6ceb15ca34840a","src/template.rs":"5e275cd2adb00e4238607e5e6d7e7db209a1233b813df77e30ccc5df1991bc01","src/util.rs":"2ebc845de5ca47455442a1b6bd664565a52e29928e82c526fbfe56ed5196410f","tests/block_context.rs":"4dce11312d2b6c0c5c2f3104516e5567e5a370611e08f4055fa3653293580385","tests/data_helper.rs":"a7f9d1d42d5415ba1dba459840067acc1294f6f6057d9a5a13d9f7e19469e850","tests/embed.rs":"de85f16a7a0372cc0e150abe3487ae8180598532e4d73b05b4b107e7e4a0b05e","tests/escape.rs":"7b643675b7884a497d7008cda6e51809efea94a79d25996564b7771cfdbf1709","tests/helper_function_lifetime.rs":"635cbd0b44742539bdf36e803a19c6a1a698399f8b765415d53f28df1acfbc2b","tests/helper_macro.rs":"959cc218fa47c8b30835412c5b6b4f76c8387de49e9e2c73baa9a788f9564361","tests/helper_with_space.rs":"0aee174428b799998a9994b008485373a1b084bf4ea49ed455c890eb627f1ac1","tests/root_var.rs":"fda5b30bac1e692fb010f9f98e052d5a525420fece9dcc3821a4e5aeee3a8841","tests/subexpression.rs":"b36ab31adf45272ca984c0c5ed9497820ca072a8805444d69bd089b766786bb5","tests/template_names.rs":"4bbe6b48c974ae7ea1e61806794d846e2f0e8505e1568c5305fa2364dceef68a","tests/templates/hello.hbs":"4aca52692d2247a22c46856dbfd439a5c4edc47237e488ece5d01e9d8030e882","tests/whitespace.rs":"1cadfbe9cd8e2dd4ca7759fdcaf7fd05116b5e9ec59ca67722c41732fe89dfa3","wasm/LICENSE":"63b308fad3db82dc12067a8d7ff4b672fae97d12d0b4b3bb59179e27d640b3a4","wasm/README.md":"d67bad452550d34e9317fb8f4884b8bc07939fbb0dfdcf1be6bfce52a6851fa6","wasm/wapm.toml":"bdb286ccaa18c5c8aa0d2db25755aba9b0e3e83a59fc4d2334c1854933000ea1"},"package":"360d9740069b2f6cbb63ce2dbaa71a20d3185350cbb990d7bebeb9318415eb17"} \ No newline at end of file
diff --git a/vendor/handlebars/CHANGELOG.md b/vendor/handlebars/CHANGELOG.md
index 62045f53e..c3b79a657 100644
--- a/vendor/handlebars/CHANGELOG.md
+++ b/vendor/handlebars/CHANGELOG.md
@@ -1,5 +1,80 @@
# Change Log
+## [4.3.3](https://github.com/sunng87/handlebars-rust/compare/4.3.2...4.3.3) - 2022-07-20
+
+* [Fixed] Disable partial expression indentation with `{{~> partial}}` to
+ bring behavior closer in line with original javascript version. [#518]
+* [Fixed] Support for using partial context together with partial parameters
+ [#520]
+
+## [4.3.2](https://github.com/sunng87/handlebars-rust/compare/4.3.1...4.3.2) - 2022-07-14
+
+* [Added] Render functions that reuse `Context` for custom `std::io::Write`:
+ `render_with_context_to_write` and `render_template_with_context_to_write`
+
+## [4.3.1](https://github.com/sunng87/handlebars-rust/compare/4.3.0...4.3.1) - 2022-06-09
+
+* [Added] Added support for `{{~{variable}~}}` syntax [#509]
+
+## [4.3.0](https://github.com/sunng87/handlebars-rust/compare/4.2.2...4.3.0) - 2022-05-18
+
+* [Changed] update MSRV to 1.57 as rhai requires
+* [Fixed] Reimplemented indent support for partial expression `{{>
+ partial}}`, which is introduced in 4.2.0. The new implementation is
+ aligned with original javascript version, that every text line
+ generated from partial are indented as `{{> partial}}`
+ does. `prevent_indent` will turn-off this feature. [#505]
+* [Changed] changed error support library from quick_error to
+ thiserror
+
+## [4.2.2](https://github.com/sunng87/handlebars-rust/compare/4.2.1...4.2.2) - 2022-03-09
+
+* [Fixed] Block param scope leaked into partials [#496]
+* [Changed] Use Rust 2021 edition and update MSRV to 1.56
+
+## [4.2.1](https://github.com/sunng87/handlebars-rust/compare/4.2.0...4.2.1) - 2022-01-17
+
+* [Fixed] Nested partial `@partial-block` referencing issue [#488]
+* [Fixed] Docs generation on docs.rs for `rust-embed` feature
+
+## [4.2.0](https://github.com/sunng87/handlebars-rust/compare/4.1.6...4.2.0) - 2022-01-05
+
+* [Added] RustEmbed support for loading templates from [#484]
+* [Fixed] Parser support for variables begins with digit [#479]
+* [Changed] Keep indent whitespaces for partial expression `{{>
+ partial}}` as default in handlebarsjs. A new option `prevent_indent`
+ is provided on `Handlebars` to turn off this behaviour. [#486]
+* [Changed] Update MSRV to 1.51 due to dependency changes
+
+## [4.1.6](https://github.com/sunng87/handlebars-rust/compare/4.1.5...4.1.6) - 2021-12-03
+
+* [Added] Create `Context` from owned `serde_json::Value` [#477]
+
+## [4.1.5](https://github.com/sunng87/handlebars-rust/compare/4.1.4...4.1.5) - 2021-11-17
+
+* [Fixed] Single-quote string literal is supported, again [#475]
+
+## [4.1.4](https://github.com/sunng87/handlebars-rust/compare/4.1.3...4.1.4) - 2021-11-06
+
+* [Fixed] Corrected empty line stripping strategy [#473]
+
+## [4.1.3](https://github.com/sunng87/handlebars-rust/compare/4.1.2...4.1.3) - 2021-09-10
+
+* [Added] `@last` variable for `each` block with object [#466]
+* [Fixed] Missing whitespaces behind expression [#468]
+
+## [4.1.2](https://github.com/sunng87/handlebars-rust/compare/4.1.1...4.1.2) - 2021-08-11
+
+* [Added] Support for generic types in `handlebars_helper!`.
+* [Added] Getter and setter for rhai `Engine` from registry.
+* [Fixed] Improve doc for `dev_mode` that it has to be enabled before
+ adding templates.
+
+## [4.1.1](https://github.com/sunng87/handlebars-rust/compare/4.1.0...4.1.1) - 2021-07-31
+
+* [Changed] Update rhai to 1.0 [#455]
+* [Fixed] Empty line stripping for partial include statement, and other corner cases [#458]
+
## [4.1.0](https://github.com/sunng87/handlebars-rust/compare/4.0.1...4.1.0) - 2021-07-05
* [Added] export `StringOutput` as requested in #442
diff --git a/vendor/handlebars/Cargo.lock b/vendor/handlebars/Cargo.lock
index 8fc6db06f..27cc86f9b 100644
--- a/vendor/handlebars/Cargo.lock
+++ b/vendor/handlebars/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
-version = "0.15.2"
+version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a"
+checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
dependencies = [
"gimli",
]
@@ -19,22 +19,11 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "796540673305a66d127804eef19ad696f1f204b8c1025aaca4958c17eab32877"
-dependencies = [
- "getrandom 0.2.3",
- "once_cell",
- "version_check",
-]
-
-[[package]]
-name = "ahash"
-version = "0.7.4"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98"
+checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
- "getrandom 0.2.3",
+ "getrandom",
"once_cell",
"version_check",
]
@@ -50,9 +39,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.41"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61"
+checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc"
[[package]]
name = "arrayvec"
@@ -64,6 +53,12 @@ dependencies = [
]
[[package]]
+name = "ascii"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbf56136a5198c7b01a49e3afcbef6cf84597273d298f54432926024107b0109"
+
+[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -76,19 +71,19 @@ dependencies = [
[[package]]
name = "autocfg"
-version = "1.0.1"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
-version = "0.3.60"
+version = "0.3.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282"
+checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61"
dependencies = [
"addr2line",
"cc",
- "cfg-if 1.0.0",
+ "cfg-if",
"libc",
"miniz_oxide",
"object",
@@ -96,16 +91,10 @@ dependencies = [
]
[[package]]
-name = "base64"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
-
-[[package]]
name = "bitflags"
-version = "1.2.1"
+version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
@@ -125,7 +114,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
- "generic-array 0.14.4",
+ "generic-array 0.14.5",
]
[[package]]
@@ -139,9 +128,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",
@@ -150,20 +139,10 @@ dependencies = [
]
[[package]]
-name = "buf_redux"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f"
-dependencies = [
- "memchr",
- "safemem",
-]
-
-[[package]]
name = "bumpalo"
-version = "3.7.0"
+version = "3.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631"
+checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
[[package]]
name = "byte-tools"
@@ -173,9 +152,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "bytemuck"
-version = "1.7.0"
+version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9966d2ab714d0f785dbac0a0396251a35280aeb42413281617d0209ab4898435"
+checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc"
[[package]]
name = "byteorder"
@@ -185,48 +164,42 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
-
-[[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 = "cast"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57cdfa5d50aad6cb4d44dcab6101a7f79925bd59d82ca42f38a9856a28865374"
+checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a"
dependencies = [
"rustc_version",
]
[[package]]
name = "cc"
-version = "1.0.68"
+version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
+checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
-version = "0.1.10"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
-name = "cfg-if"
-version = "1.0.0"
+name = "chunked_transfer"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e"
[[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 = [
"bitflags",
"textwrap",
@@ -234,36 +207,44 @@ dependencies = [
]
[[package]]
+name = "cmake"
+version = "0.1.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
+dependencies = [
+ "cc",
+]
+
+[[package]]
name = "cpp_demangle"
-version = "0.3.2"
+version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390"
+checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f"
dependencies = [
- "cfg-if 1.0.0",
- "glob",
+ "cfg-if",
]
[[package]]
name = "cpufeatures"
-version = "0.1.4"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8"
+checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b"
dependencies = [
"libc",
]
[[package]]
name = "criterion"
-version = "0.3.4"
+version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23"
+checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10"
dependencies = [
"atty",
"cast",
"clap",
"criterion-plot",
"csv",
- "itertools 0.10.1",
+ "itertools",
"lazy_static",
"num-traits",
"oorandom",
@@ -280,42 +261,43 @@ dependencies = [
[[package]]
name = "criterion-plot"
-version = "0.4.3"
+version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d"
+checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57"
dependencies = [
"cast",
- "itertools 0.9.0",
+ "itertools",
]
[[package]]
name = "crossbeam-channel"
-version = "0.5.1"
+version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
+checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
-version = "0.8.0"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
+checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
-version = "0.9.5"
+version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
+checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c"
dependencies = [
- "cfg-if 1.0.0",
+ "autocfg",
+ "cfg-if",
"crossbeam-utils",
"lazy_static",
"memoffset",
@@ -324,11 +306,11 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.5"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
+checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"lazy_static",
]
@@ -340,7 +322,7 @@ checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
dependencies = [
"bstr",
"csv-core",
- "itoa",
+ "itoa 0.4.8",
"ryu",
"serde",
]
@@ -356,9 +338,9 @@ dependencies = [
[[package]]
name = "debugid"
-version = "0.7.2"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91cf5a8c2f2097e2a32627123508635d47ce10563d999ec1a95addf08b502ba"
+checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d"
dependencies = [
"uuid",
]
@@ -378,7 +360,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
- "generic-array 0.14.4",
+ "generic-array 0.14.5",
]
[[package]]
@@ -389,9 +371,9 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "env_logger"
-version = "0.8.4"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
+checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
dependencies = [
"atty",
"humantime",
@@ -407,88 +389,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
-name = "fixedbitset"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
-
-[[package]]
-name = "fnv"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-
-[[package]]
-name = "form_urlencoded"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
-dependencies = [
- "matches",
- "percent-encoding",
-]
-
-[[package]]
-name = "futures"
-version = "0.3.15"
+name = "fastrand"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27"
+checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
dependencies = [
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
+ "instant",
]
[[package]]
-name = "futures-channel"
-version = "0.3.15"
+name = "findshlibs"
+version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2"
+checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64"
dependencies = [
- "futures-core",
- "futures-sink",
+ "cc",
+ "lazy_static",
+ "libc",
+ "winapi",
]
[[package]]
-name = "futures-core"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1"
-
-[[package]]
-name = "futures-io"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1"
-
-[[package]]
-name = "futures-sink"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282"
-
-[[package]]
-name = "futures-task"
-version = "0.3.15"
+name = "fixedbitset"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae"
+checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
[[package]]
-name = "futures-util"
-version = "0.3.15"
+name = "form_urlencoded"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967"
+checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
- "autocfg",
- "futures-core",
- "futures-sink",
- "futures-task",
- "pin-project-lite",
- "pin-utils",
- "slab",
+ "matches",
+ "percent-encoding",
]
[[package]]
@@ -502,9 +436,9 @@ dependencies = [
[[package]]
name = "generic-array"
-version = "0.14.4"
+version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
+checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
dependencies = [
"typenum",
"version_check",
@@ -512,199 +446,77 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
-[[package]]
-name = "getrandom"
-version = "0.2.3"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
+checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"libc",
- "wasi 0.10.2+wasi-snapshot-preview1",
+ "wasi",
]
[[package]]
name = "gimli"
-version = "0.24.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189"
-
-[[package]]
-name = "glob"
-version = "0.3.0"
+version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
-
-[[package]]
-name = "h2"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726"
-dependencies = [
- "bytes 1.0.1",
- "fnv",
- "futures-core",
- "futures-sink",
- "futures-util",
- "http",
- "indexmap",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
+checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "half"
-version = "1.7.1"
+version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
+checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "handlebars"
-version = "4.1.0"
+version = "4.3.3"
dependencies = [
"criterion",
"env_logger",
"log",
- "maplit",
"pest",
"pest_derive",
"pprof",
- "quick-error 2.0.1",
"rhai",
+ "rust-embed",
"serde",
"serde_derive",
"serde_json",
"tempfile",
- "tokio",
+ "thiserror",
+ "time",
+ "tiny_http",
"walkdir",
- "warp",
]
[[package]]
name = "hashbrown"
-version = "0.9.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
-
-[[package]]
-name = "headers"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855"
-dependencies = [
- "base64",
- "bitflags",
- "bytes 1.0.1",
- "headers-core",
- "http",
- "mime",
- "sha-1 0.9.6",
- "time",
-]
-
-[[package]]
-name = "headers-core"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429"
-dependencies = [
- "http",
-]
+checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
-version = "0.3.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
+checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
-version = "0.1.18"
+version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
-name = "http"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11"
-dependencies = [
- "bytes 1.0.1",
- "fnv",
- "itoa",
-]
-
-[[package]]
-name = "http-body"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9"
-dependencies = [
- "bytes 1.0.1",
- "http",
- "pin-project-lite",
-]
-
-[[package]]
-name = "httparse"
-version = "1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68"
-
-[[package]]
-name = "httpdate"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"
-
-[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
-name = "hyper"
-version = "0.14.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07d6baa1b441335f3ce5098ac421fb6547c46dda735ca1bc6d0153c838f9dd83"
-dependencies = [
- "bytes 1.0.1",
- "futures-channel",
- "futures-core",
- "futures-util",
- "h2",
- "http",
- "http-body",
- "httparse",
- "httpdate",
- "itoa",
- "pin-project-lite",
- "socket2",
- "tokio",
- "tower-service",
- "tracing",
- "want",
-]
-
-[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -717,9 +529,9 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "1.6.2"
+version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
+checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
dependencies = [
"autocfg",
"hashbrown",
@@ -727,14 +539,14 @@ dependencies = [
[[package]]
name = "inferno"
-version = "0.10.6"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c3cbcc228d2ad2e99328c2b19f38d80ec387ca6a29f778e40e32ca9f25448c3"
+checksum = "16d4bde3a7105e59c66a4104cfe9606453af1c7a0eac78cb7d5bc263eb762a70"
dependencies = [
- "ahash 0.6.3",
+ "ahash",
"atty",
"indexmap",
- "itoa",
+ "itoa 1.0.1",
"lazy_static",
"log",
"num-format",
@@ -744,61 +556,40 @@ dependencies = [
]
[[package]]
-name = "input_buffer"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413"
-dependencies = [
- "bytes 1.0.1",
-]
-
-[[package]]
name = "instant"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
-dependencies = [
- "cfg-if 1.0.0",
-]
-
-[[package]]
-name = "itertools"
-version = "0.8.2"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
- "either",
+ "cfg-if",
]
[[package]]
name = "itertools"
-version = "0.9.0"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
+checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
dependencies = [
"either",
]
[[package]]
-name = "itertools"
-version = "0.10.1"
+name = "itoa"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
-dependencies = [
- "either",
-]
+checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "itoa"
-version = "0.4.7"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
+checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
[[package]]
name = "js-sys"
-version = "0.3.51"
+version = "0.3.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062"
+checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397"
dependencies = [
"wasm-bindgen",
]
@@ -811,26 +602,27 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.97"
+version = "0.2.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6"
+checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
[[package]]
name = "lock_api"
-version = "0.4.4"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
+checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
dependencies = [
+ "autocfg",
"scopeguard",
]
[[package]]
name = "log"
-version = "0.4.14"
+version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
+checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
]
[[package]]
@@ -841,81 +633,41 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "matches"
-version = "0.1.8"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
+checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "memchr"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
-name = "memmap"
-version = "0.7.0"
+name = "memmap2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
+checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f"
dependencies = [
"libc",
- "winapi",
]
[[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",
]
[[package]]
-name = "mime"
-version = "0.3.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
-
-[[package]]
-name = "mime_guess"
-version = "2.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"
-dependencies = [
- "mime",
- "unicase",
-]
-
-[[package]]
name = "miniz_oxide"
-version = "0.4.4"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
+checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
dependencies = [
"adler",
- "autocfg",
-]
-
-[[package]]
-name = "mio"
-version = "0.7.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16"
-dependencies = [
- "libc",
- "log",
- "miow",
- "ntapi",
- "winapi",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
-dependencies = [
- "winapi",
]
[[package]]
@@ -925,34 +677,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
-name = "multipart"
-version = "0.17.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4"
-dependencies = [
- "buf_redux",
- "httparse",
- "log",
- "mime",
- "mime_guess",
- "quick-error 1.2.3",
- "rand 0.7.3",
- "safemem",
- "tempfile",
- "twoway",
-]
-
-[[package]]
name = "nix"
-version = "0.17.0"
+version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
+checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
dependencies = [
"bitflags",
- "cc",
- "cfg-if 0.1.10",
+ "cfg-if",
"libc",
- "void",
]
[[package]]
@@ -962,57 +694,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
-name = "ntapi"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
-dependencies = [
- "winapi",
-]
-
-[[package]]
name = "num-format"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465"
dependencies = [
"arrayvec",
- "itoa",
+ "itoa 0.4.8",
]
[[package]]
name = "num-traits"
-version = "0.2.14"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
+checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
-version = "1.13.0"
+version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
+checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
+name = "num_threads"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "object"
-version = "0.25.3"
+version = "0.28.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7"
+checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
-version = "1.8.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
+checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
name = "oorandom"
@@ -1034,27 +766,25 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "parking_lot"
-version = "0.11.1"
+version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
+checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
dependencies = [
- "instant",
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
-version = "0.8.3"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
+checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
dependencies = [
- "cfg-if 1.0.0",
- "instant",
+ "cfg-if",
"libc",
"redox_syscall",
"smallvec",
- "winapi",
+ "windows-sys",
]
[[package]]
@@ -1103,52 +833,20 @@ checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
dependencies = [
"maplit",
"pest",
- "sha-1 0.8.2",
+ "sha-1",
]
[[package]]
name = "petgraph"
-version = "0.5.1"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
+checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]]
-name = "pin-project"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7509cc106041c40a4518d2af7a61530e1eed0e6285296a3d8c5472806ccc4a4"
-dependencies = [
- "pin-project-internal",
-]
-
-[[package]]
-name = "pin-project-internal"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48c950132583b500556b1efd71d45b319029f2b71518d979fcc208e16b42426f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
-[[package]]
name = "plotters"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1163,91 +861,92 @@ dependencies = [
[[package]]
name = "plotters-backend"
-version = "0.3.0"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590"
+checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c"
[[package]]
name = "plotters-svg"
-version = "0.3.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211"
+checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9"
dependencies = [
"plotters-backend",
]
[[package]]
name = "pprof"
-version = "0.3.20"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "937e4766a8d473f9dd3eb318c654dec77d6715a87ab50081d6e5cfceea73c105"
+checksum = "1bba88ee898c63351101af3e60c66c5398c517681ce533eef8caff10ecf11ec1"
dependencies = [
"backtrace",
+ "cfg-if",
+ "findshlibs",
"inferno",
- "lazy_static",
"libc",
"log",
"nix",
+ "once_cell",
"parking_lot",
"prost",
"prost-build",
"prost-derive",
+ "smallvec",
"symbolic-demangle",
"tempfile",
"thiserror",
]
[[package]]
-name = "ppv-lite86"
-version = "0.2.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
-
-[[package]]
name = "proc-macro2"
-version = "1.0.27"
+version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
+checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa"
dependencies = [
"unicode-xid",
]
[[package]]
name = "prost"
-version = "0.6.1"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212"
+checksum = "bc03e116981ff7d8da8e5c220e374587b98d294af7ba7dd7fda761158f00086f"
dependencies = [
- "bytes 0.5.6",
+ "bytes",
"prost-derive",
]
[[package]]
name = "prost-build"
-version = "0.6.1"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26"
+checksum = "65a1118354442de7feb8a2a76f3d80ef01426bd45542c8c1fdffca41a758f846"
dependencies = [
- "bytes 0.5.6",
+ "bytes",
+ "cfg-if",
+ "cmake",
"heck",
- "itertools 0.8.2",
+ "itertools",
+ "lazy_static",
"log",
"multimap",
"petgraph",
"prost",
"prost-types",
+ "regex",
"tempfile",
"which",
]
[[package]]
name = "prost-derive"
-version = "0.6.1"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72"
+checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc"
dependencies = [
"anyhow",
- "itertools 0.8.2",
+ "itertools",
"proc-macro2",
"quote",
"syn",
@@ -1255,130 +954,37 @@ dependencies = [
[[package]]
name = "prost-types"
-version = "0.6.1"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa"
+checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68"
dependencies = [
- "bytes 0.5.6",
+ "bytes",
"prost",
]
[[package]]
-name = "quick-error"
-version = "1.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
-
-[[package]]
-name = "quick-error"
-version = "2.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
-
-[[package]]
name = "quick-xml"
-version = "0.20.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26aab6b48e2590e4a64d1ed808749ba06257882b461d01ca71baeb747074a6dd"
+checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
-version = "1.0.9"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
+checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
dependencies = [
"proc-macro2",
]
[[package]]
-name = "rand"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
-dependencies = [
- "getrandom 0.1.16",
- "libc",
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc 0.2.0",
-]
-
-[[package]]
-name = "rand"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
-dependencies = [
- "libc",
- "rand_chacha 0.3.1",
- "rand_core 0.6.2",
- "rand_hc 0.3.0",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.6.2",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
-dependencies = [
- "getrandom 0.1.16",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
-dependencies = [
- "getrandom 0.2.3",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
-dependencies = [
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
-dependencies = [
- "rand_core 0.6.2",
-]
-
-[[package]]
name = "rayon"
-version = "1.5.1"
+version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
+checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
dependencies = [
"autocfg",
"crossbeam-deque",
@@ -1388,31 +994,30 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.9.1"
+version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
+checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
- "lazy_static",
"num_cpus",
]
[[package]]
name = "redox_syscall"
-version = "0.2.8"
+version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
+checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
dependencies = [
"bitflags",
]
[[package]]
name = "regex"
-version = "1.5.4"
+version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
@@ -1442,20 +1047,21 @@ dependencies = [
[[package]]
name = "rgb"
-version = "0.8.27"
+version = "0.8.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fddb3b23626145d1776addfc307e1a1851f60ef6ca64f376bcb889697144cf0"
+checksum = "e74fdc210d8f24a7dbfedc13b04ba5764f5232754ccebfdf5fff1bad791ccbc6"
dependencies = [
"bytemuck",
]
[[package]]
name = "rhai"
-version = "0.20.2"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d862e125236e74d2a5033e88b9cb9404010a6a39516a388f570975494fe73bce"
+checksum = "9f06953bb8b9e4307cb7ccc0d9d018e2ddd25a30d32831f631ce4fe8f17671f7"
dependencies = [
- "ahash 0.7.4",
+ "ahash",
+ "bitflags",
"instant",
"num-traits",
"rhai_codegen",
@@ -1466,41 +1072,69 @@ dependencies = [
[[package]]
name = "rhai_codegen"
-version = "0.3.6"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "faa0ff1c9dc19c9f8bba510a2a75d3f0449f6233570c2672c7e31c692a11a59a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "rust-embed"
+version = "6.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "643fd67d19aafd45a9e335afe4183dc58ba0cc6a1f43fbe34c7d92c041cdcafc"
+checksum = "9a17e5ac65b318f397182ae94e532da0ba56b88dd1200b774715d36c4943b1c3"
+dependencies = [
+ "rust-embed-impl",
+ "rust-embed-utils",
+ "walkdir",
+]
+
+[[package]]
+name = "rust-embed-impl"
+version = "6.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30"
dependencies = [
"proc-macro2",
"quote",
+ "rust-embed-utils",
"syn",
+ "walkdir",
+]
+
+[[package]]
+name = "rust-embed-utils"
+version = "7.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "756feca3afcbb1487a1d01f4ecd94cf8ec98ea074c55a69e7136d29fb6166029"
+dependencies = [
+ "sha2",
+ "walkdir",
]
[[package]]
name = "rustc-demangle"
-version = "0.1.19"
+version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce"
+checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc_version"
-version = "0.3.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
+checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
]
[[package]]
name = "ryu"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
-
-[[package]]
-name = "safemem"
-version = "0.3.3"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
+checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]]
name = "same-file"
@@ -1512,12 +1146,6 @@ dependencies = [
]
[[package]]
-name = "scoped-tls"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
-
-[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1525,36 +1153,24 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "semver"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
-dependencies = [
- "semver-parser",
-]
-
-[[package]]
-name = "semver-parser"
-version = "0.10.2"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
-dependencies = [
- "pest",
-]
+checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd"
[[package]]
name = "serde"
-version = "1.0.126"
+version = "1.0.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
+checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_cbor"
-version = "0.11.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622"
+checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
dependencies = [
"half",
"serde",
@@ -1562,9 +1178,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.126"
+version = "1.0.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
+checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
dependencies = [
"proc-macro2",
"quote",
@@ -1573,23 +1189,11 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.64"
+version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
+checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
dependencies = [
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "serde_urlencoded"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
-dependencies = [
- "form_urlencoded",
- "itoa",
+ "itoa 1.0.1",
"ryu",
"serde",
]
@@ -1607,47 +1211,33 @@ dependencies = [
]
[[package]]
-name = "sha-1"
-version = "0.9.6"
+name = "sha2"
+version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c4cfa741c5832d0ef7fab46cabed29c2aae926db0b11bb2069edd8db5e64e16"
+checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [
"block-buffer 0.9.0",
- "cfg-if 1.0.0",
+ "cfg-if",
"cpufeatures",
"digest 0.9.0",
"opaque-debug 0.3.0",
]
[[package]]
-name = "slab"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
-
-[[package]]
name = "smallvec"
-version = "1.6.1"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
+checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
[[package]]
name = "smartstring"
-version = "0.2.6"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ada87540bf8ef4cf8a1789deb175626829bb59b1fefd816cf7f7f55efcdbae9"
+checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
dependencies = [
+ "autocfg",
"static_assertions",
-]
-
-[[package]]
-name = "socket2"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
-dependencies = [
- "libc",
- "winapi",
+ "version_check",
]
[[package]]
@@ -1670,21 +1260,21 @@ checksum = "9091b6114800a5f2141aee1d1b9d6ca3592ac062dc5decb3764ec5895a47b4eb"
[[package]]
name = "symbolic-common"
-version = "8.2.0"
+version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f8e101b55bbcf228c855fa34fc4312e4f58b4a3251f1298bc0f97b71557815d"
+checksum = "9ea2ab8b85d27d49d184438b4b77fbd521b385cc9c5c802f60e784f2df25a03d"
dependencies = [
"debugid",
- "memmap",
+ "memmap2",
"stable_deref_trait",
"uuid",
]
[[package]]
name = "symbolic-demangle"
-version = "8.2.0"
+version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e257e28c2cbcf60a0c21089d32ff8b6cdc7efa6125b13693d29e8986aa1cd99"
+checksum = "7939b15a1c62633d1fce17f8a7b668312eaa2d3b117bf4ced5e6e77870c43b6a"
dependencies = [
"cpp_demangle",
"rustc-demangle",
@@ -1693,9 +1283,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.73"
+version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
+checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a"
dependencies = [
"proc-macro2",
"quote",
@@ -1704,13 +1294,13 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.2.0"
+version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
+checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
+ "fastrand",
"libc",
- "rand 0.8.3",
"redox_syscall",
"remove_dir_all",
"winapi",
@@ -1718,9 +1308,9 @@ dependencies = [
[[package]]
name = "termcolor"
-version = "1.1.2"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
+checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
@@ -1736,18 +1326,18 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "1.0.25"
+version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6"
+checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.25"
+version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d"
+checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
dependencies = [
"proc-macro2",
"quote",
@@ -1756,170 +1346,66 @@ dependencies = [
[[package]]
name = "time"
-version = "0.1.43"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
+checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd"
dependencies = [
+ "itoa 1.0.1",
"libc",
- "winapi",
-]
-
-[[package]]
-name = "tinytemplate"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
-dependencies = [
+ "num_threads",
"serde",
- "serde_json",
+ "time-macros",
]
[[package]]
-name = "tinyvec"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
-dependencies = [
- "tinyvec_macros",
-]
-
-[[package]]
-name = "tinyvec_macros"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
-
-[[package]]
-name = "tokio"
-version = "1.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aea337f72e96efe29acc234d803a5981cd9a2b6ed21655cd7fc21cfe021e8ec7"
-dependencies = [
- "autocfg",
- "bytes 1.0.1",
- "libc",
- "memchr",
- "mio",
- "num_cpus",
- "pin-project-lite",
- "tokio-macros",
-]
-
-[[package]]
-name = "tokio-macros"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "tokio-stream"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8864d706fdb3cc0843a49647ac892720dac98a6eeb818b77190592cf4994066"
-dependencies = [
- "futures-core",
- "pin-project-lite",
- "tokio",
-]
-
-[[package]]
-name = "tokio-tungstenite"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b"
-dependencies = [
- "futures-util",
- "log",
- "pin-project",
- "tokio",
- "tungstenite",
-]
-
-[[package]]
-name = "tokio-util"
-version = "0.6.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592"
-dependencies = [
- "bytes 1.0.1",
- "futures-core",
- "futures-sink",
- "log",
- "pin-project-lite",
- "tokio",
-]
-
-[[package]]
-name = "tower-service"
-version = "0.3.1"
+name = "time-macros"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
+checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
[[package]]
-name = "tracing"
-version = "0.1.26"
+name = "tiny_http"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d"
+checksum = "e0d6ef4e10d23c1efb862eecad25c5054429a71958b4eeef85eb5e7170b477ca"
dependencies = [
- "cfg-if 1.0.0",
+ "ascii",
+ "chunked_transfer",
"log",
- "pin-project-lite",
- "tracing-core",
+ "time",
+ "url",
]
[[package]]
-name = "tracing-core"
-version = "0.1.18"
+name = "tinytemplate"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052"
+checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
dependencies = [
- "lazy_static",
+ "serde",
+ "serde_json",
]
[[package]]
-name = "try-lock"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
-
-[[package]]
-name = "tungstenite"
-version = "0.12.0"
+name = "tinyvec"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
- "base64",
- "byteorder",
- "bytes 1.0.1",
- "http",
- "httparse",
- "input_buffer",
- "log",
- "rand 0.8.3",
- "sha-1 0.9.6",
- "url",
- "utf-8",
+ "tinyvec_macros",
]
[[package]]
-name = "twoway"
-version = "0.1.8"
+name = "tinyvec_macros"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1"
-dependencies = [
- "memchr",
-]
+checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "typenum"
-version = "1.13.0"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
+checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "ucd-trie"
@@ -1928,22 +1414,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
-name = "unicase"
-version = "2.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
-dependencies = [
- "version_check",
-]
-
-[[package]]
name = "unicode-bidi"
-version = "0.3.5"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
-dependencies = [
- "matches",
-]
+checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-normalization"
@@ -1955,22 +1429,16 @@ dependencies = [
]
[[package]]
-name = "unicode-segmentation"
-version = "1.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
-
-[[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"
-version = "0.2.2"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
[[package]]
name = "url"
@@ -1985,28 +1453,16 @@ dependencies = [
]
[[package]]
-name = "utf-8"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
-
-[[package]]
name = "uuid"
-version = "0.8.2"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
+checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
[[package]]
name = "version_check"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
-
-[[package]]
-name = "void"
-version = "1.0.2"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
@@ -2020,51 +1476,6 @@ dependencies = [
]
[[package]]
-name = "want"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
-dependencies = [
- "log",
- "try-lock",
-]
-
-[[package]]
-name = "warp"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054"
-dependencies = [
- "bytes 1.0.1",
- "futures",
- "headers",
- "http",
- "hyper",
- "log",
- "mime",
- "mime_guess",
- "multipart",
- "percent-encoding",
- "pin-project",
- "scoped-tls",
- "serde",
- "serde_json",
- "serde_urlencoded",
- "tokio",
- "tokio-stream",
- "tokio-tungstenite",
- "tokio-util",
- "tower-service",
- "tracing",
-]
-
-[[package]]
-name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-
-[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2072,19 +1483,19 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm-bindgen"
-version = "0.2.74"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
+checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.74"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
+checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4"
dependencies = [
"bumpalo",
"lazy_static",
@@ -2097,9 +1508,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.74"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
+checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -2107,9 +1518,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.74"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
+checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b"
dependencies = [
"proc-macro2",
"quote",
@@ -2120,15 +1531,15 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.74"
+version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
+checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744"
[[package]]
name = "web-sys"
-version = "0.3.51"
+version = "0.3.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582"
+checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -2136,10 +1547,12 @@ dependencies = [
[[package]]
name = "which"
-version = "3.1.1"
+version = "4.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
+checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
dependencies = [
+ "either",
+ "lazy_static",
"libc",
]
@@ -2173,3 +1586,46 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
+dependencies = [
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.36.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
diff --git a/vendor/handlebars/Cargo.toml b/vendor/handlebars/Cargo.toml
index f46e0bd13..f40384c26 100644
--- a/vendor/handlebars/Cargo.toml
+++ b/vendor/handlebars/Cargo.toml
@@ -3,29 +3,45 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
[package]
-edition = "2018"
+edition = "2021"
+rust-version = "1.57"
name = "handlebars"
-version = "4.1.0"
+version = "4.3.3"
authors = ["Ning Sun <sunng@pm.me>"]
description = "Handlebars templating implemented in Rust."
homepage = "https://github.com/sunng87/handlebars-rust"
documentation = "https://docs.rs/crate/handlebars/"
readme = "README.md"
-keywords = ["handlebars", "templating", "web"]
-categories = ["template-engine", "web-programming"]
+keywords = [
+ "handlebars",
+ "templating",
+ "web",
+]
+categories = [
+ "template-engine",
+ "web-programming",
+]
license = "MIT"
repository = "https://github.com/sunng87/handlebars-rust"
+resolver = "2"
+
[package.metadata.docs.rs]
-features = ["dir_source", "script_helper"]
-rustdoc-args = ["--cfg", "docsrs"]
+features = [
+ "dir_source",
+ "script_helper",
+ "rust-embed",
+]
+rustdoc-args = [
+ "--cfg",
+ "docsrs",
+]
[lib]
name = "handlebars"
@@ -35,9 +51,14 @@ path = "src/lib.rs"
name = "handlebars-cli"
path = "src/cli.rs"
+[[example]]
+name = "script"
+required-features = ["script_helper"]
+
[[bench]]
name = "bench"
harness = false
+
[dependencies.log]
version = "0.4.0"
@@ -47,12 +68,16 @@ version = "2.1.0"
[dependencies.pest_derive]
version = "2.1.0"
-[dependencies.quick-error]
-version = "2.0"
-
[dependencies.rhai]
-version = "0.20"
-features = ["sync", "serde"]
+version = "1.6"
+features = [
+ "sync",
+ "serde",
+]
+optional = true
+
+[dependencies.rust-embed]
+version = "6.3.0"
optional = true
[dependencies.serde]
@@ -61,17 +86,18 @@ version = "1.0.0"
[dependencies.serde_json]
version = "1.0.39"
+[dependencies.thiserror]
+version = "1"
+
[dependencies.walkdir]
version = "2.2.3"
optional = true
+
[dev-dependencies.criterion]
version = "0.3"
[dev-dependencies.env_logger]
-version = "0.8"
-
-[dev-dependencies.maplit]
-version = "1.0.0"
+version = "0.9"
[dev-dependencies.serde_derive]
version = "1.0.75"
@@ -79,20 +105,29 @@ version = "1.0.75"
[dev-dependencies.tempfile]
version = "3.0.0"
-[dev-dependencies.tokio]
-version = "1"
-features = ["macros", "rt-multi-thread"]
+[dev-dependencies.time]
+version = "0.3.7"
+features = [
+ "serde",
+ "formatting",
+ "parsing",
+]
-[dev-dependencies.warp]
-version = "0.3"
+[dev-dependencies.tiny_http]
+version = "0.11"
[features]
default = []
dir_source = ["walkdir"]
no_logging = []
script_helper = ["rhai"]
+
[target."cfg(unix)".dev-dependencies.pprof]
-version = "0.3.13"
-features = ["flamegraph", "protobuf"]
+version = "0.10"
+features = [
+ "flamegraph",
+ "prost-codec",
+]
+
[badges.maintenance]
status = "actively-developed"
diff --git a/vendor/handlebars/README.md b/vendor/handlebars/README.md
index 4a9c41827..18d21abfb 100644
--- a/vendor/handlebars/README.md
+++ b/vendor/handlebars/README.md
@@ -4,16 +4,11 @@ handlebars-rust
[Handlebars templating language](https://handlebarsjs.com) implemented
in Rust and for Rust.
-Handlebars-rust is the template engine that renders the official Rust website
-[rust-lang.org](https://www.rust-lang.org), [its
-book](https://doc.rust-lang.org/book/).
-
-[![Build Status](https://travis-ci.org/sunng87/handlebars-rust.svg?branch=master)](https://travis-ci.org/sunng87/handlebars-rust)
-[![](https://meritbadge.herokuapp.com/handlebars)](https://crates.io/crates/handlebars)
+[![CI](https://github.com/sunng87/handlebars-rust/actions/workflows/main.yml/badge.svg)](https://github.com/sunng87/handlebars-rust/actions/workflows/main.yml)
+[![](https://img.shields.io/crates/v/handlebars)](https://crates.io/crates/handlebars)
[![](https://img.shields.io/crates/d/handlebars.svg)](https://crates.io/crates/handlebars)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![Docs](https://docs.rs/handlebars/badge.svg)](https://docs.rs/crate/handlebars/)
-![rustc](https://img.shields.io/badge/rustc-1.50+-lightgray.svg)
[![Donate](https://img.shields.io/badge/donate-liberapay-yellow.svg)](https://liberapay.com/Sunng/donate)
## Getting Started
@@ -55,6 +50,8 @@ Examples are provided in source tree to demo usage of various api.
to use custom helpers.
* [render_file](https://github.com/sunng87/handlebars-rust/blob/master/examples/render_file.rs)
similar to render, but render to file instead of string
+* [helper_macro](https://github.com/sunng87/handlebars-rust/blob/master/examples/helper_macro.rs)
+ demos usage of `handlebars_helper!` to simplify helper development
* [partials](https://github.com/sunng87/handlebars-rust/blob/master/examples/partials.rs)
template inheritance with handlebars
* [decorator](https://github.com/sunng87/handlebars-rust/blob/master/examples/decorator.rs)
@@ -71,7 +68,7 @@ Examples are provided in source tree to demo usage of various api.
## Minimum Rust Version Policy
Handlebars will track Rust nightly and stable channel. When dropping
-support for previous stable versions, I will bump **major** version
+support for previous stable versions, I will bump **patch** version
and clarify in CHANGELOG.
## Document
@@ -133,7 +130,7 @@ And using it in your template:
{{hex 16}}
```
-By default, handlebars-rust ships [additional helpers](https://github.com/sunng87/handlebars-rust/blob/master/src/helpers/helper_boolean.rs#L5)
+By default, handlebars-rust ships [additional helpers](https://github.com/sunng87/handlebars-rust/blob/master/src/helpers/helper_extras.rs#L6)
(compared with original js version)
that is useful when working with `if`.
@@ -146,7 +143,7 @@ moment, and can change in future.
Every time I look into a templating system, I will investigate its
support for [template
-inheritance](https://docs.djangoproject.com/en/1.9/ref/templates/language/#template-inheritance).
+inheritance](https://docs.djangoproject.com/en/3.2/ref/templates/language/#template-inheritance).
Template include is not sufficient for template reuse. In most cases
you will need a skeleton of page as parent (header, footer, etc.), and
@@ -164,6 +161,13 @@ loaded from files or directory. This can be handy for template development.
Handlebars 3.0 can be used in WebAssembly projects.
+#### Fully scriptable
+
+With [rhai](https://github.com/rhaiscript/rhai) script support, you
+can implement your own helper with the scripting language. Together
+with the template lanaguage itself, template development can be fully
+scriptable without changing rust code.
+
## Related Projects
### Web frameworks
@@ -174,7 +178,7 @@ Handlebars 3.0 can be used in WebAssembly projects.
example](https://github.com/seanmonstar/warp/blob/master/examples/handlebars_template.rs)
* Tower-web: [Built-in](https://github.com/carllerche/tower-web)
* Actix: [handlebars
- example](https://github.com/actix/examples/blob/master/template_engines/handlebars/src/main.rs)
+ example](https://github.com/actix/examples/blob/master/templating/handlebars/src/main.rs)
* Tide: [tide-handlebars](https://github.com/No9/tide-handlebars)
### Adopters
diff --git a/vendor/handlebars/examples/dev_mode.rs b/vendor/handlebars/examples/dev_mode.rs
index 99017474f..3256eed37 100644
--- a/vendor/handlebars/examples/dev_mode.rs
+++ b/vendor/handlebars/examples/dev_mode.rs
@@ -2,10 +2,9 @@ use std::sync::Arc;
use handlebars::Handlebars;
use serde_json::json;
-use warp::{self, Filter};
+use tiny_http::{Response, Server};
-#[tokio::main]
-async fn main() {
+fn handlebars() -> Handlebars<'static> {
let mut reg = Handlebars::new();
// enable dev mode for template reloading
reg.set_dev_mode(true);
@@ -14,14 +13,19 @@ async fn main() {
reg.register_template_file("tpl", "./examples/dev_mode/template.hbs")
.unwrap();
- let hbs = Arc::new(reg);
- let route = warp::get().map(move || {
+ reg
+}
+
+fn main() {
+ let hbs = Arc::new(handlebars());
+
+ let server = Server::http("127.0.0.1:3030").expect("Failed to start demo server.");
+ println!("Edit ./examples/dev_mode/template.hbs and request http://localhost:3030 to see the change on the fly.");
+
+ for req in server.incoming_requests() {
let result = hbs
.render("tpl", &json!({"model": "t14s", "brand": "Thinkpad"}))
.unwrap_or_else(|e| e.to_string());
- warp::reply::html(result)
- });
-
- println!("Edit ./examples/dev_mode/template.hbs and request http://localhost:3030 to see the change on the run.");
- warp::serve(route).run(([127, 0, 0, 1], 3030)).await;
+ req.respond(Response::from_string(result)).unwrap();
+ }
}
diff --git a/vendor/handlebars/examples/error.rs b/vendor/handlebars/examples/error.rs
index 3fb874e2b..ed0f7c423 100644
--- a/vendor/handlebars/examples/error.rs
+++ b/vendor/handlebars/examples/error.rs
@@ -3,11 +3,44 @@ extern crate handlebars;
#[macro_use]
extern crate serde_json;
-use std::error::Error;
+use std::error::Error as StdError;
-use handlebars::Handlebars;
+use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError};
+use thiserror::Error;
-fn main() -> Result<(), Box<dyn Error>> {
+#[derive(Debug, Error)]
+pub enum HelperError {
+ #[error("db error")]
+ DbError,
+ #[error("api error")]
+ ApiError,
+}
+
+/// A helper that raise error according to parameters
+pub fn error_helper(
+ h: &Helper,
+ _: &Handlebars,
+ _: &Context,
+ _: &mut RenderContext,
+ _: &mut dyn Output,
+) -> Result<(), RenderError> {
+ let param = h
+ .param(0)
+ .ok_or(RenderError::new("Param 0 is required for error helper."))?;
+ match param.value().as_str() {
+ Some("db") => Err(RenderError::from_error(
+ "helper error",
+ HelperError::DbError,
+ )),
+ Some("api") => Err(RenderError::from_error(
+ "helper error",
+ HelperError::ApiError,
+ )),
+ _ => Ok(()),
+ }
+}
+
+fn main() -> Result<(), Box<dyn StdError>> {
env_logger::init();
let mut handlebars = Handlebars::new();
@@ -36,5 +69,18 @@ fn main() -> Result<(), Box<dyn Error>> {
println!("{}", be1.source().unwrap());
println!("{:?}", be1.source().unwrap().source());
+ // process error generated in helper
+ handlebars.register_helper("err", Box::new(error_helper));
+ let e2 = handlebars
+ .render_template("{{err \"db\"}}", &json!({}))
+ .unwrap_err();
+ // down-casting the error to user defined type
+ match e2.source().and_then(|e| e.downcast_ref::<HelperError>()) {
+ Some(HelperError::DbError) => {
+ println!("Detected error from helper: db error",)
+ }
+ _ => {}
+ }
+
Ok(())
}
diff --git a/vendor/handlebars/examples/helper_macro.rs b/vendor/handlebars/examples/helper_macro.rs
new file mode 100644
index 000000000..dcc6ea31a
--- /dev/null
+++ b/vendor/handlebars/examples/helper_macro.rs
@@ -0,0 +1,63 @@
+use std::error::Error;
+
+use handlebars::{handlebars_helper, Handlebars, JsonRender};
+use serde_json::{json, Value};
+use time::format_description::parse;
+use time::OffsetDateTime;
+
+// define a helper using helper
+// a date format helper accept an `OffsetDateTime` as parameter
+handlebars_helper!(date: |dt: OffsetDateTime| dt.format(&parse("[year]-[month]-[day]").unwrap()).unwrap());
+
+// a helper returns number of provided parameters
+handlebars_helper!(nargs: |*args| args.len());
+
+// a helper joins all values, using both hash and parameters
+handlebars_helper!(join: |{sep:str=","}, *args|
+ args.iter().map(|a| a.render()).collect::<Vec<String>>().join(sep)
+);
+
+handlebars_helper!(isdefined: |v: Value| !v.is_null());
+
+// a helper provides format
+handlebars_helper!(date2: |dt: OffsetDateTime, {fmt:str = "[year]-[month]-[day]"}|
+ dt.format(&parse(fmt).unwrap()).unwrap()
+);
+
+fn main() -> Result<(), Box<dyn Error>> {
+ // create the handlebars registry
+ let mut handlebars = Handlebars::new();
+
+ handlebars.register_helper("date", Box::new(date));
+ handlebars.register_helper("date2", Box::new(date2));
+ handlebars.register_helper("nargs", Box::new(nargs));
+ handlebars.register_helper("join", Box::new(join));
+ handlebars.register_helper("isdefined", Box::new(isdefined));
+
+ let data = OffsetDateTime::now_utc();
+
+ println!("{}", handlebars.render_template("{{date this}}", &data)?);
+ println!("{}", handlebars.render_template("{{date2 this}}", &data)?);
+ println!(
+ "{}",
+ handlebars.render_template("{{date2 this fmt=\"[day]/[month]/[year]\"}}", &data)?
+ );
+
+ println!("{}", handlebars.render_template("{{nargs 1 2 3 4}}", &())?);
+
+ println!(
+ "{}",
+ handlebars.render_template("{{join 1 2 3 4 sep=\"|\" }}", &())?
+ );
+
+ println!(
+ "{}",
+ handlebars.render_template(
+ r#"{{isdefined a}} {{isdefined b}}
+{{#if (isdefined a)}}a{{/if}} {{#if (isdefined b)}}b{{/if}}"#,
+ &json!({"a": 1})
+ )?
+ );
+
+ Ok(())
+}
diff --git a/vendor/handlebars/examples/partials.rs b/vendor/handlebars/examples/partials.rs
index 80b20c2f7..017dd04b7 100644
--- a/vendor/handlebars/examples/partials.rs
+++ b/vendor/handlebars/examples/partials.rs
@@ -1,9 +1,8 @@
extern crate env_logger;
extern crate handlebars;
-#[macro_use]
-extern crate maplit;
use handlebars::Handlebars;
+use serde_json::json;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
@@ -15,14 +14,14 @@ fn main() -> Result<(), Box<dyn Error>> {
handlebars.register_template_file("base0", "./examples/partials/base0.hbs")?;
handlebars.register_template_file("base1", "./examples/partials/base1.hbs")?;
- let data0 = btreemap! {
- "title".to_string() => "example 0".to_string(),
- "parent".to_string() => "base0".to_string()
- };
- let data1 = btreemap! {
- "title".to_string() => "example 1".to_string(),
- "parent".to_string() => "base1".to_string()
- };
+ let data0 = json!({
+ "title": "example 0",
+ "parent": "base0"
+ });
+ let data1 = json!({
+ "title": "example 1",
+ "parent": "base1"
+ });
println!("Page 0");
println!("{}", handlebars.render("template", &data0)?);
diff --git a/vendor/handlebars/examples/script.rs b/vendor/handlebars/examples/script.rs
index bedd426cd..de89fa482 100644
--- a/vendor/handlebars/examples/script.rs
+++ b/vendor/handlebars/examples/script.rs
@@ -5,7 +5,6 @@ use std::error::Error;
#[macro_use]
extern crate serde_json;
-#[cfg(feature = "script_helper")]
fn main() -> Result<(), Box<dyn Error>> {
let mut handlebars = Handlebars::new();
@@ -31,9 +30,3 @@ fn main() -> Result<(), Box<dyn Error>> {
println!("{}", handlebars.render("tpl", &data)?);
Ok(())
}
-
-#[cfg(not(feature = "script_helper"))]
-fn main() -> Result<(), Box<dyn Error>> {
- println!("Please enable feature flag script_helper for this example");
- Ok(())
-}
diff --git a/vendor/handlebars/release.toml b/vendor/handlebars/release.toml
index e0f365aa1..6ee7a8383 100644
--- a/vendor/handlebars/release.toml
+++ b/vendor/handlebars/release.toml
@@ -1,4 +1,6 @@
sign-commit = true
+sign-tag = true
+dev-version = true
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", prerelease=false},
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", prerelease=false},
diff --git a/vendor/handlebars/src/context.rs b/vendor/handlebars/src/context.rs
index 10e15fd90..86f99ba4d 100644
--- a/vendor/handlebars/src/context.rs
+++ b/vendor/handlebars/src/context.rs
@@ -45,7 +45,7 @@ fn parse_json_visitor<'a, 'reg>(
for path_seg in relative_path {
match path_seg {
PathSeg::Named(the_path) => {
- if let Some((holder, base_path)) = get_in_block_params(&block_contexts, the_path) {
+ if let Some((holder, base_path)) = get_in_block_params(block_contexts, the_path) {
with_block_param = Some((holder, base_path));
}
break;
@@ -171,10 +171,7 @@ impl Context {
block_contexts: &VecDeque<BlockContext<'reg>>,
) -> Result<ScopedJson<'reg, 'rc>, RenderError> {
// always use absolute at the moment until we get base_value lifetime issue fixed
- let resolved_visitor = parse_json_visitor(&relative_path, block_contexts, true);
-
- // debug logging
- debug!("Accessing context value: {:?}", resolved_visitor);
+ let resolved_visitor = parse_json_visitor(relative_path, block_contexts, true);
match resolved_visitor {
ResolvedPath::AbsolutePath(paths) => {
@@ -223,6 +220,12 @@ impl Context {
}
}
+impl From<Json> for Context {
+ fn from(data: Json) -> Context {
+ Context { data }
+ }
+}
+
#[cfg(test)]
mod test {
use crate::block::{BlockContext, BlockParams};
@@ -359,9 +362,9 @@ mod test {
#[test]
fn test_key_name_with_this() {
- let m = btreemap! {
- "this_name".to_string() => "the_value".to_string()
- };
+ let m = json!({
+ "this_name": "the_value"
+ });
let ctx = Context::wraps(&m).unwrap();
assert_eq!(
navigate_from_root(&ctx, "this_name").unwrap().render(),
diff --git a/vendor/handlebars/src/decorators/mod.rs b/vendor/handlebars/src/decorators/mod.rs
index b8bad900f..bd2d23458 100644
--- a/vendor/handlebars/src/decorators/mod.rs
+++ b/vendor/handlebars/src/decorators/mod.rs
@@ -105,9 +105,9 @@ mod test {
.register_template_string("t0", "{{*foo}}".to_string())
.unwrap();
- let data = btreemap! {
- "hello".to_string() => "world".to_string()
- };
+ let data = json!({
+ "hello": "world"
+ });
assert!(handlebars.render("t0", &data).is_err());
@@ -132,9 +132,9 @@ mod test {
.register_template_string("t0", "{{hello}}{{*foo}}{{hello}}".to_string())
.unwrap();
- let data = btreemap! {
- "hello".to_string() => "world".to_string()
- };
+ let data = json!({
+ "hello": "world"
+ });
handlebars.register_decorator(
"foo",
diff --git a/vendor/handlebars/src/error.rs b/vendor/handlebars/src/error.rs
index f4721623f..618d68e4f 100644
--- a/vendor/handlebars/src/error.rs
+++ b/vendor/handlebars/src/error.rs
@@ -1,10 +1,13 @@
-use std::error::Error;
-use std::fmt;
+// use std::backtrace::Backtrace;
+use std::error::Error as StdError;
+use std::fmt::{self, Write};
use std::io::Error as IOError;
use std::num::ParseIntError;
use std::string::FromUtf8Error;
use serde_json::error::Error as SerdeError;
+use thiserror::Error;
+
#[cfg(feature = "dir_source")]
use walkdir::Error as WalkdirError;
@@ -12,14 +15,16 @@ use walkdir::Error as WalkdirError;
use rhai::{EvalAltResult, ParseError};
/// Error when rendering data on template.
-#[derive(Debug, Default)]
+#[derive(Debug, Default, Error)]
pub struct RenderError {
pub desc: String,
pub template_name: Option<String>,
pub line_no: Option<usize>,
pub column_no: Option<usize>,
- cause: Option<Box<dyn Error + Send + Sync + 'static>>,
+ #[source]
+ cause: Option<Box<dyn StdError + Send + Sync + 'static>>,
unimplemented: bool,
+ // backtrace: Backtrace,
}
impl fmt::Display for RenderError {
@@ -38,14 +43,6 @@ impl fmt::Display for RenderError {
}
}
-impl Error for RenderError {
- fn source(&self) -> Option<&(dyn Error + 'static)> {
- self.cause
- .as_ref()
- .map(|e| e.as_ref() as &(dyn Error + 'static))
- }
-}
-
impl From<IOError> for RenderError {
fn from(e: IOError) -> RenderError {
RenderError::from_error("Cannot generate output.", e)
@@ -115,7 +112,7 @@ impl RenderError {
pub fn from_error<E>(error_info: &str, cause: E) -> RenderError
where
- E: Error + Send + Sync + 'static,
+ E: StdError + Send + Sync + 'static,
{
let mut e = RenderError::new(error_info);
e.cause = Some(Box::new(cause));
@@ -129,39 +126,31 @@ impl RenderError {
}
}
-quick_error! {
/// Template parsing error
- #[derive(Debug)]
- pub enum TemplateErrorReason {
- MismatchingClosedHelper(open: String, closed: String) {
- display("helper {:?} was opened, but {:?} is closing",
- open, closed)
- }
- MismatchingClosedDecorator(open: String, closed: String) {
- display("decorator {:?} was opened, but {:?} is closing",
- open, closed)
- }
- InvalidSyntax {
- display("invalid handlebars syntax.")
- }
- InvalidParam (param: String) {
- display("invalid parameter {:?}", param)
- }
- NestedSubexpression {
- display("nested subexpression is not supported")
- }
- IoError(err: IOError, name: String) {
- display("Template \"{}\": {}", name, err)
- }
- #[cfg(feature = "dir_source")]
- WalkdirError(err: WalkdirError) {
- display("Walk dir error: {}", err)
- }
- }
+#[derive(Debug, Error)]
+pub enum TemplateErrorReason {
+ #[error("helper {0:?} was opened, but {1:?} is closing")]
+ MismatchingClosedHelper(String, String),
+ #[error("decorator {0:?} was opened, but {1:?} is closing")]
+ MismatchingClosedDecorator(String, String),
+ #[error("invalid handlebars syntax.")]
+ InvalidSyntax,
+ #[error("invalid parameter {0:?}")]
+ InvalidParam(String),
+ #[error("nested subexpression is not supported")]
+ NestedSubexpression,
+ #[error("Template \"{1}\": {0}")]
+ IoError(IOError, String),
+ #[cfg(feature = "dir_source")]
+ #[error("Walk dir error: {err}")]
+ WalkdirError {
+ #[from]
+ err: WalkdirError,
+ },
}
/// Error on parsing template.
-#[derive(Debug)]
+#[derive(Debug, Error)]
pub struct TemplateError {
pub reason: TemplateErrorReason,
pub template_name: Option<String>,
@@ -194,8 +183,6 @@ impl TemplateError {
}
}
-impl Error for TemplateError {}
-
impl From<(IOError, String)> for TemplateError {
fn from(err_info: (IOError, String)) -> TemplateError {
let (e, name) = err_info;
@@ -206,7 +193,7 @@ impl From<(IOError, String)> for TemplateError {
#[cfg(feature = "dir_source")]
impl From<WalkdirError> for TemplateError {
fn from(e: WalkdirError) -> TemplateError {
- TemplateError::of(TemplateErrorReason::WalkdirError(e))
+ TemplateError::of(TemplateErrorReason::from(e))
}
}
@@ -218,7 +205,7 @@ fn template_segment(template_str: &str, line: usize, col: usize) -> String {
let mut buf = String::new();
for (line_count, line_content) in template_str.lines().enumerate() {
if line_count >= line_start && line_count <= line_end {
- buf.push_str(&format!("{:4} | {}\n", line_count, line_content));
+ let _ = writeln!(&mut buf, "{:4} | {}", line_count, line_content);
if line_count == line - 1 {
buf.push_str(" |");
for c in 0..line_content.len() {
@@ -257,16 +244,11 @@ impl fmt::Display for TemplateError {
}
#[cfg(feature = "script_helper")]
-quick_error! {
- #[derive(Debug)]
- pub enum ScriptError {
- IoError(err: IOError) {
- from()
- source(err)
- }
- ParseError(err: ParseError) {
- from()
- source(err)
- }
- }
+#[derive(Debug, Error)]
+pub enum ScriptError {
+ #[error(transparent)]
+ IoError(#[from] IOError),
+
+ #[error(transparent)]
+ ParseError(#[from] ParseError),
}
diff --git a/vendor/handlebars/src/grammar.pest b/vendor/handlebars/src/grammar.pest
index 250d9d213..ac6776ee2 100644
--- a/vendor/handlebars/src/grammar.pest
+++ b/vendor/handlebars/src/grammar.pest
@@ -14,14 +14,20 @@ literal = { string_literal |
null_literal = @{ "null" ~ !symbol_char }
boolean_literal = @{ ("true"|"false") ~ !symbol_char }
-number_literal = @{ "-"? ~ ASCII_DIGIT+ ~ "."? ~ ASCII_DIGIT* ~ ("E" ~ "-"? ~ ASCII_DIGIT+)? }
-json_char = {
+number_literal = @{ "-"? ~ ASCII_DIGIT+ ~ "."? ~ ASCII_DIGIT* ~ ("E" ~ "-"? ~ ASCII_DIGIT+)? ~ !symbol_char }
+json_char_double_quote = {
!("\"" | "\\") ~ ANY
| "\\" ~ ("\"" | "\\" | "/" | "b" | "f" | "n" | "r" | "t")
| "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4})
}
-string_inner = @{ json_char* }
-string_literal = ${ "\"" ~ string_inner ~ "\"" }
+json_char_single_quote = {
+ !("'" | "\\") ~ ANY
+ | "\\" ~ ("'" | "\\" | "/" | "b" | "f" | "n" | "r" | "t")
+ | "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4})
+}
+string_inner_double_quote = @{ json_char_double_quote* }
+string_inner_single_quote = @{ json_char_single_quote* }
+string_literal = ${ ("\"" ~ string_inner_double_quote ~ "\"") | ("'" ~ string_inner_single_quote ~ "'") }
array_literal = { "[" ~ literal? ~ ("," ~ literal)* ~ "]" }
object_literal = { "{" ~ (string_literal ~ ":" ~ literal)?
~ ("," ~ string_literal ~ ":" ~ literal)* ~ "}" }
@@ -50,12 +56,17 @@ pro_whitespace_omitter = { "~" }
expression = { !invert_tag ~ "{{" ~ pre_whitespace_omitter? ~
((identifier ~ (hash|param)+) | name )
~ pro_whitespace_omitter? ~ "}}" }
-html_expression_triple_bracket = _{ "{{{" ~ pre_whitespace_omitter? ~
- ((identifier ~ (hash|param)+) | name ) ~
- pro_whitespace_omitter? ~ "}}}" }
+html_expression_triple_bracket_legacy = _{ "{{{" ~ pre_whitespace_omitter? ~
+ ((identifier ~ (hash|param)+) | name ) ~
+ pro_whitespace_omitter? ~ "}}}" }
+html_expression_triple_bracket = _{ "{{" ~ pre_whitespace_omitter? ~ "{" ~
+ ((identifier ~ (hash|param)+) | name ) ~
+ "}" ~ pro_whitespace_omitter? ~ "}}" }
+
amp_expression = _{ "{{" ~ pre_whitespace_omitter? ~ "&" ~ name ~
pro_whitespace_omitter? ~ "}}" }
-html_expression = { html_expression_triple_bracket | amp_expression }
+html_expression = { (html_expression_triple_bracket_legacy | html_expression_triple_bracket)
+ | amp_expression }
decorator_expression = { "{{" ~ pre_whitespace_omitter? ~ "*" ~ exp_line ~
pro_whitespace_omitter? ~ "}}" }
diff --git a/vendor/handlebars/src/grammar.rs b/vendor/handlebars/src/grammar.rs
index 1fd292ce1..6e61cd4e4 100644
--- a/vendor/handlebars/src/grammar.rs
+++ b/vendor/handlebars/src/grammar.rs
@@ -4,26 +4,6 @@
#[grammar = "grammar.pest"]
pub struct HandlebarsParser;
-#[inline]
-pub(crate) fn whitespace_matcher(c: char) -> bool {
- c == ' ' || c == '\t'
-}
-
-#[inline]
-pub(crate) fn newline_matcher(c: char) -> bool {
- c == '\n' || c == '\r'
-}
-
-pub(crate) fn ends_with_empty_line(text: &str) -> bool {
- text.trim_end_matches(whitespace_matcher)
- .ends_with(newline_matcher)
-}
-
-pub(crate) fn starts_with_empty_line(text: &str) -> bool {
- text.trim_start_matches(whitespace_matcher)
- .starts_with(newline_matcher)
-}
-
#[cfg(test)]
mod test {
use super::{HandlebarsParser, Rule};
@@ -191,6 +171,7 @@ mod test {
"{{exp 1}}",
"{{exp \"literal\"}}",
"{{exp \"literal with space\"}}",
+ "{{exp 'literal with space'}}",
r#"{{exp "literal with escape \\\\"}}"#,
"{{exp ref}}",
"{{exp (sub)}}",
@@ -199,6 +180,8 @@ mod test {
"{{exp {}}}",
"{{exp key=1}}",
"{{exp key=ref}}",
+ "{{exp key='literal with space'}}",
+ "{{exp key=\"literal with space\"}}",
"{{exp key=(sub)}}",
"{{exp key=(sub 0)}}",
"{{exp key=(sub 0 key=1)}}",
@@ -225,6 +208,12 @@ mod test {
"{{&html}}",
"{{{html 1}}}",
"{{{html p=true}}}",
+ "{{{~ html}}}",
+ "{{{html ~}}}",
+ "{{{~ html ~}}}",
+ "{{~{ html }~}}",
+ "{{~{ html }}}",
+ "{{{ html }~}}",
];
for i in s.iter() {
assert_rule!(Rule::html_expression, i);
diff --git a/vendor/handlebars/src/helpers/helper_each.rs b/vendor/handlebars/src/helpers/helper_each.rs
index 4b76e7ce7..2be28dc9c 100644
--- a/vendor/handlebars/src/helpers/helper_each.rs
+++ b/vendor/handlebars/src/helpers/helper_each.rs
@@ -18,7 +18,7 @@ fn update_block_context<'reg>(
is_first: bool,
value: &Json,
) {
- if let Some(ref p) = base_path {
+ if let Some(p) = base_path {
if is_first {
*block.base_path_mut() = copy_on_push_vec(p, relative_path);
} else if let Some(ptr) = block.base_path_mut().last_mut() {
@@ -83,7 +83,7 @@ impl HelperDef for EachHelper {
Json::Array(ref list)
if !list.is_empty() || (list.is_empty() && h.inverse().is_none()) =>
{
- let block_context = create_block(&value);
+ let block_context = create_block(value);
rc.push_block(block_context);
let len = list.len();
@@ -100,8 +100,8 @@ impl HelperDef for EachHelper {
block.set_local_var("last", to_json(is_last));
block.set_local_var("index", index.clone());
- update_block_context(block, array_path, i.to_string(), is_first, &v);
- set_block_param(block, h, array_path, &index, &v)?;
+ update_block_context(block, array_path, i.to_string(), is_first, v);
+ set_block_param(block, h, array_path, &index, v)?;
}
t.render(r, ctx, rc, out)?;
@@ -113,28 +113,28 @@ impl HelperDef for EachHelper {
Json::Object(ref obj)
if !obj.is_empty() || (obj.is_empty() && h.inverse().is_none()) =>
{
- let block_context = create_block(&value);
+ let block_context = create_block(value);
rc.push_block(block_context);
- let mut is_first = true;
+ let len = obj.len();
+
let obj_path = value.context_path();
- for (k, v) in obj.iter() {
+ for (i, (k, v)) in obj.iter().enumerate() {
if let Some(ref mut block) = rc.block_mut() {
- let key = to_json(k);
+ let is_first = i == 0usize;
+ let is_last = i == len - 1;
+ let key = to_json(k);
block.set_local_var("first", to_json(is_first));
+ block.set_local_var("last", to_json(is_last));
block.set_local_var("key", key.clone());
- update_block_context(block, obj_path, k.to_string(), is_first, &v);
- set_block_param(block, h, obj_path, &key, &v)?;
+ update_block_context(block, obj_path, k.to_string(), is_first, v);
+ set_block_param(block, h, obj_path, &key, v)?;
}
t.render(r, ctx, rc, out)?;
-
- if is_first {
- is_first = false;
- }
}
rc.pop_block();
@@ -159,7 +159,6 @@ pub static EACH_HELPER: EachHelper = EachHelper;
#[cfg(test)]
mod test {
- use crate::json::value::to_json;
use crate::registry::Registry;
use serde_json::value::Value as Json;
use std::collections::BTreeMap;
@@ -188,7 +187,10 @@ mod test {
)
.is_ok());
assert!(handlebars
- .register_template_string("t1", "{{#each this}}{{@first}}|{{@key}}:{{this}}|{{/each}}")
+ .register_template_string(
+ "t1",
+ "{{#each this}}{{@first}}|{{@last}}|{{@key}}:{{this}}|{{/each}}"
+ )
.is_ok());
let r0 = handlebars.render("t0", &vec![1u16, 2u16, 3u16]);
@@ -199,9 +201,13 @@ mod test {
let mut m: BTreeMap<String, u16> = BTreeMap::new();
m.insert("ftp".to_string(), 21);
+ m.insert("gopher".to_string(), 70);
m.insert("http".to_string(), 80);
let r1 = handlebars.render("t1", &m);
- assert_eq!(r1.ok().unwrap(), "true|ftp:21|false|http:80|".to_string());
+ assert_eq!(
+ r1.ok().unwrap(),
+ "true|false|ftp:21|false|false|gopher:70|false|true|http:80|".to_string()
+ );
}
#[test]
@@ -303,15 +309,15 @@ mod test {
assert!(handlebars
.register_template_string("t0", "{{#each a}}1{{else}}empty{{/each}}")
.is_ok());
- let m1 = btreemap! {
- "a".to_string() => Vec::<String>::new(),
- };
+ let m1 = json!({
+ "a": []
+ });
let r0 = handlebars.render("t0", &m1).unwrap();
assert_eq!(r0, "empty");
- let m2 = btreemap! {
- "b".to_string() => Vec::<String>::new()
- };
+ let m2 = json!({
+ "b": []
+ });
let r1 = handlebars.render("t0", &m2).unwrap();
assert_eq!(r1, "empty");
}
@@ -322,9 +328,9 @@ mod test {
assert!(handlebars
.register_template_string("t0", "{{#each a as |i|}}{{i}}{{/each}}")
.is_ok());
- let m1 = btreemap! {
- "a".to_string() => vec![1,2,3,4,5]
- };
+ let m1 = json!({
+ "a": [1,2,3,4,5]
+ });
let r0 = handlebars.render("t0", &m1).unwrap();
assert_eq!(r0, "12345");
}
@@ -337,10 +343,10 @@ mod test {
{{/each}}";
assert!(handlebars.register_template_string("t0", template).is_ok());
- let m = btreemap! {
- "ftp".to_string() => 21,
- "http".to_string() => 80
- };
+ let m = json!({
+ "ftp": 21,
+ "http": 80
+ });
let r0 = handlebars.render("t0", &m);
assert_eq!(r0.ok().unwrap(), "ftp:21|http:80|".to_string());
}
@@ -354,10 +360,10 @@ mod test {
assert!(handlebars.register_template_string("t0", template).is_ok());
- let m = btreemap! {
- "ftp".to_string() => 21,
- "http".to_string() => 80
- };
+ let m = json!({
+ "ftp": 21,
+ "http": 80
+ });
let r0 = handlebars.render("t0", &m);
assert_eq!(r0.ok().unwrap(), "ftp:21|http:80|".to_string());
}
@@ -371,12 +377,12 @@ mod test {
)
.is_ok());
- let data = btreemap! {
- "a".to_string() => to_json(&btreemap! {
- "b".to_string() => vec![btreemap!{"c".to_string() => vec![1]}]
- }),
- "d".to_string() => to_json(&1)
- };
+ let data = json!({
+ "a": {
+ "b": [{"c": [1]}]
+ },
+ "d": 1
+ });
let r0 = handlebars.render("t0", &data);
assert_eq!(r0.ok().unwrap(), "1".to_string());
@@ -389,10 +395,10 @@ mod test {
{{#if @first}}template<{{/if}}{{this}}{{#if @last}}>{{else}},{{/if}}\
{{/each}}{{/each}}";
assert!(handlebars.register_template_string("t0", template).is_ok());
- let data = btreemap! {
- "typearg".to_string() => vec!["T".to_string()],
- "variant".to_string() => vec!["1".to_string(), "2".to_string()]
- };
+ let data = json!({
+ "typearg": ["T"],
+ "variant": ["1", "2"]
+ });
let r0 = handlebars.render("t0", &data);
assert_eq!(r0.ok().unwrap(), "template<T>template<T>".to_string());
}
diff --git a/vendor/handlebars/src/helpers/helper_if.rs b/vendor/handlebars/src/helpers/helper_if.rs
index 5a6e42fc0..342c74567 100644
--- a/vendor/handlebars/src/helpers/helper_if.rs
+++ b/vendor/handlebars/src/helpers/helper_if.rs
@@ -36,7 +36,7 @@ impl HelperDef for IfHelper {
let tmpl = if value { h.template() } else { h.inverse() };
match tmpl {
- Some(ref t) => t.render(r, ctx, rc, out),
+ Some(t) => t.render(r, ctx, rc, out),
None => Ok(()),
}
}
@@ -137,6 +137,12 @@ mod test {
);
assert_eq!(
+ "yes\r\n",
+ hbs.render_template("{{#if a}}\r\nyes\r\n{{/if}}\r\n", &json!({"a": true}))
+ .unwrap()
+ );
+
+ assert_eq!(
"x\ny",
hbs.render_template("{{#if a}}x{{/if}}\ny", &json!({"a": true}))
.unwrap()
@@ -147,5 +153,37 @@ mod test {
hbs.render_template("{{#if a}}\nx\n{{^}}\ny\n{{/if}}\nz", &json!({"a": false}))
.unwrap()
);
+
+ assert_eq!(
+ r#"yes
+ foo
+ bar
+ baz"#,
+ hbs.render_template(
+ r#"yes
+ {{#if true}}
+ foo
+ bar
+ {{/if}}
+ baz"#,
+ &json!({})
+ )
+ .unwrap()
+ );
+
+ assert_eq!(
+ r#" foo
+ bar
+ baz"#,
+ hbs.render_template(
+ r#" {{#if true}}
+ foo
+ bar
+ {{/if}}
+ baz"#,
+ &json!({})
+ )
+ .unwrap()
+ );
}
}
diff --git a/vendor/handlebars/src/helpers/helper_lookup.rs b/vendor/handlebars/src/helpers/helper_lookup.rs
index bf887debe..8662d55a0 100644
--- a/vendor/handlebars/src/helpers/helper_lookup.rs
+++ b/vendor/handlebars/src/helpers/helper_lookup.rs
@@ -52,8 +52,6 @@ pub static LOOKUP_HELPER: LookupHelper = LookupHelper;
mod test {
use crate::registry::Registry;
- use std::collections::BTreeMap;
-
#[test]
fn test_lookup() {
let mut handlebars = Registry::new();
@@ -67,13 +65,11 @@ mod test {
.register_template_string("t2", "{{lookup kk \"a\"}}")
.is_ok());
- let mut m: BTreeMap<String, Vec<u16>> = BTreeMap::new();
- m.insert("v1".to_string(), vec![1u16, 2u16, 3u16]);
- m.insert("v2".to_string(), vec![9u16, 8u16, 7u16]);
+ let m = json!({"v1": [1,2,3], "v2": [9,8,7]});
- let m2 = btreemap! {
- "kk".to_string() => btreemap!{"a".to_string() => "world".to_string()}
- };
+ let m2 = json!({
+ "kk": {"a": "world"}
+ });
let r0 = handlebars.render("t0", &m);
assert_eq!(r0.ok().unwrap(), "987".to_string());
diff --git a/vendor/handlebars/src/helpers/helper_with.rs b/vendor/handlebars/src/helpers/helper_with.rs
index c4d31cd0e..2ea6bd4f6 100644
--- a/vendor/handlebars/src/helpers/helper_with.rs
+++ b/vendor/handlebars/src/helpers/helper_with.rs
@@ -25,7 +25,7 @@ impl HelperDef for WithHelper {
.ok_or_else(|| RenderError::new("Param not found for helper \"with\""))?;
if param.value().is_truthy(false) {
- let mut block = create_block(&param);
+ let mut block = create_block(param);
if let Some(block_param) = h.block_param() {
let mut params = BlockParams::new();
@@ -60,7 +60,6 @@ pub static WITH_HELPER: WithHelper = WithHelper;
#[cfg(test)]
mod test {
- use crate::json::value::to_json;
use crate::registry::Registry;
#[derive(Serialize)]
@@ -211,12 +210,12 @@ mod test {
assert!(handlebars
.register_template_string("t0", "{{#with a}}{{#with b}}{{../../d}}{{/with}}{{/with}}")
.is_ok());
- let data = btreemap! {
- "a".to_string() => to_json(&btreemap! {
- "b".to_string() => vec![btreemap!{"c".to_string() => vec![1]}]
- }),
- "d".to_string() => to_json(1)
- };
+ let data = json!({
+ "a": {
+ "b": [{"c": [1]}]
+ },
+ "d": 1
+ });
let r0 = handlebars.render("t0", &data);
assert_eq!(r0.ok().unwrap(), "1".to_string());
diff --git a/vendor/handlebars/src/helpers/mod.rs b/vendor/handlebars/src/helpers/mod.rs
index bfd50c1f4..ff5fa2495 100644
--- a/vendor/handlebars/src/helpers/mod.rs
+++ b/vendor/handlebars/src/helpers/mod.rs
@@ -32,7 +32,8 @@ pub type HelperResult = Result<(), RenderError>;
/// ```
/// use handlebars::*;
///
-/// fn upper(h: &Helper<'_, '_>, _: &Handlebars<'_>, _: &Context, rc: &mut RenderContext<'_, '_>, out: &mut Output)
+/// fn upper(h: &Helper<'_, '_>, _: &Handlebars<'_>, _: &Context, rc:
+/// &mut RenderContext<'_, '_>, out: &mut dyn Output)
/// -> HelperResult {
/// // get parameter from helper or throw an error
/// let param = h.param(0).and_then(|v| v.value().as_str()).unwrap_or("");
diff --git a/vendor/handlebars/src/helpers/scripting.rs b/vendor/handlebars/src/helpers/scripting.rs
index cec3b9763..abd567ae9 100644
--- a/vendor/handlebars/src/helpers/scripting.rs
+++ b/vendor/handlebars/src/helpers/scripting.rs
@@ -98,10 +98,16 @@ mod test {
let ast = engine.compile(&script).unwrap();
let params = vec![PathAndJson::new(None, ScopedJson::Derived(json!(true)))];
- let hash = btreemap! {
- "me" => PathAndJson::new(None, ScopedJson::Derived(json!("no"))),
- "you" => PathAndJson::new(None, ScopedJson::Derived(json!("yes"))),
- };
+
+ let mut hash = BTreeMap::new();
+ hash.insert(
+ "me",
+ PathAndJson::new(None, ScopedJson::Derived(json!("no"))),
+ );
+ hash.insert(
+ "you",
+ PathAndJson::new(None, ScopedJson::Derived(json!("yes"))),
+ );
let result = call_script_helper(&params, &hash, &engine, &ast)
.unwrap()
diff --git a/vendor/handlebars/src/json/path.rs b/vendor/handlebars/src/json/path.rs
index 8270371b2..17a7a91ee 100644
--- a/vendor/handlebars/src/json/path.rs
+++ b/vendor/handlebars/src/json/path.rs
@@ -6,7 +6,7 @@ use pest::Parser;
use crate::error::RenderError;
use crate::grammar::{HandlebarsParser, Rule};
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub enum PathSeg {
Named(String),
Ruled(Rule),
@@ -16,7 +16,7 @@ pub enum PathSeg {
///
/// It can be either a local variable like `@first`, `../@index`,
/// or a normal relative path like `a/b/c`.
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub enum Path {
Relative((Vec<PathSeg>, String)),
Local((usize, String, String)),
diff --git a/vendor/handlebars/src/lib.rs b/vendor/handlebars/src/lib.rs
index 7e0aac830..1f9ab1ed3 100644
--- a/vendor/handlebars/src/lib.rs
+++ b/vendor/handlebars/src/lib.rs
@@ -1,4 +1,4 @@
-#![doc(html_root_url = "https://docs.rs/handlebars/4.1.0")]
+#![doc(html_root_url = "https://docs.rs/handlebars/4.3.3")]
#![cfg_attr(docsrs, feature(doc_cfg))]
//! # Handlebars
//!
@@ -73,7 +73,7 @@
//! Every time I look into a templating system, I will investigate its
//! support for [template inheritance][t].
//!
-//! [t]: https://docs.djangoproject.com/en/1.9/ref/templates/language/#template-inheritance
+//! [t]: https://docs.djangoproject.com/en/3.2/ref/templates/language/#template-inheritance
//!
//! Template include is not sufficient for template reuse. In most cases
//! you will need a skeleton of page as parent (header, footer, etc.), and
@@ -155,7 +155,7 @@
//! use handlebars::Handlebars;
//! use std::collections::BTreeMap;
//!
-//! # fn main() -> Result<(), Box<Error>> {
+//! # fn main() -> Result<(), Box<dyn Error>> {
//! let mut handlebars = Handlebars::new();
//! let source = "hello {{world}}";
//!
@@ -166,6 +166,14 @@
//! # }
//! ```
//!
+//! #### Additional features for loading template from
+//!
+//! * Feature `dir_source` enables template loading
+//! `register_templates_directory` from given directory.
+//! * Feature `rust-embed` enables template loading
+//! `register_embed_templates` from embedded resources in rust struct
+//! generated with `RustEmbed`.
+//!
//! ### Rendering Something
//!
//! Since handlebars is originally based on JavaScript type system. It supports dynamic features like duck-typing, truthy/falsey values. But for a static language like Rust, this is a little difficult. As a solution, we are using the `serde_json::value::Value` internally for data rendering.
@@ -188,7 +196,7 @@
//! age: i16,
//! }
//!
-//! # fn main() -> Result<(), Box<Error>> {
+//! # fn main() -> Result<(), Box<dyn Error>> {
//! let source = "Hello, {{name}}";
//!
//! let mut handlebars = Handlebars::new();
@@ -367,13 +375,8 @@
#[macro_use]
extern crate log;
-#[cfg(test)]
-#[macro_use]
-extern crate maplit;
#[macro_use]
extern crate pest_derive;
-#[macro_use]
-extern crate quick_error;
#[cfg(test)]
#[macro_use]
extern crate serde_derive;
diff --git a/vendor/handlebars/src/macros.rs b/vendor/handlebars/src/macros.rs
index 14cb0152c..bd1eab0bb 100644
--- a/vendor/handlebars/src/macros.rs
+++ b/vendor/handlebars/src/macros.rs
@@ -38,7 +38,7 @@
#[macro_export]
macro_rules! handlebars_helper {
- ($struct_name:ident: |$($name:ident: $tpe:tt),*
+ ($struct_name:ident: |$($name:ident: $tpe:tt$(<$($gen:ty),+>)?),*
$($(,)?{$($hash_name:ident: $hash_tpe:tt=$dft_val:literal),*})?
$($(,)?*$args:ident)?
$($(,)?**$kwargs:ident)?|
@@ -71,11 +71,11 @@ macro_rules! handlebars_helper {
stringify!($struct_name), stringify!($name),
)))
.and_then(|x|
- handlebars_helper!(@as_json_value x, $tpe)
+ handlebars_helper!(@as_json_value x, $tpe$(<$($gen),+>)?)
.ok_or_else(|| $crate::RenderError::new(&format!(
"`{}` helper: Couldn't convert parameter {} to type `{}`. \
It's {:?} as JSON. Got these params: {:?}",
- stringify!($struct_name), stringify!($name), stringify!($tpe),
+ stringify!($struct_name), stringify!($name), stringify!($tpe$(<$($gen),+>)?),
x, h.params(),
)))
)?;
@@ -117,6 +117,7 @@ macro_rules! handlebars_helper {
(@as_json_value $x:ident, bool) => { $x.as_bool() };
(@as_json_value $x:ident, null) => { $x.as_null() };
(@as_json_value $x:ident, Json) => { Some($x) };
+ (@as_json_value $x:ident, $tpe:tt$(<$($gen:ty),+>)?) => { serde_json::from_value::<$tpe$(<$($gen),+>)?>($x.clone()).ok() };
}
#[cfg(feature = "no_logging")]
diff --git a/vendor/handlebars/src/output.rs b/vendor/handlebars/src/output.rs
index f1c5865a5..67e62b849 100644
--- a/vendor/handlebars/src/output.rs
+++ b/vendor/handlebars/src/output.rs
@@ -46,3 +46,9 @@ impl StringOutput {
String::from_utf8(self.buf)
}
}
+
+impl Default for StringOutput {
+ fn default() -> Self {
+ StringOutput::new()
+ }
+}
diff --git a/vendor/handlebars/src/partial.rs b/vendor/handlebars/src/partial.rs
index a472d5d14..bcf9803fd 100644
--- a/vendor/handlebars/src/partial.rs
+++ b/vendor/handlebars/src/partial.rs
@@ -20,7 +20,7 @@ fn find_partial<'reg: 'rc, 'rc: 'a, 'a>(
d: &Decorator<'reg, 'rc>,
name: &str,
) -> Result<Option<Cow<'a, Template>>, RenderError> {
- if let Some(ref partial) = rc.get_partial(name) {
+ if let Some(partial) = rc.get_partial(name) {
return Ok(Some(Cow::Borrowed(partial)));
}
@@ -52,29 +52,38 @@ pub fn expand_partial<'reg: 'rc, 'rc>(
return Err(RenderError::new("Cannot include self in >"));
}
- // if tname == PARTIAL_BLOCK
let partial = find_partial(rc, r, d, tname)?;
if let Some(t) = partial {
// clone to avoid lifetime issue
// FIXME refactor this to avoid
let mut local_rc = rc.clone();
+
+ // if tname == PARTIAL_BLOCK
let is_partial_block = tname == PARTIAL_BLOCK;
+ // add partial block depth there are consecutive partial
+ // blocks in the stack.
if is_partial_block {
local_rc.inc_partial_block_depth();
+ } else {
+ // depth cannot be lower than 0, which is guaranted in the
+ // `dec_partial_block_depth` method
+ local_rc.dec_partial_block_depth();
}
+ let mut block = None;
let mut block_created = false;
- if let Some(ref base_path) = d.param(0).and_then(|p| p.context_path()) {
+ // create context if param given
+ if let Some(base_path) = d.param(0).and_then(|p| p.context_path()) {
// path given, update base_path
- let mut block = BlockContext::new();
- *block.base_path_mut() = base_path.to_vec();
- block_created = true;
- local_rc.push_block(block);
- } else if !d.hash().is_empty() {
- let mut block = BlockContext::new();
+ let mut block_inner = BlockContext::new();
+ *block_inner.base_path_mut() = base_path.to_vec();
+ block = Some(block_inner);
+ }
+
+ if !d.hash().is_empty() {
// hash given, update base_value
let hash_ctx = d
.hash()
@@ -86,9 +95,25 @@ pub fn expand_partial<'reg: 'rc, 'rc>(
local_rc.evaluate2(ctx, &Path::current())?.as_json(),
&hash_ctx,
);
- block.set_base_value(merged_context);
+
+ if let Some(ref mut block_inner) = block {
+ block_inner.set_base_value(merged_context);
+ } else {
+ let mut block_inner = BlockContext::new();
+ block_inner.set_base_value(merged_context);
+ block = Some(block_inner);
+ }
+ }
+
+ if let Some(block_inner) = block {
+ // because block is moved here, we need another bool variable to track
+ // its status for later cleanup
block_created = true;
- local_rc.push_block(block);
+ // clear blocks to prevent block params from parent
+ // template to be leaked into partials
+ // see `test_partial_context_issue_495` for the case.
+ local_rc.clear_blocks();
+ local_rc.push_block(block_inner);
}
// @partial-block
@@ -96,6 +121,9 @@ pub fn expand_partial<'reg: 'rc, 'rc>(
local_rc.push_partial_block(pb);
}
+ // indent
+ local_rc.set_indent_string(d.indent());
+
let result = t.render(r, ctx, &mut local_rc, out);
// cleanup
@@ -103,10 +131,6 @@ pub fn expand_partial<'reg: 'rc, 'rc>(
local_rc.pop_block();
}
- if is_partial_block {
- local_rc.dec_partial_block_depth();
- }
-
if d.template().is_some() {
local_rc.pop_partial_block();
}
@@ -174,10 +198,7 @@ mod test {
"include navbar".to_string()
);
assert_eq!(
- handlebars
- .render("t6", &btreemap! {"a".to_string() => "2".to_string()})
- .ok()
- .unwrap(),
+ handlebars.render("t6", &json!({"a": "2"})).ok().unwrap(),
"2".to_string()
);
assert_eq!(
@@ -258,6 +279,19 @@ mod test {
}
#[test]
+ fn teset_partial_context_with_both_hash_and_param() {
+ let mut hbs = Registry::new();
+ hbs.register_template_string("one", "This is a test. {{> two this name=\"fred\" }}")
+ .unwrap();
+ hbs.register_template_string("two", "Lets test {{name}} and {{root_name}}")
+ .unwrap();
+ assert_eq!(
+ "This is a test. Lets test fred and tom",
+ hbs.render("one", &json!({"root_name": "tom"})).unwrap()
+ );
+ }
+
+ #[test]
fn test_partial_subexpression_context_hash() {
let mut hbs = Registry::new();
hbs.register_template_string("one", "This is a test. {{> (x @root) name=\"fred\" }}")
@@ -297,7 +331,7 @@ mod test {
}
#[test]
- fn test_nested_partials() {
+ fn test_nested_partial_block() {
let mut handlebars = Registry::new();
let template1 = "<outer>{{> @partial-block }}</outer>";
let template2 = "{{#> t1 }}<inner>{{> @partial-block }}</inner>{{/ t1 }}";
@@ -330,4 +364,293 @@ mod test {
"fruit: carrot,fruit: tomato,"
);
}
+
+ #[test]
+ fn line_stripping_with_inline_and_partial() {
+ let tpl0 = r#"{{#*inline "foo"}}foo
+{{/inline}}
+{{> foo}}
+{{> foo}}
+{{> foo}}"#;
+ let tpl1 = r#"{{#*inline "foo"}}foo{{/inline}}
+{{> foo}}
+{{> foo}}
+{{> foo}}"#;
+
+ let hbs = Registry::new();
+ assert_eq!(
+ r#"foo
+foo
+foo
+"#,
+ hbs.render_template(tpl0, &json!({})).unwrap()
+ );
+ assert_eq!(
+ r#"
+foofoofoo"#,
+ hbs.render_template(tpl1, &json!({})).unwrap()
+ );
+ }
+
+ #[test]
+ fn test_partial_indent() {
+ let outer = r#" {{> inner inner_solo}}
+
+{{#each inners}}
+ {{> inner}}
+{{/each}}
+
+ {{#each inners}}
+ {{> inner}}
+ {{/each}}
+"#;
+ let inner = r#"name: {{name}}
+"#;
+
+ let mut hbs = Registry::new();
+
+ hbs.register_template_string("inner", inner).unwrap();
+ hbs.register_template_string("outer", outer).unwrap();
+
+ let result = hbs
+ .render(
+ "outer",
+ &json!({
+ "inner_solo": {"name": "inner_solo"},
+ "inners": [
+ {"name": "hello"},
+ {"name": "there"}
+ ]
+ }),
+ )
+ .unwrap();
+
+ assert_eq!(
+ result,
+ r#" name: inner_solo
+
+ name: hello
+ name: there
+
+ name: hello
+ name: there
+"#
+ );
+ }
+ // Rule::partial_expression should not trim leading indent by default
+
+ #[test]
+ fn test_partial_prevent_indent() {
+ let outer = r#" {{> inner inner_solo}}
+
+{{#each inners}}
+ {{> inner}}
+{{/each}}
+
+ {{#each inners}}
+ {{> inner}}
+ {{/each}}
+"#;
+ let inner = r#"name: {{name}}
+"#;
+
+ let mut hbs = Registry::new();
+ hbs.set_prevent_indent(true);
+
+ hbs.register_template_string("inner", inner).unwrap();
+ hbs.register_template_string("outer", outer).unwrap();
+
+ let result = hbs
+ .render(
+ "outer",
+ &json!({
+ "inner_solo": {"name": "inner_solo"},
+ "inners": [
+ {"name": "hello"},
+ {"name": "there"}
+ ]
+ }),
+ )
+ .unwrap();
+
+ assert_eq!(
+ result,
+ r#" name: inner_solo
+
+ name: hello
+ name: there
+
+ name: hello
+ name: there
+"#
+ );
+ }
+
+ #[test]
+ fn test_nested_partials() {
+ let mut hb = Registry::new();
+ hb.register_template_string("partial", "{{> @partial-block}}")
+ .unwrap();
+ hb.register_template_string(
+ "index",
+ r#"{{#>partial}}
+ Yo
+ {{#>partial}}
+ Yo 2
+ {{/partial}}
+{{/partial}}"#,
+ )
+ .unwrap();
+ assert_eq!(
+ r#" Yo
+ Yo 2
+"#,
+ hb.render("index", &()).unwrap()
+ );
+
+ hb.register_template_string("partial2", "{{> @partial-block}}")
+ .unwrap();
+ let r2 = hb
+ .render_template(
+ r#"{{#> partial}}
+{{#> partial2}}
+:(
+{{/partial2}}
+{{/partial}}"#,
+ &(),
+ )
+ .unwrap();
+ assert_eq!(":(\n", r2);
+ }
+
+ #[test]
+ fn test_partial_context_issue_495() {
+ let mut hb = Registry::new();
+ hb.register_template_string(
+ "t1",
+ r#"{{~#*inline "displayName"~}}
+Template:{{name}}
+{{/inline}}
+{{#each data as |name|}}
+Name:{{name}}
+{{>displayName name="aaaa"}}
+{{/each}}"#,
+ )
+ .unwrap();
+
+ hb.register_template_string(
+ "t1",
+ r#"{{~#*inline "displayName"~}}
+Template:{{this}}
+{{/inline}}
+{{#each data as |name|}}
+Name:{{name}}
+{{>displayName}}
+{{/each}}"#,
+ )
+ .unwrap();
+
+ let data = json!({
+ "data": ["hudel", "test"]
+ });
+
+ assert_eq!(
+ r#"Name:hudel
+Template:hudel
+Name:test
+Template:test
+"#,
+ hb.render("t1", &data).unwrap()
+ );
+ }
+
+ #[test]
+ fn test_multiline_partial_indent() {
+ let mut hb = Registry::new();
+
+ hb.register_template_string(
+ "t1",
+ r#"{{#*inline "thepartial"}}
+ inner first line
+ inner second line
+{{/inline}}
+ {{> thepartial}}
+outer third line"#,
+ )
+ .unwrap();
+ assert_eq!(
+ r#" inner first line
+ inner second line
+outer third line"#,
+ hb.render("t1", &()).unwrap()
+ );
+
+ hb.register_template_string(
+ "t2",
+ r#"{{#*inline "thepartial"}}inner first line
+inner second line
+{{/inline}}
+ {{> thepartial}}
+outer third line"#,
+ )
+ .unwrap();
+ assert_eq!(
+ r#" inner first line
+ inner second line
+outer third line"#,
+ hb.render("t2", &()).unwrap()
+ );
+
+ hb.register_template_string(
+ "t3",
+ r#"{{#*inline "thepartial"}}{{a}}{{/inline}}
+ {{> thepartial}}
+outer third line"#,
+ )
+ .unwrap();
+ assert_eq!(
+ r#"
+ inner first line
+ inner second lineouter third line"#,
+ hb.render("t3", &json!({"a": "inner first line\ninner second line"}))
+ .unwrap()
+ );
+
+ hb.register_template_string(
+ "t4",
+ r#"{{#*inline "thepartial"}}
+ inner first line
+ inner second line
+{{/inline}}
+ {{~> thepartial}}
+outer third line"#,
+ )
+ .unwrap();
+ assert_eq!(
+ r#" inner first line
+ inner second line
+outer third line"#,
+ hb.render("t4", &()).unwrap()
+ );
+
+ let mut hb2 = Registry::new();
+ hb2.set_prevent_indent(true);
+
+ hb2.register_template_string(
+ "t1",
+ r#"{{#*inline "thepartial"}}
+ inner first line
+ inner second line
+{{/inline}}
+ {{> thepartial}}
+outer third line"#,
+ )
+ .unwrap();
+ assert_eq!(
+ r#" inner first line
+ inner second line
+outer third line"#,
+ hb2.render("t1", &()).unwrap()
+ )
+ }
}
diff --git a/vendor/handlebars/src/registry.rs b/vendor/handlebars/src/registry.rs
index e7f5f1cfd..438f8573c 100644
--- a/vendor/handlebars/src/registry.rs
+++ b/vendor/handlebars/src/registry.rs
@@ -17,12 +17,10 @@ use crate::output::{Output, StringOutput, WriteOutput};
use crate::render::{RenderContext, Renderable};
use crate::sources::{FileSource, Source};
use crate::support::str::{self, StringWriter};
-use crate::template::Template;
+use crate::template::{Template, TemplateOptions};
#[cfg(feature = "dir_source")]
-use std::path;
-#[cfg(feature = "dir_source")]
-use walkdir::{DirEntry, WalkDir};
+use walkdir::WalkDir;
#[cfg(feature = "script_helper")]
use rhai::Engine;
@@ -30,6 +28,9 @@ use rhai::Engine;
#[cfg(feature = "script_helper")]
use crate::helpers::scripting::ScriptHelper;
+#[cfg(feature = "rust-embed")]
+use rust_embed::RustEmbed;
+
/// This type represents an *escape fn*, that is a function whose purpose it is
/// to escape potentially problematic characters in a string.
///
@@ -62,6 +63,7 @@ pub struct Registry<'reg> {
escape_fn: EscapeFn,
strict_mode: bool,
dev_mode: bool,
+ prevent_indent: bool,
#[cfg(feature = "script_helper")]
pub(crate) engine: Arc<Engine>,
@@ -90,21 +92,6 @@ impl<'reg> Default for Registry<'reg> {
}
}
-#[cfg(feature = "dir_source")]
-fn filter_file(entry: &DirEntry, suffix: &str) -> bool {
- let path = entry.path();
-
- // ignore hidden files, emacs buffers and files with wrong suffix
- !path.is_file()
- || path
- .file_name()
- .map(|s| {
- let ds = s.to_string_lossy();
- ds.starts_with('.') || ds.starts_with('#') || !ds.ends_with(suffix)
- })
- .unwrap_or(true)
-}
-
#[cfg(feature = "script_helper")]
fn rhai_engine() -> Engine {
Engine::new()
@@ -120,6 +107,7 @@ impl<'reg> Registry<'reg> {
escape_fn: Arc::new(html_escape),
strict_mode: false,
dev_mode: false,
+ prevent_indent: false,
#[cfg(feature = "script_helper")]
engine: Arc::new(rhai_engine()),
#[cfg(feature = "script_helper")]
@@ -178,7 +166,7 @@ impl<'reg> Registry<'reg> {
/// Return dev mode state, default is false
///
/// With dev mode turned on, handlebars enables a set of development
- /// firendly features, that may affect its performance.
+ /// friendly features, that may affect its performance.
pub fn dev_mode(&self) -> bool {
self.dev_mode
}
@@ -186,9 +174,30 @@ impl<'reg> Registry<'reg> {
/// Enable or disable dev mode
///
/// With dev mode turned on, handlebars enables a set of development
- /// firendly features, that may affect its performance.
+ /// friendly features, that may affect its performance.
+ ///
+ /// **Note that you have to enable dev mode before adding templates to
+ /// the registry**. Otherwise it won't take effect at all.
pub fn set_dev_mode(&mut self, enabled: bool) {
self.dev_mode = enabled;
+
+ // clear template source when disabling dev mode
+ if !enabled {
+ self.template_sources.clear();
+ }
+ }
+
+ /// Enable or disable indent for partial include tag `{{>}}`
+ ///
+ /// By default handlebars keeps indent whitespaces for partial
+ /// include tag, to change this behaviour, set this toggle to `true`.
+ pub fn set_prevent_indent(&mut self, enable: bool) {
+ self.prevent_indent = enable;
+ }
+
+ /// Return state for `prevent_indent` option, default to `false`.
+ pub fn prevent_indent(&self) -> bool {
+ self.prevent_indent
}
/// Register a `Template`
@@ -196,6 +205,9 @@ impl<'reg> Registry<'reg> {
/// This is infallible since the template has already been parsed and
/// insert cannot fail. If there is an existing template with this name it
/// will be overwritten.
+ ///
+ /// Dev mode doesn't apply for pre-compiled template because it's lifecycle
+ /// is not managed by the registry.
pub fn register_template(&mut self, name: &str, tpl: Template) {
self.templates.insert(name.to_string(), tpl);
}
@@ -211,7 +223,13 @@ impl<'reg> Registry<'reg> {
where
S: AsRef<str>,
{
- let template = Template::compile_with_name(tpl_str, name.to_owned())?;
+ let template = Template::compile2(
+ tpl_str.as_ref(),
+ TemplateOptions {
+ name: Some(name.to_owned()),
+ prevent_indent: self.prevent_indent,
+ },
+ )?;
self.register_template(name, template);
Ok(())
}
@@ -227,7 +245,10 @@ impl<'reg> Registry<'reg> {
self.register_template_string(name, partial_str)
}
- /// Register a template from a path
+ /// Register a template from a path on file system
+ ///
+ /// If dev mode is enabled, the registry will keep reading the template file
+ /// from file system everytime it's visited.
pub fn register_template_file<P>(
&mut self,
name: &str,
@@ -262,11 +283,14 @@ impl<'reg> Registry<'reg> {
///
/// This method is not available by default.
/// You will need to enable the `dir_source` feature to use it.
+ ///
+ /// When dev_mode enabled, like `register_template_file`, templates is reloaded
+ /// from file system everytime it's visied.
#[cfg(feature = "dir_source")]
#[cfg_attr(docsrs, doc(cfg(feature = "dir_source")))]
pub fn register_templates_directory<P>(
&mut self,
- tpl_extension: &'static str,
+ tpl_extension: &str,
dir_path: P,
) -> Result<(), TemplateError>
where
@@ -274,40 +298,88 @@ impl<'reg> Registry<'reg> {
{
let dir_path = dir_path.as_ref();
- let prefix_len = if dir_path
- .to_string_lossy()
- .ends_with(|c| c == '\\' || c == '/')
- // `/` will work on windows too so we still need to check
- {
- dir_path.to_string_lossy().len()
- } else {
- dir_path.to_string_lossy().len() + 1
- };
+ // Allowing dots at the beginning as to not break old
+ // applications.
+ let tpl_extension = tpl_extension.strip_prefix('.').unwrap_or(tpl_extension);
let walker = WalkDir::new(dir_path);
let dir_iter = walker
.min_depth(1)
.into_iter()
- .filter(|e| e.is_ok() && !filter_file(e.as_ref().unwrap(), tpl_extension));
+ .filter_map(|e| e.ok().map(|e| e.into_path()))
+ // Checks if extension matches
+ .filter(|tpl_path| {
+ tpl_path
+ .extension()
+ .map(|extension| extension == tpl_extension)
+ .unwrap_or(false)
+ })
+ // Rejects any hidden or temporary files.
+ .filter(|tpl_path| {
+ tpl_path
+ .file_stem()
+ .map(|stem| stem.to_string_lossy())
+ .map(|stem| !(stem.starts_with('.') || stem.starts_with('#')))
+ .unwrap_or(false)
+ })
+ .filter_map(|tpl_path| {
+ tpl_path
+ .strip_prefix(dir_path)
+ .ok()
+ .map(|tpl_canonical_name| {
+ tpl_canonical_name
+ .with_extension("")
+ .components()
+ .map(|component| component.as_os_str().to_string_lossy())
+ .collect::<Vec<_>>()
+ .join("/")
+ })
+ .map(|tpl_canonical_name| (tpl_canonical_name, tpl_path))
+ });
+
+ for (tpl_canonical_name, tpl_path) in dir_iter {
+ self.register_template_file(&tpl_canonical_name, &tpl_path)?;
+ }
- for entry in dir_iter {
- let entry = entry?;
+ Ok(())
+ }
- let tpl_path = entry.path();
- let tpl_file_path = entry.path().to_string_lossy();
+ /// Register templates using a
+ /// [RustEmbed](https://github.com/pyros2097/rust-embed) type
+ ///
+ /// File names from embed struct are used as template name.
+ ///
+ /// ```skip
+ /// #[derive(RustEmbed)]
+ /// #[folder = "templates"]
+ /// struct Assets;
+ ///
+ /// let mut hbs = Handlebars::new();
+ /// hbs.register_embed_templates::<Assets>();
+ /// ```
+ ///
+ #[cfg(feature = "rust-embed")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "rust-embed")))]
+ pub fn register_embed_templates<E>(&mut self) -> Result<(), TemplateError>
+ where
+ E: RustEmbed,
+ {
+ for item in E::iter() {
+ let file_name = item.as_ref();
+ if let Some(file) = E::get(file_name) {
+ let data = file.data;
- let tpl_name = &tpl_file_path[prefix_len..tpl_file_path.len() - tpl_extension.len()];
- // replace platform path separator with our internal one
- let tpl_canonical_name = tpl_name.replace(path::MAIN_SEPARATOR, "/");
- self.register_template_file(&tpl_canonical_name, &tpl_path)?;
+ let tpl_content = String::from_utf8_lossy(data.as_ref());
+ self.register_template_string(file_name, tpl_content)?;
+ }
}
-
Ok(())
}
/// Remove a template from the registry
pub fn unregister_template(&mut self, name: &str) {
self.templates.remove(name);
+ self.template_sources.remove(name);
}
/// Register a helper
@@ -335,7 +407,6 @@ impl<'reg> Registry<'reg> {
/// (value * 100).to_string() + label
/// ```
///
- ///
#[cfg(feature = "script_helper")]
#[cfg_attr(docsrs, doc(cfg(feature = "script_helper")))]
pub fn register_script_helper(&mut self, name: &str, script: &str) -> Result<(), ScriptError> {
@@ -347,6 +418,9 @@ impl<'reg> Registry<'reg> {
}
/// Register a [rhai](https://docs.rs/rhai/) script from file
+ ///
+ /// When dev mode is enable, script file is reloaded from original file
+ /// everytime it is called.
#[cfg(feature = "script_helper")]
#[cfg_attr(docsrs, doc(cfg(feature = "script_helper")))]
pub fn register_script_helper_file<P>(
@@ -365,6 +439,22 @@ impl<'reg> Registry<'reg> {
self.register_script_helper(name, &script)
}
+ /// Borrow a read-only reference to current rhai engine
+ #[cfg(feature = "script_helper")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "script_helper")))]
+ pub fn engine(&self) -> &Engine {
+ self.engine.as_ref()
+ }
+
+ /// Set a custom rhai engine for the registry.
+ ///
+ /// *Note that* you need to set custom engine before adding scripts.
+ #[cfg(feature = "script_helper")]
+ #[cfg_attr(docsrs, doc(cfg(feature = "script_helper")))]
+ pub fn set_engine(&mut self, engine: Engine) {
+ self.engine = Arc::new(engine);
+ }
+
/// Register a decorator
pub fn register_decorator(
&mut self,
@@ -389,7 +479,7 @@ impl<'reg> Registry<'reg> {
/// Get a reference to the current *escape fn*.
pub fn get_escape_fn(&self) -> &dyn Fn(&str) -> String {
- &*self.escape_fn
+ self.escape_fn.as_ref()
}
/// Return `true` if a template is registered for the given name
@@ -411,7 +501,15 @@ impl<'reg> Registry<'reg> {
let r = source
.load()
.map_err(|e| TemplateError::from((e, name.to_owned())))
- .and_then(|tpl_str| Template::compile_with_name(tpl_str, name.to_owned()))
+ .and_then(|tpl_str| {
+ Template::compile2(
+ tpl_str.as_ref(),
+ TemplateOptions {
+ name: Some(name.to_owned()),
+ prevent_indent: self.prevent_indent,
+ },
+ )
+ })
.map(Cow::Owned)
.map_err(RenderError::from);
Some(r)
@@ -433,6 +531,7 @@ impl<'reg> Registry<'reg> {
}
/// Return a registered helper
+ #[inline]
pub(crate) fn get_or_load_helper(
&'reg self,
name: &str,
@@ -460,6 +559,7 @@ impl<'reg> Registry<'reg> {
}
/// Return a registered decorator
+ #[inline]
pub(crate) fn get_decorator(
&self,
name: &str,
@@ -468,6 +568,10 @@ impl<'reg> Registry<'reg> {
}
/// Return all templates registered
+ ///
+ /// **Note that** in dev mode, the template returned from this method may
+ /// not reflect its latest state. This method doesn't try to reload templates
+ /// from its source.
pub fn get_templates(&self) -> &HashMap<String, Template> {
&self.templates
}
@@ -475,6 +579,7 @@ impl<'reg> Registry<'reg> {
/// Unregister all templates
pub fn clear_templates(&mut self) {
self.templates.clear();
+ self.template_sources.clear();
}
#[inline]
@@ -489,7 +594,7 @@ impl<'reg> Registry<'reg> {
{
self.get_or_load_template(name).and_then(|t| {
let mut render_context = RenderContext::new(t.name.as_ref());
- t.render(self, &ctx, &mut render_context, output)
+ t.render(self, ctx, &mut render_context, output)
})
}
@@ -516,7 +621,7 @@ impl<'reg> Registry<'reg> {
output.into_string().map_err(RenderError::from)
}
- /// Render a registered template and write some data to the `std::io::Write`
+ /// Render a registered template and write data to the `std::io::Write`
pub fn render_to_write<T, W>(&self, name: &str, data: &T, writer: W) -> Result<(), RenderError>
where
T: Serialize,
@@ -527,6 +632,21 @@ impl<'reg> Registry<'reg> {
self.render_to_output(name, &ctx, &mut output)
}
+ /// Render a registered template using reusable `Context`, and write data to
+ /// the `std::io::Write`
+ pub fn render_with_context_to_write<W>(
+ &self,
+ name: &str,
+ ctx: &Context,
+ writer: W,
+ ) -> Result<(), RenderError>
+ where
+ W: Write,
+ {
+ let mut output = WriteOutput::new(writer);
+ self.render_to_output(name, ctx, &mut output)
+ }
+
/// Render a template string using current registry without registering it
pub fn render_template<T>(&self, template_string: &str, data: &T) -> Result<String, RenderError>
where
@@ -537,23 +657,52 @@ impl<'reg> Registry<'reg> {
Ok(writer.into_string())
}
- /// Render a template string using reused context data
+ /// Render a template string using reusable context data
pub fn render_template_with_context(
&self,
template_string: &str,
ctx: &Context,
) -> Result<String, RenderError> {
- let tpl = Template::compile(template_string)?;
+ let tpl = Template::compile2(
+ template_string,
+ TemplateOptions {
+ prevent_indent: self.prevent_indent,
+ ..Default::default()
+ },
+ )?;
let mut out = StringOutput::new();
{
let mut render_context = RenderContext::new(None);
- tpl.render(self, &ctx, &mut render_context, &mut out)?;
+ tpl.render(self, ctx, &mut render_context, &mut out)?;
}
out.into_string().map_err(RenderError::from)
}
+ /// Render a template string using resuable context, and write data into
+ /// `std::io::Write`
+ pub fn render_template_with_context_to_write<W>(
+ &self,
+ template_string: &str,
+ ctx: &Context,
+ writer: W,
+ ) -> Result<(), RenderError>
+ where
+ W: Write,
+ {
+ let tpl = Template::compile2(
+ template_string,
+ TemplateOptions {
+ prevent_indent: self.prevent_indent,
+ ..Default::default()
+ },
+ )?;
+ let mut render_context = RenderContext::new(None);
+ let mut out = WriteOutput::new(writer);
+ tpl.render(self, ctx, &mut render_context, &mut out)
+ }
+
/// Render a template string using current registry without registering it
pub fn render_template_to_write<T, W>(
&self,
@@ -565,11 +714,8 @@ impl<'reg> Registry<'reg> {
T: Serialize,
W: Write,
{
- let tpl = Template::compile(template_string)?;
let ctx = Context::wraps(data)?;
- let mut render_context = RenderContext::new(None);
- let mut out = WriteOutput::new(writer);
- tpl.render(self, &ctx, &mut render_context, &mut out)
+ self.render_template_with_context_to_write(template_string, &ctx, writer)
}
}
@@ -944,8 +1090,7 @@ mod test {
.unwrap();
assert_eq!(
"0123",
- reg.render_with_context("t0", &Context::wraps(&data).unwrap())
- .unwrap()
+ reg.render_with_context("t0", &Context::from(data)).unwrap()
);
}
@@ -1089,4 +1234,17 @@ mod test {
dir.close().unwrap();
}
+
+ #[test]
+ #[cfg(feature = "script_helper")]
+ fn test_engine_access() {
+ use rhai::Engine;
+
+ let mut registry = Registry::new();
+ let mut eng = Engine::new();
+ eng.set_max_string_size(1000);
+ registry.set_engine(eng);
+
+ assert_eq!(1000, registry.engine().max_string_size());
+ }
}
diff --git a/vendor/handlebars/src/render.rs b/vendor/handlebars/src/render.rs
index 188ea221a..036352b3a 100644
--- a/vendor/handlebars/src/render.rs
+++ b/vendor/handlebars/src/render.rs
@@ -14,6 +14,7 @@ use crate::json::value::{JsonRender, PathAndJson, ScopedJson};
use crate::output::{Output, StringOutput};
use crate::partial;
use crate::registry::Registry;
+use crate::support;
use crate::template::TemplateElement::*;
use crate::template::{
BlockParam, DecoratorTemplate, HelperTemplate, Parameter, Template, TemplateElement,
@@ -47,10 +48,11 @@ pub struct RenderContextInner<'reg: 'rc, 'rc> {
/// root template name
root_template: Option<&'reg String>,
disable_escape: bool,
+ indent_string: Option<&'reg String>,
}
impl<'reg: 'rc, 'rc> RenderContext<'reg, 'rc> {
- /// Create a render context from a `Write`
+ /// Create a render context
pub fn new(root_template: Option<&'reg String>) -> RenderContext<'reg, 'rc> {
let inner = Rc::new(RenderContextInner {
partials: BTreeMap::new(),
@@ -60,6 +62,7 @@ impl<'reg: 'rc, 'rc> RenderContext<'reg, 'rc> {
current_template: None,
root_template,
disable_escape: false,
+ indent_string: None,
});
let mut blocks = VecDeque::with_capacity(5);
@@ -73,7 +76,6 @@ impl<'reg: 'rc, 'rc> RenderContext<'reg, 'rc> {
}
}
- // TODO: better name
pub(crate) fn new_for_block(&self) -> RenderContext<'reg, 'rc> {
let inner = self.inner.clone();
@@ -101,6 +103,10 @@ impl<'reg: 'rc, 'rc> RenderContext<'reg, 'rc> {
self.blocks.pop_front();
}
+ pub(crate) fn clear_blocks(&mut self) {
+ self.blocks.clear();
+ }
+
/// Borrow a reference to current block context
pub fn block(&self) -> Option<&BlockContext<'reg>> {
self.blocks.front()
@@ -190,7 +196,19 @@ impl<'reg: 'rc, 'rc> RenderContext<'reg, 'rc> {
}
pub(crate) fn dec_partial_block_depth(&mut self) {
- self.inner_mut().partial_block_depth -= 1;
+ let depth = &mut self.inner_mut().partial_block_depth;
+ if *depth > 0 {
+ *depth -= 1;
+ }
+ }
+
+ pub(crate) fn set_indent_string(&mut self, indent: Option<&'reg String>) {
+ self.inner_mut().indent_string = indent;
+ }
+
+ #[inline]
+ pub(crate) fn get_indent_string(&self) -> Option<&'reg String> {
+ self.inner.indent_string
}
/// Remove a registered partial
@@ -201,7 +219,7 @@ impl<'reg: 'rc, 'rc> RenderContext<'reg, 'rc> {
fn get_local_var(&self, level: usize, name: &str) -> Option<&Json> {
self.blocks
.get(level)
- .and_then(|blk| blk.get_local_var(&name))
+ .and_then(|blk| blk.get_local_var(name))
}
/// Test if given template name is current template.
@@ -275,9 +293,10 @@ impl<'reg, 'rc> fmt::Debug for RenderContextInner<'reg, 'rc> {
f.debug_struct("RenderContextInner")
.field("partials", &self.partials)
.field("partial_block_stack", &self.partial_block_stack)
+ .field("partial_block_depth", &self.partial_block_depth)
.field("root_template", &self.root_template)
.field("current_template", &self.current_template)
- .field("disable_eacape", &self.disable_escape)
+ .field("disable_escape", &self.disable_escape)
.finish()
}
}
@@ -435,6 +454,7 @@ pub struct Decorator<'reg, 'rc> {
params: Vec<PathAndJson<'reg, 'rc>>,
hash: BTreeMap<&'reg str, PathAndJson<'reg, 'rc>>,
template: Option<&'reg Template>,
+ indent: Option<&'reg String>,
}
impl<'reg: 'rc, 'rc> Decorator<'reg, 'rc> {
@@ -463,6 +483,7 @@ impl<'reg: 'rc, 'rc> Decorator<'reg, 'rc> {
params: pv,
hash: hm,
template: dt.template.as_ref(),
+ indent: dt.indent.as_ref(),
})
}
@@ -495,6 +516,10 @@ impl<'reg: 'rc, 'rc> Decorator<'reg, 'rc> {
pub fn template(&self) -> Option<&'reg Template> {
self.template
}
+
+ pub fn indent(&self) -> Option<&'reg String> {
+ self.indent
+ }
}
/// Render trait
@@ -747,6 +772,20 @@ pub(crate) fn do_escape(r: &Registry<'_>, rc: &RenderContext<'_, '_>, content: S
}
}
+#[inline]
+fn indent_aware_write(
+ v: &str,
+ rc: &mut RenderContext<'_, '_>,
+ out: &mut dyn Output,
+) -> Result<(), RenderError> {
+ if let Some(indent) = rc.get_indent_string() {
+ out.write(support::str::with_indent(v, indent).as_ref())?;
+ } else {
+ out.write(v.as_ref())?;
+ }
+ Ok(())
+}
+
impl Renderable for TemplateElement {
fn render<'reg: 'rc, 'rc>(
&'reg self,
@@ -755,11 +794,8 @@ impl Renderable for TemplateElement {
rc: &mut RenderContext<'reg, 'rc>,
out: &mut dyn Output,
) -> Result<(), RenderError> {
- match *self {
- RawString(ref v) => {
- out.write(v.as_ref())?;
- Ok(())
- }
+ match self {
+ RawString(ref v) => indent_aware_write(v.as_ref(), rc, out),
Expression(ref ht) | HtmlExpression(ref ht) => {
let is_html_expression = matches!(self, HtmlExpression(_));
if is_html_expression {
@@ -789,8 +825,7 @@ impl Renderable for TemplateElement {
} else {
let rendered = context_json.value().render();
let output = do_escape(registry, rc, rendered);
- out.write(output.as_ref())?;
- Ok(())
+ indent_aware_write(output.as_ref(), rc, out)
}
}
} else {
@@ -1117,3 +1152,37 @@ fn test_zero_args_heler() {
"Output name: first_name not resolved"
);
}
+
+#[test]
+fn test_identifiers_starting_with_numbers() {
+ let mut r = Registry::new();
+
+ assert!(r
+ .register_template_string("r1", "{{#if 0a}}true{{/if}}")
+ .is_ok());
+ let r1 = r.render("r1", &json!({"0a": true})).unwrap();
+ assert_eq!(r1, "true");
+
+ assert!(r.register_template_string("r2", "{{eq 1a 1}}").is_ok());
+ let r2 = r.render("r2", &json!({"1a": 2, "a": 1})).unwrap();
+ assert_eq!(r2, "false");
+
+ assert!(r
+ .register_template_string("r3", "0: {{0}} {{#if (eq 0 true)}}resolved from context{{/if}}\n1a: {{1a}} {{#if (eq 1a true)}}resolved from context{{/if}}\n2_2: {{2_2}} {{#if (eq 2_2 true)}}resolved from context{{/if}}") // YUP it is just eq that barfs! is if handled specially? maybe this test should go nearer to specific helpers that fail?
+ .is_ok());
+ let r3 = r
+ .render("r3", &json!({"0": true, "1a": true, "2_2": true}))
+ .unwrap();
+ assert_eq!(
+ r3,
+ "0: true \n1a: true resolved from context\n2_2: true resolved from context"
+ );
+
+ // these should all be errors:
+ assert!(r.register_template_string("r4", "{{eq 1}}").is_ok());
+ assert!(r.register_template_string("r5", "{{eq a1}}").is_ok());
+ assert!(r.register_template_string("r6", "{{eq 1a}}").is_ok());
+ assert!(r.render("r4", &()).is_err());
+ assert!(r.render("r5", &()).is_err());
+ assert!(r.render("r6", &()).is_err());
+}
diff --git a/vendor/handlebars/src/support.rs b/vendor/handlebars/src/support.rs
index bd5564d32..b02aca6db 100644
--- a/vendor/handlebars/src/support.rs
+++ b/vendor/handlebars/src/support.rs
@@ -57,6 +57,64 @@ pub mod str {
output
}
+ /// add indent for lines but last
+ pub fn with_indent(s: &str, indent: &str) -> String {
+ let mut output = String::new();
+
+ let mut it = s.chars().peekable();
+ while let Some(c) = it.next() {
+ output.push(c);
+ // check if c is not the last character, we don't append
+ // indent for last line break
+ if c == '\n' && it.peek().is_some() {
+ output.push_str(indent);
+ }
+ }
+
+ output
+ }
+
+ #[inline]
+ pub(crate) fn whitespace_matcher(c: char) -> bool {
+ c == ' ' || c == '\t'
+ }
+
+ #[inline]
+ pub(crate) fn newline_matcher(c: char) -> bool {
+ c == '\n' || c == '\r'
+ }
+
+ #[inline]
+ pub(crate) fn strip_first_newline(s: &str) -> &str {
+ if let Some(s) = s.strip_prefix("\r\n") {
+ s
+ } else if let Some(s) = s.strip_prefix('\n') {
+ s
+ } else {
+ s
+ }
+ }
+
+ pub(crate) fn find_trailing_whitespace_chars(s: &str) -> Option<&str> {
+ let trimmed = s.trim_end_matches(whitespace_matcher);
+ if trimmed.len() == s.len() {
+ None
+ } else {
+ Some(&s[trimmed.len()..])
+ }
+ }
+
+ pub(crate) fn ends_with_empty_line(text: &str) -> bool {
+ let s = text.trim_end_matches(whitespace_matcher);
+ // also matches when text is just whitespaces
+ s.ends_with(newline_matcher) || s.is_empty()
+ }
+
+ pub(crate) fn starts_with_empty_line(text: &str) -> bool {
+ text.trim_start_matches(whitespace_matcher)
+ .starts_with(newline_matcher)
+ }
+
#[cfg(test)]
mod test {
use crate::support::str::StringWriter;
diff --git a/vendor/handlebars/src/template.rs b/vendor/handlebars/src/template.rs
index 87f853799..617f47711 100644
--- a/vendor/handlebars/src/template.rs
+++ b/vendor/handlebars/src/template.rs
@@ -9,23 +9,39 @@ use pest::{Parser, Position, Span};
use serde_json::value::Value as Json;
use crate::error::{TemplateError, TemplateErrorReason};
-use crate::grammar::{self, HandlebarsParser, Rule};
+use crate::grammar::{HandlebarsParser, Rule};
use crate::json::path::{parse_json_path_from_iter, Path};
+use crate::support;
use self::TemplateElement::*;
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub struct TemplateMapping(pub usize, pub usize);
/// A handlebars template
-#[derive(PartialEq, Clone, Debug, Default)]
+#[derive(PartialEq, Eq, Clone, Debug, Default)]
pub struct Template {
pub name: Option<String>,
pub elements: Vec<TemplateElement>,
pub mapping: Vec<TemplateMapping>,
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(Default)]
+pub(crate) struct TemplateOptions {
+ pub(crate) prevent_indent: bool,
+ pub(crate) name: Option<String>,
+}
+
+impl TemplateOptions {
+ fn name(&self) -> String {
+ self.name
+ .as_ref()
+ .cloned()
+ .unwrap_or_else(|| "Unnamed".to_owned())
+ }
+}
+
+#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Subexpression {
// we use box here avoid resursive struct definition
pub element: Box<TemplateElement>,
@@ -84,13 +100,13 @@ impl Subexpression {
}
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub enum BlockParam {
Single(Parameter),
Pair((Parameter, Parameter)),
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub struct ExpressionSpec {
pub name: Parameter,
pub params: Vec<Parameter>,
@@ -100,7 +116,7 @@ pub struct ExpressionSpec {
pub omit_pro_ws: bool,
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub enum Parameter {
// for helper name only
Name(String),
@@ -110,7 +126,7 @@ pub enum Parameter {
Subexpression(Subexpression),
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub struct HelperTemplate {
pub name: Parameter,
pub params: Vec<Parameter>,
@@ -122,6 +138,18 @@ pub struct HelperTemplate {
}
impl HelperTemplate {
+ pub fn new(exp: ExpressionSpec, block: bool) -> HelperTemplate {
+ HelperTemplate {
+ name: exp.name,
+ params: exp.params,
+ hash: exp.hash,
+ block_param: exp.block_param,
+ block,
+ template: None,
+ inverse: None,
+ }
+ }
+
// test only
pub(crate) fn with_path(path: Path) -> HelperTemplate {
HelperTemplate {
@@ -140,12 +168,26 @@ impl HelperTemplate {
}
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub struct DecoratorTemplate {
pub name: Parameter,
pub params: Vec<Parameter>,
pub hash: HashMap<String, Parameter>,
pub template: Option<Template>,
+ // for partial indent
+ pub indent: Option<String>,
+}
+
+impl DecoratorTemplate {
+ pub fn new(exp: ExpressionSpec) -> DecoratorTemplate {
+ DecoratorTemplate {
+ name: exp.name,
+ params: exp.params,
+ hash: exp.hash,
+ template: None,
+ indent: None,
+ }
+ }
}
impl Parameter {
@@ -380,34 +422,40 @@ impl Template {
fn remove_previous_whitespace(template_stack: &mut VecDeque<Template>) {
let t = template_stack.front_mut().unwrap();
- if let Some(el) = t.elements.last_mut() {
- if let RawString(ref mut text) = el {
- *text = text.trim_end().to_owned();
- }
+ if let Some(RawString(ref mut text)) = t.elements.last_mut() {
+ *text = text.trim_end().to_owned();
}
}
+ // in handlebars, the whitespaces around statement are
+ // automatically trimed.
+ // this function checks if current span has both leading and
+ // trailing whitespaces, which we treat as a standalone statement.
+ //
+ //
fn process_standalone_statement(
template_stack: &mut VecDeque<Template>,
source: &str,
current_span: &Span<'_>,
+ prevent_indent: bool,
) -> bool {
- let with_trailing_newline = grammar::starts_with_empty_line(&source[current_span.end()..]);
+ let with_trailing_newline =
+ support::str::starts_with_empty_line(&source[current_span.end()..]);
if with_trailing_newline {
let with_leading_newline =
- grammar::ends_with_empty_line(&source[..current_span.start()]);
+ support::str::ends_with_empty_line(&source[..current_span.start()]);
- if with_leading_newline {
+ // prevent_indent: a special toggle for partial expression
+ // (>) that leading whitespaces are kept
+ if prevent_indent && with_leading_newline {
let t = template_stack.front_mut().unwrap();
// check the last element before current
- if let Some(el) = t.elements.last_mut() {
- if let RawString(ref mut text) = el {
- // trim leading space for standalone statement
- *text = text
- .trim_end_matches(grammar::whitespace_matcher)
- .to_owned();
- }
+ if let Some(RawString(ref mut text)) = t.elements.last_mut() {
+ // trim leading space for standalone statement
+ *text = text
+ .trim_end_matches(support::str::whitespace_matcher)
+ .to_owned();
}
}
@@ -453,17 +501,17 @@ impl Template {
if trim_start {
RawString(s.trim_start().to_owned())
} else if trim_start_line {
- RawString(
- s.trim_start_matches(grammar::whitespace_matcher)
- .trim_start_matches(grammar::newline_matcher)
- .to_owned(),
- )
+ let s = s.trim_start_matches(support::str::whitespace_matcher);
+ RawString(support::str::strip_first_newline(s).to_owned())
} else {
RawString(s)
}
}
- pub fn compile<'a>(source: &'a str) -> Result<Template, TemplateError> {
+ pub(crate) fn compile2<'a>(
+ source: &'a str,
+ options: TemplateOptions,
+ ) -> Result<Template, TemplateError> {
let mut helper_stack: VecDeque<HelperTemplate> = VecDeque::new();
let mut decorator_stack: VecDeque<DecoratorTemplate> = VecDeque::new();
let mut template_stack: VecDeque<Template> = VecDeque::new();
@@ -472,14 +520,16 @@ impl Template {
// flag for newline removal of standalone statements
// this option is marked as true when standalone statement is detected
// then the leading whitespaces and newline of next rawstring will be trimed
- let mut trim_line_requiered = false;
+ let mut trim_line_required = false;
let parser_queue = HandlebarsParser::parse(Rule::handlebars, source).map_err(|e| {
let (line_no, col_no) = match e.line_col {
LineColLocation::Pos(line_col) => line_col,
LineColLocation::Span(line_col, _) => line_col,
};
- TemplateError::of(TemplateErrorReason::InvalidSyntax).at(source, line_no, col_no)
+ TemplateError::of(TemplateErrorReason::InvalidSyntax)
+ .at(source, line_no, col_no)
+ .in_template(options.name())
})?;
// dbg!(parser_queue.clone().flatten());
@@ -515,7 +565,7 @@ impl Template {
&source[prev_end..span.start()],
None,
false,
- trim_line_requiered,
+ trim_line_required,
),
line_no,
col_no,
@@ -528,12 +578,15 @@ impl Template {
&source[prev_end..span.start()],
None,
false,
- trim_line_requiered,
+ trim_line_required,
),
line_no,
col_no,
);
}
+
+ // reset standalone statement marker
+ trim_line_required = false;
}
let (line_no, col_no) = span.start_pos().line_col();
@@ -555,14 +608,14 @@ impl Template {
&source[start..span.end()],
Some(pair.clone()),
omit_pro_ws,
- trim_line_requiered,
+ trim_line_required,
),
line_no,
col_no,
);
// reset standalone statement marker
- trim_line_requiered = false;
+ trim_line_required = false;
}
Rule::helper_block_start
| Rule::raw_block_start
@@ -572,24 +625,11 @@ impl Template {
match rule {
Rule::helper_block_start | Rule::raw_block_start => {
- let helper_template = HelperTemplate {
- name: exp.name,
- params: exp.params,
- hash: exp.hash,
- block_param: exp.block_param,
- block: true,
- template: None,
- inverse: None,
- };
+ let helper_template = HelperTemplate::new(exp.clone(), true);
helper_stack.push_front(helper_template);
}
Rule::decorator_block_start | Rule::partial_block_start => {
- let decorator = DecoratorTemplate {
- name: exp.name,
- params: exp.params,
- hash: exp.hash,
- template: None,
- };
+ let decorator = DecoratorTemplate::new(exp.clone());
decorator_stack.push_front(decorator);
}
_ => unreachable!(),
@@ -602,10 +642,11 @@ impl Template {
// standalone statement check, it also removes leading whitespaces of
// previous rawstring when standalone statement detected
- trim_line_requiered = Template::process_standalone_statement(
+ trim_line_required = Template::process_standalone_statement(
&mut template_stack,
source,
&span,
+ true,
);
let t = template_stack.front_mut().unwrap();
@@ -623,10 +664,11 @@ impl Template {
// standalone statement check, it also removes leading whitespaces of
// previous rawstring when standalone statement detected
- trim_line_requiered = Template::process_standalone_statement(
+ trim_line_required = Template::process_standalone_statement(
&mut template_stack,
source,
&span,
+ true,
);
let t = template_stack.pop_front().unwrap();
@@ -640,7 +682,7 @@ impl Template {
span.as_str(),
Some(pair.clone()),
omit_pro_ws,
- trim_line_requiered,
+ trim_line_required,
),
line_no,
col_no,
@@ -664,15 +706,7 @@ impl Template {
match rule {
Rule::expression | Rule::html_expression => {
- let helper_template = HelperTemplate {
- name: exp.name,
- params: exp.params,
- hash: exp.hash,
- block_param: exp.block_param,
- block: false,
- template: None,
- inverse: None,
- };
+ let helper_template = HelperTemplate::new(exp.clone(), false);
let el = if rule == Rule::expression {
Expression(Box::new(helper_template))
} else {
@@ -682,12 +716,30 @@ impl Template {
t.push_element(el, line_no, col_no);
}
Rule::decorator_expression | Rule::partial_expression => {
- let decorator = DecoratorTemplate {
- name: exp.name,
- params: exp.params,
- hash: exp.hash,
- template: None,
- };
+ // do not auto trim ident spaces for
+ // partial_expression(>)
+ let prevent_indent = rule != Rule::partial_expression;
+ trim_line_required = Template::process_standalone_statement(
+ &mut template_stack,
+ source,
+ &span,
+ prevent_indent,
+ );
+
+ // indent for partial expression >
+ let mut indent = None;
+ if rule == Rule::partial_expression
+ && !options.prevent_indent
+ && !exp.omit_pre_ws
+ {
+ indent = support::str::find_trailing_whitespace_chars(
+ &source[..span.start()],
+ );
+ }
+
+ let mut decorator = DecoratorTemplate::new(exp.clone());
+ decorator.indent = indent.map(|s| s.to_owned());
+
let el = if rule == Rule::decorator_expression {
DecoratorExpression(Box::new(decorator))
} else {
@@ -699,10 +751,11 @@ impl Template {
Rule::helper_block_end | Rule::raw_block_end => {
// standalone statement check, it also removes leading whitespaces of
// previous rawstring when standalone statement detected
- trim_line_requiered = Template::process_standalone_statement(
+ trim_line_required = Template::process_standalone_statement(
&mut template_stack,
source,
&span,
+ true,
);
let mut h = helper_stack.pop_front().unwrap();
@@ -723,16 +776,18 @@ impl Template {
exp.name.debug_name(),
),
)
- .at(source, line_no, col_no));
+ .at(source, line_no, col_no)
+ .in_template(options.name()));
}
}
Rule::decorator_block_end | Rule::partial_block_end => {
// standalone statement check, it also removes leading whitespaces of
// previous rawstring when standalone statement detected
- trim_line_requiered = Template::process_standalone_statement(
+ trim_line_required = Template::process_standalone_statement(
&mut template_stack,
source,
&span,
+ true,
);
let mut d = decorator_stack.pop_front().unwrap();
@@ -753,17 +808,19 @@ impl Template {
exp.name.debug_name(),
),
)
- .at(source, line_no, col_no));
+ .at(source, line_no, col_no)
+ .in_template(options.name()));
}
}
_ => unreachable!(),
}
}
Rule::hbs_comment_compact => {
- trim_line_requiered = Template::process_standalone_statement(
+ trim_line_required = Template::process_standalone_statement(
&mut template_stack,
source,
&span,
+ true,
);
let text = span
@@ -774,10 +831,11 @@ impl Template {
t.push_element(Comment(text.to_owned()), line_no, col_no);
}
Rule::hbs_comment => {
- trim_line_requiered = Template::process_standalone_statement(
+ trim_line_required = Template::process_standalone_statement(
&mut template_stack,
source,
&span,
+ true,
);
let text = span
@@ -802,27 +860,36 @@ impl Template {
let t = template_stack.front_mut().unwrap();
t.push_element(RawString(text.to_owned()), line_no, col_no);
}
- let root_template = template_stack.pop_front().unwrap();
+ let mut root_template = template_stack.pop_front().unwrap();
+ root_template.name = options.name;
return Ok(root_template);
}
}
}
+ // These two compile functions are kept for compatibility with 4.x
+ // Template APIs in case that some developers are using them
+ // without registry.
+
+ pub fn compile(source: &str) -> Result<Template, TemplateError> {
+ Self::compile2(source, TemplateOptions::default())
+ }
+
pub fn compile_with_name<S: AsRef<str>>(
source: S,
name: String,
) -> Result<Template, TemplateError> {
- match Template::compile(source.as_ref()) {
- Ok(mut t) => {
- t.name = Some(name);
- Ok(t)
- }
- Err(e) => Err(e.in_template(name)),
- }
+ Self::compile2(
+ source.as_ref(),
+ TemplateOptions {
+ name: Some(name),
+ ..Default::default()
+ },
+ )
}
}
-#[derive(PartialEq, Clone, Debug)]
+#[derive(PartialEq, Eq, Clone, Debug)]
pub enum TemplateElement {
RawString(String),
HtmlExpression(Box<HelperTemplate>),
diff --git a/vendor/handlebars/tests/embed.rs b/vendor/handlebars/tests/embed.rs
new file mode 100644
index 000000000..019f27db9
--- /dev/null
+++ b/vendor/handlebars/tests/embed.rs
@@ -0,0 +1,29 @@
+#[macro_use]
+extern crate serde_json;
+
+use handlebars::Handlebars;
+
+#[test]
+#[cfg(feature = "rust-embed")]
+fn test_embed() {
+ use rust_embed::RustEmbed;
+
+ #[derive(RustEmbed)]
+ #[folder = "tests/templates/"]
+ #[include = "*.hbs"]
+ struct Templates;
+
+ let mut hbs = Handlebars::new();
+ hbs.register_embed_templates::<Templates>().unwrap();
+
+ assert_eq!(1, hbs.get_templates().len());
+
+ let data = json!({
+ "name": "Andy"
+ });
+
+ assert_eq!(
+ hbs.render("hello.hbs", &data).unwrap().trim(),
+ "Hello, Andy"
+ );
+}
diff --git a/vendor/handlebars/tests/escape.rs b/vendor/handlebars/tests/escape.rs
index 563ab76b9..4a737f5ce 100644
--- a/vendor/handlebars/tests/escape.rs
+++ b/vendor/handlebars/tests/escape.rs
@@ -3,7 +3,7 @@ extern crate handlebars;
#[macro_use]
extern crate serde_json;
-use handlebars::{handlebars_helper, Handlebars};
+use handlebars::{handlebars_helper, no_escape, Handlebars};
#[test]
fn test_escape_216() {
@@ -41,3 +41,43 @@ fn test_string_no_escape_422() {
.unwrap()
);
}
+
+#[test]
+fn test_string_whitespace_467() {
+ const TEMPLATE_UNQUOTED: &str = r#"{{#each synonyms}}
+ {{this.name}} => '{{this.sym}}',
+ {{/each}}
+"#;
+
+ let mut hbs = Handlebars::new();
+ hbs.register_escape_fn(no_escape);
+ hbs.register_template_string("perl", TEMPLATE_UNQUOTED)
+ .unwrap();
+
+ let r = hbs
+ .render("perl", &json!({"synonyms": [{"name": "lt", "sym": "<"}]}))
+ .unwrap();
+ assert_eq!(" lt => '<',\n", r);
+}
+
+#[test]
+fn test_triple_bracket_expression_471() {
+ let mut hbs = Handlebars::new();
+
+ handlebars_helper!(replace: |input: str| {
+ input.replace("\n", "<br/>")
+ });
+ hbs.register_helper("replace", Box::new(replace));
+
+ assert_eq!(
+ "some&lt;br/&gt;path",
+ hbs.render_template("{{replace h}}", &json!({"h": "some\npath"}))
+ .unwrap()
+ );
+
+ assert_eq!(
+ "some<br/>path",
+ hbs.render_template("{{{replace h}}}", &json!({"h": "some\npath"}))
+ .unwrap()
+ );
+}
diff --git a/vendor/handlebars/tests/helper_macro.rs b/vendor/handlebars/tests/helper_macro.rs
index 9a8d2dc07..cc5ed914b 100644
--- a/vendor/handlebars/tests/helper_macro.rs
+++ b/vendor/handlebars/tests/helper_macro.rs
@@ -4,6 +4,8 @@ extern crate handlebars;
extern crate serde_json;
use handlebars::Handlebars;
+use time::format_description::{parse, well_known::Rfc2822};
+use time::OffsetDateTime;
handlebars_helper!(lower: |s: str| s.to_lowercase());
handlebars_helper!(upper: |s: str| s.to_uppercase());
@@ -14,6 +16,7 @@ handlebars_helper!(nargs: |*args| args.len());
handlebars_helper!(has_a: |{a:i64 = 99}, **kwargs|
format!("{}, {}", a, kwargs.get("a").is_some()));
handlebars_helper!(tag: |t: str| format!("<{}>", t));
+handlebars_helper!(date: |dt: OffsetDateTime| dt.format(&parse("[year]-[month]-[day]").unwrap()).unwrap());
#[test]
fn test_macro_helper() {
@@ -26,6 +29,7 @@ fn test_macro_helper() {
hbs.register_helper("nargs", Box::new(nargs));
hbs.register_helper("has_a", Box::new(has_a));
hbs.register_helper("tag", Box::new(tag));
+ hbs.register_helper("date", Box::new(date));
let data = json!("Teixeira");
@@ -73,4 +77,13 @@ fn test_macro_helper() {
hbs.render_template("{{{tag \"html\"}}}", &()).unwrap(),
"<html>"
);
+
+ assert_eq!(
+ hbs.render_template(
+ "{{date this}}",
+ &OffsetDateTime::parse("Wed, 18 Feb 2015 23:16:09 GMT", &Rfc2822).unwrap()
+ )
+ .unwrap(),
+ "2015-02-18"
+ );
}
diff --git a/vendor/handlebars/tests/helper_with_space.rs b/vendor/handlebars/tests/helper_with_space.rs
index 5a55ab122..853d5d24a 100644
--- a/vendor/handlebars/tests/helper_with_space.rs
+++ b/vendor/handlebars/tests/helper_with_space.rs
@@ -34,3 +34,57 @@ fn test_helper_with_space_param() {
.unwrap();
assert_eq!(s, "Output: Mozilla Firefox, Google Chrome".to_owned());
}
+
+#[test]
+fn test_empty_lines_472() {
+ let mut r = Handlebars::new();
+
+ r.register_template_string(
+ "t1",
+ r#"{{#each routes}}
+import { default as {{this.handler}} } from '{{this.file_path}}'
+{{/each}}
+
+addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})"#,
+ )
+ .unwrap();
+
+ r.register_template_string(
+ "t2",
+ r#"addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})
+
+{{#each routes}}
+import { default as {{this.handler}} } from '{{this.file_path}}'
+{{/each}}
+"#,
+ )
+ .unwrap();
+
+ let data = json!({"routes": [{"handler": "__hello_handler", "file_path": "./hello.js"},
+ {"handler": "__world_index_handler", "file_path": "./world/index.js"},
+ {"handler": "__index_handler", "file_path": "./index.js"}]});
+
+ let exp1 = r#"import { default as __hello_handler } from './hello.js'
+import { default as __world_index_handler } from './world/index.js'
+import { default as __index_handler } from './index.js'
+
+addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})"#;
+
+ let exp2 = r#"addEventListener('fetch', (event) => {
+ event.respondWith(handleEvent(event))
+})
+
+import { default as __hello_handler } from './hello.js'
+import { default as __world_index_handler } from './world/index.js'
+import { default as __index_handler } from './index.js'
+"#;
+
+ assert_eq!(r.render("t1", &data).unwrap(), exp1);
+ assert_eq!(r.render("t2", &data).unwrap(), exp2);
+}
diff --git a/vendor/handlebars/tests/templates/hello.hbs b/vendor/handlebars/tests/templates/hello.hbs
new file mode 100644
index 000000000..a2344af53
--- /dev/null
+++ b/vendor/handlebars/tests/templates/hello.hbs
@@ -0,0 +1 @@
+Hello, {{name}}
diff --git a/vendor/handlebars/tests/whitespace.rs b/vendor/handlebars/tests/whitespace.rs
new file mode 100644
index 000000000..1c740556f
--- /dev/null
+++ b/vendor/handlebars/tests/whitespace.rs
@@ -0,0 +1,24 @@
+use handlebars::Handlebars;
+use serde_json::json;
+
+#[test]
+fn test_whitespaces_elision() {
+ let hbs = Handlebars::new();
+ assert_eq!(
+ "bar",
+ hbs.render_template(" {{~ foo ~}} ", &json!({"foo": "bar"}))
+ .unwrap()
+ );
+
+ assert_eq!(
+ "<bar/>",
+ hbs.render_template(" {{{~ foo ~}}} ", &json!({"foo": "<bar/>"}))
+ .unwrap()
+ );
+
+ assert_eq!(
+ "<bar/>",
+ hbs.render_template(" {{~ {foo} ~}} ", &json!({"foo": "<bar/>"}))
+ .unwrap()
+ );
+}