From acc07e6144689596cc6c5003e407dced0c27b92e Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 6 May 2016 13:27:55 -0500 Subject: [PATCH] Fix definition lists that contain other lists Fixes #263 --- block.go | 5 +++-- block_test.go | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/block.go b/block.go index f9ce9e34..3f4af787 100644 --- a/block.go +++ b/block.go @@ -1175,8 +1175,9 @@ gatherlines: 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) { + if indent <= itemIndent && + ((*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 diff --git a/block_test.go b/block_test.go index bb3a50b7..f3618fe7 100644 --- a/block_test.go +++ b/block_test.go @@ -960,6 +960,14 @@ func TestDefinitionList(t *testing.T) { "

Definition b

\n" + "\n" + "\n

Text 2

\n", + + "Term 1\n: Definition a\n\n Text 1\n\n 1. First\n 2. Second", + "
\n" + + "
Term 1
\n" + + "

Definition a

\n\n" + + "

Text 1

\n\n" + + "
    \n
  1. First
  2. \n
  3. Second
  4. \n
\n" + + "
\n", } doTestsBlock(t, tests, EXTENSION_DEFINITION_LISTS) }