git.iko.soy/typeable/pandoc
on master help sign in
Use anyLine everywhere instead of 'manyTill anyChar newline'.
71c5ebeJohn MacFarlane
src/Text/Pandoc/Readers/Markdown.hs+3−3
@@ -463,7 +463,7 @@ hrule = try $ do
463--
463--
464
464
465indentedLine :: MarkdownParser String
465indentedLine :: MarkdownParser String
466−indentedLine = indentSpaces >> manyTill anyChar newline >>= return . (++ "\n")
466+indentedLine = indentSpaces >> anyLine >>= return . (++ "\n")
467
467
468blockDelimiter :: (Char -> Bool)
468blockDelimiter :: (Char -> Bool)
469 -> Maybe Int
469 -> Maybe Int
@@ -581,7 +581,7 @@ birdTrackLine c = try $ do
581 char c
581 char c
582 -- allow html tags on left margin:
582 -- allow html tags on left margin:
583 when (c == '<') $ notFollowedBy letter
583 when (c == '<') $ notFollowedBy letter
584− manyTill anyChar newline
584+ anyLine
585
585
586--
586--
587-- block quotes
587-- block quotes
@@ -681,7 +681,7 @@ listContinuationLine = try $ do
681 notFollowedBy blankline
681 notFollowedBy blankline
682 notFollowedBy' listStart
682 notFollowedBy' listStart
683 optional indentSpaces
683 optional indentSpaces
684− result <- manyTill anyChar newline
684+ result <- anyLine
685 return $ result ++ "\n"
685 return $ result ++ "\n"
686
686
687listItem :: MarkdownParser a
687listItem :: MarkdownParser a
src/Text/Pandoc/Readers/MediaWiki.hs+3−3
@@ -180,7 +180,7 @@ para = B.para . trimInlines . mconcat <$> many1 inline
180table :: MWParser Blocks
180table :: MWParser Blocks
181table = do
181table = do
182 tableStart
182 tableStart
183− styles <- manyTill anyChar newline
183+ styles <- anyLine
184 let tableWidth = case lookup "width" $ parseAttrs styles of
184 let tableWidth = case lookup "width" $ parseAttrs styles of
185 Just w -> maybe 1.0 id $ parseWidth w
185 Just w -> maybe 1.0 id $ parseWidth w
186 Nothing -> 1.0
186 Nothing -> 1.0
@@ -242,7 +242,7 @@ tableCaption = try $ do
242 guardColumnOne
242 guardColumnOne
243 sym "|+"
243 sym "|+"
244 skipMany spaceChar
244 skipMany spaceChar
245− res <- manyTill anyChar newline >>= parseFromString (many inline)
245+ res <- anyLine >>= parseFromString (many inline)
246 return $ trimInlines $ mconcat res
246 return $ trimInlines $ mconcat res
247
247
248tableRow :: MWParser [((Alignment, Double), Blocks)]
248tableRow :: MWParser [((Alignment, Double), Blocks)]
@@ -375,7 +375,7 @@ defListItem = try $ do
375 return (terms, defs)
375 return (terms, defs)
376
376
377defListTerm :: MWParser Inlines
377defListTerm :: MWParser Inlines
378−defListTerm = char ';' >> skipMany spaceChar >> manyTill anyChar newline >>=
378+defListTerm = char ';' >> skipMany spaceChar >> anyLine >>=
379 parseFromString (trimInlines . mconcat <$> many inline)
379 parseFromString (trimInlines . mconcat <$> many inline)
380
380
381listStart :: Char -> MWParser ()
381listStart :: Char -> MWParser ()
src/Text/Pandoc/Readers/RST.hs+5−5
@@ -155,7 +155,7 @@ rawFieldListItem indent = try $ do
155 char ':'
155 char ':'
156 name <- many1Till (noneOf "\n") (char ':')
156 name <- many1Till (noneOf "\n") (char ':')
157 (() <$ lookAhead newline) <|> skipMany1 spaceChar
157 (() <$ lookAhead newline) <|> skipMany1 spaceChar
158− first <- manyTill anyChar newline
158+ first <- anyLine
159 rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
159 rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
160 indentedBlock
160 indentedBlock
161 let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
161 let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
@@ -302,7 +302,7 @@ hrule = try $ do
302indentedLine :: String -> Parser [Char] st [Char]
302indentedLine :: String -> Parser [Char] st [Char]
303indentedLine indents = try $ do
303indentedLine indents = try $ do
304 string indents
304 string indents
305− manyTill anyChar newline
305+ anyLine
306
306
307-- one or more indented lines, possibly separated by blank lines.
307-- one or more indented lines, possibly separated by blank lines.
308-- any amount of indentation will work.
308-- any amount of indentation will work.
@@ -339,7 +339,7 @@ lhsCodeBlock = try $ do
339 $ intercalate "\n" lns'
339 $ intercalate "\n" lns'
340
340
341birdTrackLine :: Parser [Char] st [Char]
341birdTrackLine :: Parser [Char] st [Char]
342−birdTrackLine = char '>' >> manyTill anyChar newline
342+birdTrackLine = char '>' >> anyLine
343
343
344--
344--
345-- block quotes
345-- block quotes
@@ -394,7 +394,7 @@ listLine :: Int -> RSTParser [Char]
394listLine markerLength = try $ do
394listLine markerLength = try $ do
395 notFollowedBy blankline
395 notFollowedBy blankline
396 indentWith markerLength
396 indentWith markerLength
397− line <- manyTill anyChar newline
397+ line <- anyLine
398 return $ line ++ "\n"
398 return $ line ++ "\n"
399
399
400-- indent by specified number of spaces (or equiv. tabs)
400-- indent by specified number of spaces (or equiv. tabs)
@@ -411,7 +411,7 @@ rawListItem :: RSTParser Int
411 -> RSTParser (Int, [Char])
411 -> RSTParser (Int, [Char])
412rawListItem start = try $ do
412rawListItem start = try $ do
413 markerLength <- start
413 markerLength <- start
414− firstLine <- manyTill anyChar newline
414+ firstLine <- anyLine
415 restLines <- many (listLine markerLength)
415 restLines <- many (listLine markerLength)
416 return (markerLength, (firstLine ++ "\n" ++ (concat restLines)))
416 return (markerLength, (firstLine ++ "\n" ++ (concat restLines)))
417
417