diff --git a/Cargo.lock b/Cargo.lock index c9c9ba5..a07ff18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4399,6 +4399,7 @@ dependencies = [ "regex", "serde", "serde_json", + "tempfile", "thiserror 1.0.69", "tracing", ] diff --git a/crates/nemo-config/Cargo.toml b/crates/nemo-config/Cargo.toml index eb64495..e54d910 100644 --- a/crates/nemo-config/Cargo.toml +++ b/crates/nemo-config/Cargo.toml @@ -16,3 +16,4 @@ regex = "1" [dev-dependencies] proptest = "1" +tempfile = "3" diff --git a/crates/nemo-config/src/xml_parser.rs b/crates/nemo-config/src/xml_parser.rs index 62ff088..8743c8c 100644 --- a/crates/nemo-config/src/xml_parser.rs +++ b/crates/nemo-config/src/xml_parser.rs @@ -460,7 +460,11 @@ impl XmlParser { obj: &IndexMap, result: &mut IndexMap, ) -> Result<(), ParseError> { - let src = match obj.get("src").and_then(|v| v.as_str()) { + let src = match obj + .get("src") + .or_else(|| obj.get("href")) + .and_then(|v| v.as_str()) + { Some(s) => s, None => return Ok(()), }; @@ -1517,4 +1521,60 @@ mod tests { assert!(template.get("nav_item").is_some()); assert!(template.get("content_page").is_some()); } + + #[test] + fn test_include_href_attribute() { + let dir = tempfile::tempdir().unwrap(); + + // Create an included file with templates + let templates_dir = dir.path().join("templates"); + std::fs::create_dir_all(&templates_dir).unwrap(); + std::fs::write( + templates_dir.join("buttons.xml"), + r#" + + + +"#, + ) + .unwrap(); + + // Main file uses href instead of src + let main_xml = r#" + + + +