git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #3677 from labdsf/anylinenewline

Move anyLineNewline to Parsing.hs

commit377733e08fdaea359e73b03952913cc32b537d9e authorJohn MacFarlane <jgm@berkeley.edu> dateWed 17 May 2017, 12:47 (9 years ago) parent602cd6a55ce47d
5 files changed+7−8
src/Text/Pandoc/Parsing.hs+5 src/Text/Pandoc/Readers/Markdown.hs+1−1 src/Text/Pandoc/Readers/Org/Blocks.hs−4 src/Text/Pandoc/Readers/Org/Parsing.hs+1 src/Text/Pandoc/Readers/Txt2Tags.hs−3
src/Text/Pandoc/Parsing.hs+5
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3636A utility library with parsers used in pandoc readers.
3737-}
3838module Text.Pandoc.Parsing ( anyLine,
39+ anyLineNewline,
3940 many1Till,
4041 notFollowedBy',
4142 oneOfStrings,
@@ -255,6 +256,10 @@ anyLine = do
255256 return this
256257 _ -> mzero
257258
259+-- | Parse any line, include the final newline in the output
260+anyLineNewline :: Stream [Char] m Char => ParserT [Char] st m [Char]
261+anyLineNewline = (++ "\n") <$> anyLine
262+
258263-- | Like @manyTill@, but reads at least one item.
259264many1Till :: Stream s m t
260265 => ParserT s st m a
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -614,7 +614,7 @@ hrule = try $ do
614614--
615615
616616indentedLine :: PandocMonad m => MarkdownParser m String
617−indentedLine = indentSpaces >> anyLine >>= return . (++ "\n")
617+indentedLine = indentSpaces >> anyLineNewline
618618
619619blockDelimiter :: PandocMonad m
620620 => (Char -> Bool)
src/Text/Pandoc/Readers/Org/Blocks.hs−4
@@ -837,7 +837,3 @@ listContinuation markerLength = try $
837837 then count num (char ' ')
838838 else choice [ try (count num (char ' '))
839839 , try (char '\t' >> count (num - tabStop) (char ' ')) ]
840−
841−-- | Parse any line, include the final newline in the output.
842−anyLineNewline :: Monad m => OrgParser m String
843−anyLineNewline = (++ "\n") <$> anyLine
src/Text/Pandoc/Readers/Org/Parsing.hs+1
@@ -31,6 +31,7 @@ functions are adapted to Org-mode specific functionality.
3131module Text.Pandoc.Readers.Org.Parsing
3232 ( OrgParser
3333 , anyLine
34+ , anyLineNewline
3435 , blanklines
3536 , newline
3637 , parseFromString
src/Text/Pandoc/Readers/Txt2Tags.hs−3
@@ -277,9 +277,6 @@ listContinuation markerLength = try $
277277 <*> many blankline)
278278 where listLine = try $ indentWith markerLength *> anyLineNewline
279279
280−anyLineNewline :: T2T String
281−anyLineNewline = (++ "\n") <$> anyLine
282−
283280indentWith :: Int -> T2T String
284281indentWith n = count n space
285282