Skip to content

Commit

Permalink
entity: 0.30 says dec refs are 1-7 digits, hex 1-6.
Browse files Browse the repository at this point in the history
  • Loading branch information
kivikakk committed Jul 10, 2024
1 parent 2d6743e commit 685d8a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ pub fn unescape(text: &[u8]) -> Option<(Vec<u8>, usize)> {
0
};

if (1..=8).contains(&num_digits) && i < text.len() && text[i] == b';' {
if i < text.len()
&& text[i] == b';'
&& (((text[1] == b'x' || text[1] == b'X') && (1..=6).contains(&num_digits))
|| (1..=7).contains(&num_digits))
{
if codepoint == 0 || (0xD800..=0xE000).contains(&codepoint) || codepoint >= 0x110000 {
codepoint = 0xFFFD;
}
Expand Down
6 changes: 4 additions & 2 deletions src/parser/inlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,10 @@ impl<'a, 'r, 'o, 'd, 'i, 'c, 'subj> Subject<'a, 'r, 'o, 'd, 'i, 'c, 'subj> {
if c == b'_' {
(
numdelims,
left_flanking && (!right_flanking || before_char.is_punctuation() || before_char.is_symbol()),
right_flanking && (!left_flanking || after_char.is_punctuation() || after_char.is_symbol()),
left_flanking
&& (!right_flanking || before_char.is_punctuation() || before_char.is_symbol()),
right_flanking
&& (!left_flanking || after_char.is_punctuation() || after_char.is_symbol()),
)
} else if c == b'\'' || c == b'"' {
(
Expand Down

0 comments on commit 685d8a6

Please sign in to comment.