Skip to content

Commit

Permalink
attrs: allow omitting end comment % delimiter
Browse files Browse the repository at this point in the history
match reference implementation / syntax reference

jgm/djot.js#59
  • Loading branch information
hellux committed Mar 18, 2024
1 parent a644fa0 commit b43f4a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ impl State {
_ => Invalid,
},
Comment if c == b'%' => Whitespace,
Comment if c == b'}' => Done,
Comment => Comment,
ClassFirst if is_name(c) => Class,
ClassFirst => Invalid,
Expand Down Expand Up @@ -557,8 +558,10 @@ mod test {

#[test]
fn comment() {
test_attr!("{%}");
test_attr!("{%%}");
test_attr!("{ % abc % }");
test_attr!("{ .some_class % #some_id }", ("class", "some_class"));
test_attr!(
"{ .some_class % abc % #some_id}",
("class", "some_class"),
Expand Down
1 change: 0 additions & 1 deletion tests/html-ut/skip
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ e1f5b5e:untrimmed whitespace before linebreak
8423412:heading id conflict with existing id
c0a3dec:escape in url
642d380:table end in verbatim inline
cae5f5f:omitted % to end comment

0 comments on commit b43f4a5

Please sign in to comment.