git.iko.soy/typeable/pandoc
on master help sign in
Use anyLine everywhere instead of 'manyTill anyChar newline'.
commit71c5ebe682f09d11739e46ac734347c69f3b00fb authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 25 Jan 2013, 18:32 (14 years ago) parentf989ff2
3 files changed+11−11
src/Text/Pandoc/Readers/Markdown.hs+3−3 src/Text/Pandoc/Readers/MediaWiki.hs+3−3 src/Text/Pandoc/Readers/RST.hs+5−5
src/Text/Pandoc/Readers/Markdown.hs+3−3
@@ -463,7 +463,7 @@ hrule = try $ do
463463--
464464
465465indentedLine :: MarkdownParser String
466−indentedLine = indentSpaces >> manyTill anyChar newline >>= return . (++ "\n")
466+indentedLine = indentSpaces >> anyLine >>= return . (++ "\n")
467467
468468blockDelimiter :: (Char -> Bool)
469469 -> Maybe Int
@@ -581,7 +581,7 @@ birdTrackLine c = try $ do
581581 char c
582582 -- allow html tags on left margin:
583583 when (c == '<') $ notFollowedBy letter
584− manyTill anyChar newline
584+ anyLine
585585
586586--
587587-- block quotes
@@ -681,7 +681,7 @@ listContinuationLine = try $ do
681681 notFollowedBy blankline
682682 notFollowedBy' listStart
683683 optional indentSpaces
684− result <- manyTill anyChar newline
684+ result <- anyLine
685685 return $ result ++ "\n"
686686
687687listItem :: MarkdownParser a
src/Text/Pandoc/Readers/MediaWiki.hs+3−3
@@ -180,7 +180,7 @@ para = B.para . trimInlines . mconcat <$> many1 inline
180180table :: MWParser Blocks
181181table = do
182182 tableStart
183− styles <- manyTill anyChar newline
183+ styles <- anyLine
184184 let tableWidth = case lookup "width" $ parseAttrs styles of
185185 Just w -> maybe 1.0 id $ parseWidth w
186186 Nothing -> 1.0
@@ -242,7 +242,7 @@ tableCaption = try $ do
242242 guardColumnOne
243243 sym "|+"
244244 skipMany spaceChar
245− res <- manyTill anyChar newline >>= parseFromString (many inline)
245+ res <- anyLine >>= parseFromString (many inline)
246246 return $ trimInlines $ mconcat res
247247
248248tableRow :: MWParser [((Alignment, Double), Blocks)]
@@ -375,7 +375,7 @@ defListItem = try $ do
375375 return (terms, defs)
376376
377377defListTerm :: MWParser Inlines
378−defListTerm = char ';' >> skipMany spaceChar >> manyTill anyChar newline >>=
378+defListTerm = char ';' >> skipMany spaceChar >> anyLine >>=
379379 parseFromString (trimInlines . mconcat <$> many inline)
380380
381381listStart :: Char -> MWParser ()
src/Text/Pandoc/Readers/RST.hs+5−5
@@ -155,7 +155,7 @@ rawFieldListItem indent = try $ do
155155 char ':'
156156 name <- many1Till (noneOf "\n") (char ':')
157157 (() <$ lookAhead newline) <|> skipMany1 spaceChar
158− first <- manyTill anyChar newline
158+ first <- anyLine
159159 rest <- option "" $ try $ do lookAhead (string indent >> spaceChar)
160160 indentedBlock
161161 let raw = (if null first then "" else (first ++ "\n")) ++ rest ++ "\n"
@@ -302,7 +302,7 @@ hrule = try $ do
302302indentedLine :: String -> Parser [Char] st [Char]
303303indentedLine indents = try $ do
304304 string indents
305− manyTill anyChar newline
305+ anyLine
306306
307307-- one or more indented lines, possibly separated by blank lines.
308308-- any amount of indentation will work.
@@ -339,7 +339,7 @@ lhsCodeBlock = try $ do
339339 $ intercalate "\n" lns'
340340
341341birdTrackLine :: Parser [Char] st [Char]
342−birdTrackLine = char '>' >> manyTill anyChar newline
342+birdTrackLine = char '>' >> anyLine
343343
344344--
345345-- block quotes
@@ -394,7 +394,7 @@ listLine :: Int -> RSTParser [Char]
394394listLine markerLength = try $ do
395395 notFollowedBy blankline
396396 indentWith markerLength
397− line <- manyTill anyChar newline
397+ line <- anyLine
398398 return $ line ++ "\n"
399399
400400-- indent by specified number of spaces (or equiv. tabs)
@@ -411,7 +411,7 @@ rawListItem :: RSTParser Int
411411 -> RSTParser (Int, [Char])
412412rawListItem start = try $ do
413413 markerLength <- start
414− firstLine <- manyTill anyChar newline
414+ firstLine <- anyLine
415415 restLines <- many (listLine markerLength)
416416 return (markerLength, (firstLine ++ "\n" ++ (concat restLines)))
417417