Merge pull request #261 from moorereason/iss235

Fix adjacent list merging
pull/262/head
Vytautas Šaltenis 2016-05-02 20:28:48 +03:00
commit 43529be397
2 changed files with 16 additions and 0 deletions

View File

@ -1174,6 +1174,13 @@ gatherlines:
p.dliPrefix(chunk) > 0:
if containsBlankLine {
// end the list if the type changed after a blank line
if (*flags&LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) ||
(*flags&LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0) {
*flags |= LIST_ITEM_END_OF_LIST
break gatherlines
}
*flags |= LIST_ITEM_CONTAINS_BLOCK
}

View File

@ -657,6 +657,9 @@ func TestUnorderedList(t *testing.T) {
"Paragraph\n\n* Linebreak\n",
"<p>Paragraph</p>\n\n<ul>\n<li>Linebreak</li>\n</ul>\n",
"* List\n\n1. Spacer Mixed listing\n",
"<ul>\n<li>List</li>\n</ul>\n\n<ol>\n<li>Spacer Mixed listing</li>\n</ol>\n",
"* List\n * Nested list\n",
"<ul>\n<li>List\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
@ -815,6 +818,12 @@ func TestOrderedList(t *testing.T) {
"1. List\n\n code block with spaces\n",
"<ol>\n<li><p>List</p>\n\n<pre><code> code block with spaces\n</code></pre></li>\n</ol>\n",
"1. List\n\n* Spacer Mixed listing\n",
"<ol>\n<li>List</li>\n</ol>\n\n<ul>\n<li>Spacer Mixed listing</li>\n</ul>\n",
"1. List\n* Mixed listing\n",
"<ol>\n<li>List</li>\n<li>Mixed listing</li>\n</ol>\n",
"1. List\n * Mixted list\n",
"<ol>\n<li>List\n\n<ul>\n<li>Mixted list</li>\n</ul></li>\n</ol>\n",