diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-08 12:16:44 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-08 12:18:47 -0700 |
commit | 7b47042ae6b44674f714c4ef660dadd7c911112b (patch) | |
tree | b19fe7b58cc69b2a2d4bf87fd4c84702c8b845a6 /src | |
parent | dd78dd6d1beb860416c1c9114064d2e7bc1ff86a (diff) | |
download | pandoc-7b47042ae6b44674f714c4ef660dadd7c911112b.tar.gz |
Textile reader: fixed list parsing bug. Closes #1500.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Textile.hs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs index 0562bd2ce..cd34da942 100644 --- a/src/Text/Pandoc/Readers/Textile.hs +++ b/src/Text/Pandoc/Readers/Textile.hs @@ -265,8 +265,20 @@ definitionList :: Parser [Char] ParserState Blocks definitionList = try $ B.definitionList <$> many1 definitionListItem -- | List start character. -listStart :: Parser [Char] st Char -listStart = oneOf "*#-" +listStart :: Parser [Char] ParserState () +listStart = genericListStart '*' + <|> () <$ genericListStart '#' + <|> () <$ definitionListStart + +genericListStart :: Char -> Parser [Char] st () +genericListStart c = () <$ try (many1 (char c) >> whitespace) + +definitionListStart :: Parser [Char] ParserState Inlines +definitionListStart = try $ do + char '-' + whitespace + trimInlines . mconcat <$> + many1Till inline (try (string ":=")) <* optional whitespace listInline :: Parser [Char] ParserState Inlines listInline = try (notFollowedBy newline >> inline) @@ -278,8 +290,7 @@ listInline = try (notFollowedBy newline >> inline) -- break. definitionListItem :: Parser [Char] ParserState (Inlines, [Blocks]) definitionListItem = try $ do - string "- " - term <- mconcat <$> many1Till inline (try (whitespace >> string ":=")) + term <- definitionListStart def' <- multilineDef <|> inlineDef return (term, def') where inlineDef :: Parser [Char] ParserState [Blocks] @@ -488,7 +499,7 @@ str = do return $ B.str fullStr -- | Some number of space chars -whitespace :: Parser [Char] ParserState Inlines +whitespace :: Parser [Char] st Inlines whitespace = many1 spaceChar >> return B.space <?> "whitespace" -- | In Textile, an isolated endline character is a line break |