aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 3d17e245b..e65a4dc70 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -397,8 +397,9 @@ listItem c = try $ do
then listItem' c
else do
skipMany spaceChar
- first <- manyTill anyChar newline
- rest <- many (try $ string extras *> manyTill anyChar newline)
+ first <- concat <$> manyTill listChunk newline
+ rest <- many
+ (try $ string extras *> (concat <$> manyTill listChunk newline))
contents <- parseFromString (many1 $ listItem' c)
(unlines (first : rest))
case c of
@@ -407,13 +408,23 @@ listItem c = try $ do
':' -> return $ B.definitionList [(mempty, contents)]
_ -> mzero
+-- The point of this is to handle stuff like
+-- * {{cite book
+-- | blah
+-- | blah
+-- }}
+-- * next list item
+-- which seems to be valid mediawiki.
+listChunk :: MWParser String
+listChunk = template <|> count 1 anyChar
+
listItem' :: Char -> MWParser Blocks
listItem' c = try $ do
listStart c
skipMany spaceChar
- first <- manyTill anyChar newline
+ first <- concat <$> manyTill listChunk newline
rest <- many (try $ char c *> lookAhead listStartChar *>
- manyTill anyChar newline)
+ (concat <$> manyTill listChunk newline))
parseFromString (firstParaToPlain . mconcat <$> many1 block)
$ unlines $ first : rest