mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-27 04:24:41 +01:00
Merge pull request #175 from vbatoufflet/deflist-fix
Fix definition lists end-of-list detection
This commit is contained in:
commit
386ef80f18
5
block.go
5
block.go
@ -1186,7 +1186,10 @@ gatherlines:
|
|||||||
for data[next] != '\n' {
|
for data[next] != '\n' {
|
||||||
next++
|
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
|
*flags |= LIST_ITEM_END_OF_LIST
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -820,6 +820,16 @@ func TestDefinitionList(t *testing.T) {
|
|||||||
"<dd>Definition b</dd>\n" +
|
"<dd>Definition b</dd>\n" +
|
||||||
"</dl>\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",
|
"Term 1\n: Definition a\n: Definition b\n\nTerm 2\n: Definition c\n",
|
||||||
"<dl>\n" +
|
"<dl>\n" +
|
||||||
"<dt>Term 1</dt>\n" +
|
"<dt>Term 1</dt>\n" +
|
||||||
@ -877,6 +887,18 @@ func TestDefinitionList(t *testing.T) {
|
|||||||
"<dd><p>Definition b</p></dd>\n" +
|
"<dd><p>Definition b</p></dd>\n" +
|
||||||
"</dl>\n" +
|
"</dl>\n" +
|
||||||
"\n<p>Text 1</p>\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)
|
doTestsBlock(t, tests, EXTENSION_DEFINITION_LISTS)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user