only allow 1-char alphabetic list markers
This commit is contained in:
parent
aff431e227
commit
905d2919e3
2 changed files with 14 additions and 26 deletions
32
src/block.rs
32
src/block.rs
|
@ -1019,21 +1019,22 @@ impl<'s> IdentifiedBlock<'s> {
|
|||
|
||||
let numbering = if first.is_ascii_digit() {
|
||||
Decimal
|
||||
} else if first.is_ascii_lowercase() {
|
||||
AlphaLower
|
||||
} else if first.is_ascii_uppercase() {
|
||||
AlphaUpper
|
||||
} else if is_roman_lower_digit(first) {
|
||||
RomanLower
|
||||
} else if is_roman_upper_digit(first) {
|
||||
RomanUpper
|
||||
} else if first.is_ascii_lowercase() {
|
||||
AlphaLower
|
||||
} else if first.is_ascii_uppercase() {
|
||||
AlphaUpper
|
||||
} else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let max_len = match numbering {
|
||||
AlphaLower | AlphaUpper => 1,
|
||||
Decimal => 19,
|
||||
AlphaLower | AlphaUpper | RomanLower | RomanUpper => 13,
|
||||
RomanLower | RomanUpper => 13,
|
||||
};
|
||||
|
||||
let chars_num = chars.clone();
|
||||
|
@ -1065,17 +1066,6 @@ impl<'s> IdentifiedBlock<'s> {
|
|||
};
|
||||
let len_style = usize::from(start_paren) + 1;
|
||||
|
||||
let chars_num = std::iter::once(first).chain(chars_num.take(len_num - 1));
|
||||
let numbering = if matches!(numbering, AlphaLower)
|
||||
&& chars_num.clone().all(is_roman_lower_digit)
|
||||
{
|
||||
RomanLower
|
||||
} else if matches!(numbering, AlphaUpper) && chars_num.clone().all(is_roman_upper_digit) {
|
||||
RomanUpper
|
||||
} else {
|
||||
numbering
|
||||
};
|
||||
|
||||
if chars.next().map_or(true, |c| c.is_ascii_whitespace()) {
|
||||
Some((numbering, style, len_num + len_style))
|
||||
} else {
|
||||
|
@ -3129,16 +3119,6 @@ mod test {
|
|||
"I.",
|
||||
1
|
||||
);
|
||||
test_block!(
|
||||
"IJ. abc\n",
|
||||
Kind::ListItem {
|
||||
indent: 0,
|
||||
ty: Ordered(AlphaUpper, Period),
|
||||
last_blankline: false,
|
||||
},
|
||||
"IJ.",
|
||||
1
|
||||
);
|
||||
test_block!(
|
||||
"(a) abc\n",
|
||||
Kind::ListItem {
|
||||
|
|
|
@ -10,3 +10,11 @@ item
|
|||
</ol>
|
||||
<p>para</p>
|
||||
```
|
||||
|
||||
Only single letter alphabetic list markers.
|
||||
|
||||
```
|
||||
word. Continuing paragraph.
|
||||
.
|
||||
<p>word. Continuing paragraph.</p>
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue