git.iko.soy/typeable/pandoc
on master help sign in
Move anyLineNewline to Parsing.hs
55ce47dAlexander Krotov
src/Text/Pandoc/Parsing.hs+5
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36A utility library with parsers used in pandoc readers.
36A utility library with parsers used in pandoc readers.
37-}
37-}
38module Text.Pandoc.Parsing ( anyLine,
38module Text.Pandoc.Parsing ( anyLine,
39+ anyLineNewline,
39 many1Till,
40 many1Till,
40 notFollowedBy',
41 notFollowedBy',
41 oneOfStrings,
42 oneOfStrings,
@@ -253,6 +254,10 @@ anyLine = do
253 return this
254 return this
254 _ -> mzero
255 _ -> mzero
255
256
257+-- | Parse any line, include the final newline in the output
258+anyLineNewline :: Stream [Char] m Char => ParserT [Char] st m [Char]
259+anyLineNewline = (++ "\n") <$> anyLine
260+
256-- | Like @manyTill@, but reads at least one item.
261-- | Like @manyTill@, but reads at least one item.
257many1Till :: Stream s m t
262many1Till :: Stream s m t
258 => ParserT s st m a
263 => ParserT s st m a
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -614,7 +614,7 @@ hrule = try $ do
614--
614--
615
615
616indentedLine :: PandocMonad m => MarkdownParser m String
616indentedLine :: PandocMonad m => MarkdownParser m String
617−indentedLine = indentSpaces >> anyLine >>= return . (++ "\n")
617+indentedLine = indentSpaces >> anyLineNewline
618
618
619blockDelimiter :: PandocMonad m
619blockDelimiter :: PandocMonad m
620 => (Char -> Bool)
620 => (Char -> Bool)
src/Text/Pandoc/Readers/Org/Blocks.hs−4
@@ -1017,7 +1017,3 @@ listContinuation markerLength = try $
1017 then count num (char ' ')
1017 then count num (char ' ')
1018 else choice [ try (count num (char ' '))
1018 else choice [ try (count num (char ' '))
1019 , try (char '\t' >> count (num - tabStop) (char ' ')) ]
1019 , try (char '\t' >> count (num - tabStop) (char ' ')) ]
1020−
1021−-- | Parse any line, include the final newline in the output.
1022−anyLineNewline :: Monad m => OrgParser m String
1023−anyLineNewline = (++ "\n") <$> anyLine
src/Text/Pandoc/Readers/Org/Parsing.hs+1
@@ -31,6 +31,7 @@ functions are adapted to Org-mode specific functionality.
31module Text.Pandoc.Readers.Org.Parsing
31module Text.Pandoc.Readers.Org.Parsing
32 ( OrgParser
32 ( OrgParser
33 , anyLine
33 , anyLine
34+ , anyLineNewline
34 , blanklines
35 , blanklines
35 , newline
36 , newline
36 , parseFromString
37 , parseFromString
src/Text/Pandoc/Readers/Txt2Tags.hs−3
@@ -277,9 +277,6 @@ listContinuation markerLength = try $
277 <*> many blankline)
277 <*> many blankline)
278 where listLine = try $ indentWith markerLength *> anyLineNewline
278 where listLine = try $ indentWith markerLength *> anyLineNewline
279
279
280−anyLineNewline :: T2T String
281−anyLineNewline = (++ "\n") <$> anyLine
282−
283indentWith :: Int -> T2T String
280indentWith :: Int -> T2T String
284indentWith n = count n space
281indentWith n = count n space
285
282