mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-26 20:14:43 +01:00
Fix definition lists end-of-list detection
This commit is contained in:
parent
54d3f20b5c
commit
081aa9c378
5
block.go
5
block.go
@ -1186,7 +1186,10 @@ gatherlines:
|
||||
for data[next] != '\n' {
|
||||
next++
|
||||
}
|
||||
if next < len(data)-2 && data[next+1] != ':' {
|
||||
for next < len(data)-1 && data[next] == '\n' {
|
||||
next++
|
||||
}
|
||||
if i < len(data)-1 && data[i] != ':' && data[next] != ':' {
|
||||
*flags |= LIST_ITEM_END_OF_LIST
|
||||
}
|
||||
} else {
|
||||
|
@ -820,6 +820,16 @@ func TestDefinitionList(t *testing.T) {
|
||||
"<dd>Definition b</dd>\n" +
|
||||
"</dl>\n",
|
||||
|
||||
"Term 1\n: Definition a\n\nTerm 2\n: Definition b\n\nTerm 3\n: Definition c\n",
|
||||
"<dl>\n" +
|
||||
"<dt>Term 1</dt>\n" +
|
||||
"<dd>Definition a</dd>\n" +
|
||||
"<dt>Term 2</dt>\n" +
|
||||
"<dd>Definition b</dd>\n" +
|
||||
"<dt>Term 3</dt>\n" +
|
||||
"<dd>Definition c</dd>\n" +
|
||||
"</dl>\n",
|
||||
|
||||
"Term 1\n: Definition a\n: Definition b\n\nTerm 2\n: Definition c\n",
|
||||
"<dl>\n" +
|
||||
"<dt>Term 1</dt>\n" +
|
||||
@ -877,6 +887,18 @@ func TestDefinitionList(t *testing.T) {
|
||||
"<dd><p>Definition b</p></dd>\n" +
|
||||
"</dl>\n" +
|
||||
"\n<p>Text 1</p>\n",
|
||||
|
||||
"Term 1\n\n: Definition a\n\nText 1\n\nTerm 2\n\n: Definition b\n\nText 2",
|
||||
"<dl>\n" +
|
||||
"<dt>Term 1</dt>\n" +
|
||||
"<dd><p>Definition a</p></dd>\n" +
|
||||
"</dl>\n" +
|
||||
"\n<p>Text 1</p>\n" +
|
||||
"\n<dl>\n" +
|
||||
"<dt>Term 2</dt>\n" +
|
||||
"<dd><p>Definition b</p></dd>\n" +
|
||||
"</dl>\n" +
|
||||
"\n<p>Text 2</p>\n",
|
||||
}
|
||||
doTestsBlock(t, tests, EXTENSION_DEFINITION_LISTS)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user