@@ -200,7 +200,7 @@ hrule = try $ do
200-- strict in the nesting, sublist must start at exactly "parent depth
200-- strict in the nesting, sublist must start at exactly "parent depth
201-- plus one"
201-- plus one"
202anyList :: Parser [Char] ParserState Block
202anyList :: Parser [Char] ParserState Block
203−anyList = try $ ( (anyListAtDepth 1) <* blanklines )
203+anyList = try $ anyListAtDepth 1 <* blanklines
205-- | This allow one type of list to be nested into an other type,
205-- | This allow one type of list to be nested into an other type,
206-- provided correct nesting
206-- provided correct nesting
@@ -234,14 +234,23 @@ orderedListItemAtDepth = genericListItemAtDepth '#'
234genericListItemAtDepth :: Char -> Int -> Parser [Char] ParserState [Block]
234genericListItemAtDepth :: Char -> Int -> Parser [Char] ParserState [Block]
235genericListItemAtDepth c depth = try $ do
235genericListItemAtDepth c depth = try $ do
236 count depth (char c) >> optional attributes >> whitespace
236 count depth (char c) >> optional attributes >> whitespace
237− p <- inlines
237+ p <- many listInline
238 sublist <- option [] (singleton <$> anyListAtDepth (depth + 1))
239 sublist <- option [] (singleton <$> anyListAtDepth (depth + 1))
239− return ((Plain p):sublist)
240+ return (Plain p : sublist)
241-- | A definition list is a set of consecutive definition items
242-- | A definition list is a set of consecutive definition items
242definitionList :: Parser [Char] ParserState Block
243definitionList :: Parser [Char] ParserState Block
243definitionList = try $ DefinitionList <$> many1 definitionListItem
244definitionList = try $ DefinitionList <$> many1 definitionListItem
246+-- | List start character.
247+listStart :: Parser [Char] st Char
248+listStart = oneOf "*#-"
250+listInline :: Parser [Char] ParserState Inline
251+listInline = try (notFollowedBy newline >> inline)
252+ <|> try (endline <* notFollowedBy listStart)
245-- | A definition list item in textile begins with '- ', followed by
254-- | A definition list item in textile begins with '- ', followed by
246-- the term defined, then spaces and ":=". The definition follows, on
255-- the term defined, then spaces and ":=". The definition follows, on
247-- the same single line, or spaned on multiple line, after a line
256-- the same single line, or spaned on multiple line, after a line
@@ -250,10 +259,11 @@ definitionListItem :: Parser [Char] ParserState ([Inline], [[Block]])
250definitionListItem = try $ do
259definitionListItem = try $ do
251 string "- "
260 string "- "
252 term <- many1Till inline (try (whitespace >> string ":="))
261 term <- many1Till inline (try (whitespace >> string ":="))
253− def' <- inlineDef <|> multilineDef
262+ def' <- multilineDef <|> inlineDef
254 return (term, def')
263 return (term, def')
255 where inlineDef :: Parser [Char] ParserState [[Block]]
264 where inlineDef :: Parser [Char] ParserState [[Block]]
256− inlineDef = liftM (\d -> [[Plain d]]) $ try (whitespace >> inlines)
265+ inlineDef = liftM (\d -> [[Plain d]])
266+ $ optional whitespace >> many listInline <* newline
257 multilineDef :: Parser [Char] ParserState [[Block]]
267 multilineDef :: Parser [Char] ParserState [[Block]]
258 multilineDef = try $ do
268 multilineDef = try $ do
259 optional whitespace >> newline
269 optional whitespace >> newline
@@ -348,10 +358,6 @@ maybeExplicitBlock name blk = try $ do
348inline :: Parser [Char] ParserState Inline
358inline :: Parser [Char] ParserState Inline
349inline = choice inlineParsers <?> "inline"
359inline = choice inlineParsers <?> "inline"
351−-- | List of consecutive inlines before a newline
352−inlines :: Parser [Char] ParserState [Inline]
353−inlines = manyTill inline newline
355-- | Inline parsers tried in order
361-- | Inline parsers tried in order
356inlineParsers :: [Parser [Char] ParserState Inline]
362inlineParsers :: [Parser [Char] ParserState Inline]
357inlineParsers = [ autoLink
363inlineParsers = [ autoLink