From 1f0a7e4e1877f8136532357de3f62066f0bb79a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 17 Apr 2023 23:42:06 +0200 Subject: [PATCH] Implement scansion:any in attr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/element.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/element.rs b/src/element.rs index 4e174ba..1f33020 100644 --- a/src/element.rs +++ b/src/element.rs @@ -227,6 +227,10 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> { }; for (attr, val) in self.elem.attrs() { + if val == "{scansion:any}" { + continue; + } + match (attr, other.attr(attr)) { (attr, _) if attr == "scansion:strict" => continue, (_, None) => return false, @@ -479,4 +483,14 @@ mod tests { assert_ne!(scan1, &elem2); } + + #[test] + fn ignore_attr_val_success() { + let elem1: Element = "" + .parse().unwrap(); + let elem2: Element = "".parse().unwrap(); + let scan1 = ScanElement::new(&elem1); + + assert_eq!(scan1, &elem2); + } }