Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
adjacent lists fix
Browse files Browse the repository at this point in the history
And tests.
  • Loading branch information
miekg committed May 6, 2016
1 parent 64be966 commit 1935666
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
10 changes: 10 additions & 0 deletions block.go
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,16 @@ gatherlines:
}

if containsBlankLine {
if indent <= itemIndent &&
((*flags&_LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) ||
(*flags&_LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0) ||
(*flags&_LIST_TYPE_ORDERED == 0 && p.aliPrefix(chunk) > 0) ||
(*flags&_LIST_TYPE_ORDERED == 0 && p.aliPrefixU(chunk) > 0) ||
(*flags&_LIST_TYPE_ORDERED == 0 && p.rliPrefix(chunk) > 0) ||
(*flags&_LIST_TYPE_ORDERED == 0 && p.rliPrefixU(chunk) > 0)) {
*flags |= _LIST_ITEM_END_OF_LIST
break gatherlines
}
*flags |= _LIST_ITEM_CONTAINS_BLOCK
}

Expand Down
35 changes: 35 additions & 0 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,41 @@ qux
</code></pre></li>
</ul>
`,

`* un1
* un2
a. or1
b. or2`,
"<ul>\n<li>un1</li>\n<li>un2</li>\n</ul>\n\n<ol type=\"a\">\n<li>or1</li>\n<li>or2</li>\n</ol>\n",

`* un1
* un2
A. or1
B. or2`,
"<ul>\n<li>un1</li>\n<li>un2</li>\n</ul>\n\n<ol type=\"A\">\n<li>or1</li>\n<li>or2</li>\n</ol>\n",

`* un1
* un2
I. or1
II. or2`,
"<ul>\n<li>un1</li>\n<li>un2</li>\n</ul>\n\n<ol type=\"I\">\n<li>or1</li>\n<li>or2</li>\n</ol>\n",

`* un1
* un2
1. or1
2. or2`,
"<ul>\n<li>un1</li>\n<li>un2</li>\n</ul>\n\n<ol>\n<li>or1</li>\n<li>or2</li>\n</ol>\n",

`1. or1
2. or2
* un1
* un2`,
"<ol>\n<li>or1</li>\n<li>or2</li>\n</ol>\n\n<ul>\n<li>un1</li>\n<li>un2</li>\n</ul>\n",
}
doTestsBlock(t, tests, 0)
}
Expand Down

0 comments on commit 1935666

Please sign in to comment.