@@ -422,13 +422,17 @@ withListContext p = do
422422 updateState (\st -> st {stateParserContext = oldContext})
423423 return parsed
424424
425+listItemContents' :: PandocMonad m => Int -> MuseParser m (F Blocks)
426+listItemContents' col = do
427+ first <- try $ withListContext parseBlock
428+ rest <- many $ try (skipMany blankline >> indentWith col >> withListContext parseBlock)
429+ return $ mconcat (first : rest)
430+
425431listItemContents :: PandocMonad m => MuseParser m (F Blocks)
426432listItemContents = do
427433 pos <- getPosition
428434 let col = sourceColumn pos - 1
429− first <- try $ withListContext parseBlock
430− rest <- many $ try (skipMany blankline >> indentWith col >> withListContext parseBlock)
431− return $ mconcat (first : rest)
435+ listItemContents' col
432436
433437listItem :: PandocMonad m => Int -> MuseParser m () -> MuseParser m (F Blocks)
434438listItem n p = try $ do
@@ -466,25 +470,19 @@ orderedList = try $ do
466470
467471definitionListItem :: PandocMonad m => MuseParser m (F (Inlines, [Blocks]))
468472definitionListItem = try $ do
469− rawTerm <- termParser
473+ guardDisabled Ext_amuse <|> void spaceChar -- Initial space is required by Amusewiki, but not Emacs Muse
474+ many spaceChar
475+ pos <- getPosition
476+ rawTerm <- many1Till (noneOf "\n") (lookAhead (void (try (spaceChar >> string "::"))))
470477 term <- parseFromString (trimInlinesF . mconcat <$> many inline) rawTerm
471478 many1 spaceChar
472479 string "::"
473− firstLine <- manyTill anyChar eol
474− restLines <- manyTill anyLine endOfListItemElement
475− let lns = dropWhile (== ' ') firstLine : restLines
476− lineContent <- parseFromString (withListContext parseBlocks) $ unlines lns
477− pure $ do lineContent' <- lineContent
480+ void spaceChar <|> lookAhead eol
481+ contents <- listItemContents' $ sourceColumn pos
482+ optionMaybe blankline
483+ pure $ do lineContent' <- contents
478484 term' <- term
479485 pure (term', [lineContent'])
480− where
481− termParser = (guardDisabled Ext_amuse <|> void spaceChar) >> -- Initial space is required by Amusewiki, but not Emacs Muse
482− many spaceChar >>
483− many1Till (noneOf "\n") (lookAhead (void (try (spaceChar >> string "::"))))
484− endOfInput = lookAhead $ try $ skipMany blankline >> skipSpaces >> eof
485− twoBlankLines = try $ blankline >> skipMany1 blankline
486− newDefinitionListItem = try $ void termParser
487− endOfListItemElement = lookAhead $ endOfInput <|> newDefinitionListItem <|> twoBlankLines
488486
489487definitionListItems :: PandocMonad m => MuseParser m (F [(Inlines, [Blocks])])
490488definitionListItems = sequence <$> many1 definitionListItem