pull/518/merge
Lajos Papp 2020-11-06 12:47:31 +00:00 committed by GitHub
commit 62909ec4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -1054,8 +1054,8 @@ func (p *parser) oliPrefix(data []byte) int {
i++
}
// we need >= 1 digits followed by a dot and a space
if start == i || data[i] != '.' || data[i+1] != ' ' {
// we need 1,2 or 3 digits followed by a dot and a space
if start == i || start < i-3 || data[i] != '.' || data[i+1] != ' ' {
return 0
}
return i + 2

View File

@ -836,6 +836,15 @@ func TestOrderedList(t *testing.T) {
"* Start with unordered\n 1. Ordered\n",
"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
"random numbers:\n\n 3. Bird\n 1. McHale\n 8. Parish",
"<p>random numbers:</p>\n\n<ol>\n<li>Bird</li>\n<li>McHale</li>\n<li>Parish</li>\n</ol>\n",
"big numbers should be skipped:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\n 999. last element",
"<p>big numbers should be skipped:</p>\n\n<ol>\n<li>Bird</li>\n<li>McHale</li>\n\n<li><p>Parish</p></li>\n\n<li><p>last element</p></li>\n</ol>\n",
"big numbers should be skipped:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\n 2019. is the actual year",
"<p>big numbers should be skipped:</p>\n\n<ol>\n<li>Bird</li>\n<li>McHale</li>\n<li>Parish</li>\n</ol>\n\n<p>2019. is the actual year</p>\n",
"1. numbers\n1. are ignored\n",
"<ol>\n<li>numbers</li>\n<li>are ignored</li>\n</ol>\n",