From 1935666e748ba2ecde115eb76186de7f38150caf Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 6 May 2016 20:00:01 +0100 Subject: [PATCH] adjacent lists fix And tests. --- block.go | 10 ++++++++++ block_test.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/block.go b/block.go index 1207077e..7cbffa51 100644 --- a/block.go +++ b/block.go @@ -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 } diff --git a/block_test.go b/block_test.go index 8d499728..d4b7bbd6 100644 --- a/block_test.go +++ b/block_test.go @@ -600,6 +600,41 @@ qux `, + + `* un1 +* un2 + +a. or1 +b. or2`, + "\n\n
    \n
  1. or1
  2. \n
  3. or2
  4. \n
\n", + + `* un1 +* un2 + +A. or1 +B. or2`, + "\n\n
    \n
  1. or1
  2. \n
  3. or2
  4. \n
\n", + + `* un1 +* un2 + +I. or1 +II. or2`, + "\n\n
    \n
  1. or1
  2. \n
  3. or2
  4. \n
\n", + + `* un1 +* un2 + +1. or1 +2. or2`, + "\n\n
    \n
  1. or1
  2. \n
  3. or2
  4. \n
\n", + + `1. or1 +2. or2 + +* un1 +* un2`, + "
    \n
  1. or1
  2. \n
  3. or2
  4. \n
\n\n\n", } doTestsBlock(t, tests, 0) }