diff --git a/maud/tests/basic_syntax.rs b/maud/tests/basic_syntax.rs index b84f7951..199c1f23 100644 --- a/maud/tests/basic_syntax.rs +++ b/maud/tests/basic_syntax.rs @@ -181,6 +181,16 @@ fn hyphens_in_attribute_names() { ); } +#[test] +fn many_colons_in_names() { + let result = + html! { namespace:other-namespace:this is:some:sentence="false" of:course:it:is {} }; + assert_eq!( + result.into_string(), + r#""# + ); +} + #[test] fn class_shorthand() { let result = html! { p { "Hi, " span.name { "Lyra" } "!" } }; diff --git a/maud_macros/src/parse.rs b/maud_macros/src/parse.rs index 3521ce42..cf4b4b95 100644 --- a/maud_macros/src/parse.rs +++ b/maud_macros/src/parse.rs @@ -731,11 +731,13 @@ impl Parser { /// if necessary. fn try_namespaced_name(&mut self) -> Option { let mut result = vec![self.try_name()?]; - if let Some(TokenTree::Punct(ref punct)) = self.peek() { + while let Some(TokenTree::Punct(ref punct)) = self.peek() { if punct.as_char() == ':' { self.advance(); result.push(TokenStream::from(TokenTree::Punct(punct.clone()))); result.push(self.try_name()?); + } else { + break; } } Some(result.into_iter().collect())