1
0
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:
Vytautas Šaltenis 2015-06-08 11:33:30 +03:00
commit 386ef80f18
2 changed files with 26 additions and 1 deletions

View File

@ -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 {

View File

@ -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)
}