diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-09-18 10:46:33 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-09-18 10:46:33 +0100 |
commit | d47a844e13f48ae82a79f2d3434098cdabe83e12 (patch) | |
tree | d899b46ddedaf90327d9e75f314aaf81bdc467af | |
parent | 59311238193b0b0b4cdd7d0e90db6c1804a19521 (diff) | |
download | subplot-d47a844e13f48ae82a79f2d3434098cdabe83e12.tar.gz |
ast: codeblocks with single words are classes not IDs
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r-- | src/ast.rs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -228,8 +228,8 @@ fn parse_code_block_attrs(attrs: &str) -> Attr { keyvalues.push((k.to_string(), v.to_string())); } } - } else { - id = attrs.to_string(); + } else if !attrs.is_empty() { + classes.push(attrs.to_string()); } (id, classes, keyvalues) } @@ -355,9 +355,10 @@ mod test { #[test] fn code_block_attrs() { + assert_eq!(parse_code_block_attrs(""), ("".to_string(), vec![], vec![])); assert_eq!( parse_code_block_attrs("foo"), - ("foo".to_string(), vec![], vec![]) + ("".to_string(), vec!["foo".to_string()], vec![]) ); assert_eq!( parse_code_block_attrs("{#foo}"), |