Update toml lib

Closes #1313
This commit is contained in:
Vincent Prouillet 2023-01-27 22:25:05 +01:00 committed by Vincent Prouillet
parent bc9772baf0
commit 4cd80a3df2
3 changed files with 61 additions and 9 deletions

56
Cargo.lock generated
View File

@ -1703,7 +1703,7 @@ dependencies = [
"tera",
"termcolor",
"time",
"toml",
"toml 0.7.0",
"unic-langid",
"unicode-segmentation",
"url",
@ -2257,6 +2257,15 @@ dependencies = [
"syn",
]
[[package]]
name = "nom8"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"
dependencies = [
"memchr",
]
[[package]]
name = "nom_locate"
version = "1.0.0"
@ -3221,6 +3230,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c68e921cef53841b8925c2abadd27c9b891d9613bdc43d6b823062866df38e8"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -3706,6 +3724,40 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f560bc7fb3eb31f5eee1340c68a2160cad39605b7b9c9ec32045ddbdee13b85"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "886f31a9b85b6182cabd4d8b07df3b451afcc216563748201490940d2a28ed36"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233d8716cdc5d20ec88a18a839edaf545edc71efa4a5ff700ef4a102c26cd8fa"
dependencies = [
"indexmap",
"nom8",
"serde",
"serde_spanned",
"toml_datetime",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -4179,7 +4231,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
dependencies = [
"toml",
"toml 0.5.11",
]
[[package]]

View File

@ -392,20 +392,20 @@ title = "Hello"
description = "hey there"
[extra]
some-date = 2002-14-01
some-date = 2002-11-01
"#); "toml")]
#[test_case(&RawFrontMatter::Yaml(r#"
title: Hello
description: hey there
extra:
some-date: 2002-14-01
some-date: 2002-11-01
"#); "yaml")]
fn can_parse_dates_in_extra(content: &RawFrontMatter) {
let res = PageFrontMatter::parse(content);
println!("{:?}", res);
assert!(res.is_ok());
assert_eq!(res.unwrap().extra["some-date"], to_value("2002-14-01").unwrap());
assert_eq!(res.unwrap().extra["some-date"], to_value("2002-11-01").unwrap());
}
#[test_case(&RawFrontMatter::Toml(r#"
@ -413,7 +413,7 @@ title = "Hello"
description = "hey there"
[extra.something]
some-date = 2002-14-01
some-date = 2002-11-01
"#); "toml")]
#[test_case(&RawFrontMatter::Yaml(r#"
title: Hello
@ -421,13 +421,13 @@ description: hey there
extra:
something:
some-date: 2002-14-01
some-date: 2002-11-01
"#); "yaml")]
fn can_parse_nested_dates_in_extra(content: &RawFrontMatter) {
let res = PageFrontMatter::parse(content);
println!("{:?}", res);
assert!(res.is_ok());
assert_eq!(res.unwrap().extra["something"]["some-date"], to_value("2002-14-01").unwrap());
assert_eq!(res.unwrap().extra["something"]["some-date"], to_value("2002-11-01").unwrap());
}
#[test_case(&RawFrontMatter::Toml(r#"

View File

@ -37,7 +37,7 @@ syntect = "5"
tera = { version = "1.17", features = ["preserve_order", "date-locale"] }
termcolor = "1.0.4"
time = "0.3"
toml = "0.5"
toml = "0.7"
unic-langid = "0.9"
unicode-segmentation = "1.2"
url = "2"