block: fix class attribute parsing

match reference implementation
This commit is contained in:
Noah Hellman 2023-03-12 17:12:56 +01:00
parent 33d8215a2a
commit 0719b2de65

View file

@ -734,9 +734,8 @@ impl IdentifiedBlock {
f @ ('`' | ':' | '~') => {
let fence_length = 1 + (&mut chars).take_while(|c| *c == f).count();
let spec = &line_t[fence_length..].trim_start();
let valid_spec = if f == ':' && !spec.starts_with('=') {
spec.chars().next().map_or(true, attr::is_name_start)
&& spec.chars().skip(1).all(attr::is_name)
let valid_spec = if f == ':' {
spec.chars().all(attr::is_name)
} else {
!spec.chars().any(char::is_whitespace) && !spec.chars().any(|c| c == '`')
};