Compare commits

..

3 Commits

Author SHA1 Message Date
Bauke 3442351223
Version 1.1.4. 2022-07-20 14:25:56 +02:00
Bauke b4fadea55d
Run cargo fmt. 2022-07-20 14:14:44 +02:00
Kevin Cox 34677a5fa1
Switch to hard-xml. (#4)
strong-xml is unmaintained and this fork includes a fix to a self-closing element causing a parse error.

This also fixes a build-time warning with the strong-xml derive macro.
2022-07-19 13:47:46 +02:00
6 changed files with 61 additions and 33 deletions

54
Cargo.lock generated
View File

@ -86,6 +86,30 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "hard-xml"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c049a5d5186e83c3cf139192e81ab9d06c6b20d18c8aa06b38f3f6a5ece8703"
dependencies = [
"hard-xml-derive",
"jetscii",
"lazy_static",
"memchr",
"xmlparser",
]
[[package]]
name = "hard-xml-derive"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d24cec6f13bd2423158425bdb5f5ba0f2ddf7d7c2a825c0fdbf20c513df49725"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.15" version = "0.1.15"
@ -136,16 +160,16 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "opml" name = "opml"
version = "1.1.3" version = "1.1.4"
dependencies = [ dependencies = [
"hard-xml",
"serde", "serde",
"strong-xml",
"thiserror", "thiserror",
] ]
[[package]] [[package]]
name = "opml_cli" name = "opml_cli"
version = "1.1.3" version = "1.1.4"
dependencies = [ dependencies = [
"assert_cmd", "assert_cmd",
"clap", "clap",
@ -242,30 +266,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "strong-xml"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d19fb3a618e2f1039e32317c9f525e6d45c55af704ec7c429aa74412419bebf"
dependencies = [
"jetscii",
"lazy_static",
"memchr",
"strong-xml-derive",
"xmlparser",
]
[[package]]
name = "strong-xml-derive"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92c781f499321613b112be5d9338189ef1ed19689a01edd23d923ea57ad5c7e1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.8.0"

View File

@ -4,7 +4,7 @@
name = "opml" name = "opml"
description = "An OPML parser for Rust." description = "An OPML parser for Rust."
authors = ["Holllo <helllo@holllo.cc>"] authors = ["Holllo <helllo@holllo.cc>"]
version = "1.1.3" version = "1.1.4"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/Holllo/opml" repository = "https://github.com/Holllo/opml"
readme = "../README.md" readme = "../README.md"
@ -15,7 +15,7 @@ keywords = ["xml", "opml"]
path = "source/lib.rs" path = "source/lib.rs"
[dependencies] [dependencies]
strong-xml = "0.6.3" hard-xml = "1.10.0"
thiserror = "1.0.29" thiserror = "1.0.29"
[dependencies.serde] [dependencies.serde]

View File

@ -29,8 +29,8 @@
//! To create an OPML document from scratch, use [`OPML::default()`] or the good //! To create an OPML document from scratch, use [`OPML::default()`] or the good
//! old `OPML { /* ... */ }` syntax. //! old `OPML { /* ... */ }` syntax.
use hard_xml::{XmlRead, XmlWrite};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use strong_xml::{XmlRead, XmlWrite};
use thiserror::Error; use thiserror::Error;
/// All possible errors. /// All possible errors.
@ -52,7 +52,7 @@ pub enum Error {
/// The input string is not valid XML. /// The input string is not valid XML.
#[error("Failed to process XML file")] #[error("Failed to process XML file")]
XmlError(#[from] strong_xml::XmlError), XmlError(#[from] hard_xml::XmlError),
} }
/// The top-level [`OPML`] element. /// The top-level [`OPML`] element.

View File

@ -0,0 +1,8 @@
<opml version="2.0">
<head>
<docs />
</head>
<body>
<outline text="Outline Text"/>
</body>
</opml>

View File

@ -20,6 +20,26 @@ fn test_minimum_valid_opml() {
); );
} }
#[test]
fn test_valid_empty_docs() {
assert_eq!(
OPML::from_str(&read("tests/samples/empty_docs.opml").unwrap()).unwrap(),
OPML {
version: "2.0".to_string(),
head: Some(Head {
docs: Some("".to_string()),
..Head::default()
}),
body: Body {
outlines: vec![Outline {
text: "Outline Text".to_string(),
..Outline::default()
}]
},
}
)
}
#[test] #[test]
fn test_valid_opml_with_everything() { fn test_valid_opml_with_everything() {
assert_eq!( assert_eq!(

View File

@ -3,7 +3,7 @@
[package] [package]
name = "opml_cli" name = "opml_cli"
description = "An OPML parser for the command-line." description = "An OPML parser for the command-line."
version = "1.1.3" version = "1.1.4"
authors = ["Holllo <helllo@holllo.cc>"] authors = ["Holllo <helllo@holllo.cc>"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/Holllo/opml" repository = "https://github.com/Holllo/opml"
@ -21,7 +21,7 @@ serde_json = "1.0.68"
[dependencies.opml] [dependencies.opml]
path = "../opml_api" path = "../opml_api"
version = "1.1.3" version = "1.1.4"
[dependencies.serde] [dependencies.serde]
version = "1.0.130" version = "1.0.130"