From 71c5ebe682f09d11739e46ac734347c69f3b00fb Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 25 Jan 2013 18:32:15 -0800 Subject: Use anyLine everywhere instead of 'manyTill anyChar newline'. --- src/Text/Pandoc/Readers/Markdown.hs | 6 +++--- src/Text/Pandoc/Readers/MediaWiki.hs | 6 +++--- src/Text/Pandoc/Readers/RST.hs | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 69753c52a..235b594db 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -463,7 +463,7 @@ hrule = try $ do -- indentedLine :: MarkdownParser String -indentedLine = indentSpaces >> manyTill anyChar newline >>= return . (++ "\n") +indentedLine = indentSpaces >> anyLine >>= return . (++ "\n") blockDelimiter :: (Char -> Bool) -> Maybe Int @@ -581,7 +581,7 @@ birdTrackLine c = try $ do char c -- allow html tags on left margin: when (c == '<') $ notFollowedBy letter - manyTill anyChar newline + anyLine -- -- block quotes @@ -681,7 +681,7 @@ listContinuationLine = try $ do notFollowedBy blankline notFollowedBy' listStart optional indentSpaces - result <- manyTill anyChar newline + result <- anyLine return $ result ++ "\n" listItem :: MarkdownParser a diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index 434f67646..ed3a8fb12 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -180,7 +180,7 @@ para = B.para . trimInlines . mconcat <$> many1 inline table :: MWParser Blocks table = do tableStart - styles <- manyTill anyChar newline + styles <- anyLine let tableWidth = case lookup "width" $ parseAttrs styles of Just w -> maybe 1.0 id $ parseWidth w Nothing -> 1.0 @@ -242,7 +242,7 @@ tableCaption = try $ do guardColumnOne sym "|+" skipMany spaceChar - res <- manyTill anyChar newline >>= parseFromString (many inline) + res <- anyLine >>= parseFromString (many inline) return $ trimInlines $ mconcat res tableRow :: MWParser [((Alignment, Double), Blocks)] @@ -375,7 +375,7 @@ defListItem = try $ do return (terms, defs) defListTerm :: MWParser Inlines -defListTerm = char ';' >> skipMany spaceChar >> manyTill anyChar newline >>= +defListTerm = char ';' >> skipMany spaceChar >> anyLine >>= parseFromString (trimInlines . mconcat <$> many inline) listStart :: Char -> MWParser () diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 9699cf333..c7b37066a 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -155,7 +155,7 @@ rawFieldListItem indent = try $ do char ':' name <- many1Till (noneOf "\n") (char ':') (() <$ lookAhead newline) <|> skipMany1 spaceChar - first <- manyTill anyChar newline + first <- anyLine rest <- option "" $ try $ do lookAhead (string indent >> spaceChar) indentedBlock let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n" @@ -302,7 +302,7 @@ hrule = try $ do indentedLine :: String -> Parser [Char] st [Char] indentedLine indents = try $ do string indents - manyTill anyChar newline + anyLine -- one or more indented lines, possibly separated by blank lines. -- any amount of indentation will work. @@ -339,7 +339,7 @@ lhsCodeBlock = try $ do $ intercalate "\n" lns' birdTrackLine :: Parser [Char] st [Char] -birdTrackLine = char '>' >> manyTill anyChar newline +birdTrackLine = char '>' >> anyLine -- -- block quotes @@ -394,7 +394,7 @@ listLine :: Int -> RSTParser [Char] listLine markerLength = try $ do notFollowedBy blankline indentWith markerLength - line <- manyTill anyChar newline + line <- anyLine return $ line ++ "\n" -- indent by specified number of spaces (or equiv. tabs) @@ -411,7 +411,7 @@ rawListItem :: RSTParser Int -> RSTParser (Int, [Char]) rawListItem start = try $ do markerLength <- start - firstLine <- manyTill anyChar newline + firstLine <- anyLine restLines <- many (listLine markerLength) return (markerLength, (firstLine ++ "\n" ++ (concat restLines))) -- cgit v1.2.3