From 60989d0637780787fb337b94af212f1ee9e1ae22 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Mon, 15 Jan 2007 19:52:42 +0000 Subject: Added support for tables in markdown reader and in LaTeX, DocBook, and HTML writers. The syntax is documented in README. Tests have been added to the test suite. git-svn-id: https://pandoc.googlecode.com/svn/trunk@493 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/ParserCombinators/Pandoc.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/Text/ParserCombinators/Pandoc.hs') diff --git a/src/Text/ParserCombinators/Pandoc.hs b/src/Text/ParserCombinators/Pandoc.hs index b55ceb23d..a825ef8ff 100644 --- a/src/Text/ParserCombinators/Pandoc.hs +++ b/src/Text/ParserCombinators/Pandoc.hs @@ -41,7 +41,8 @@ module Text.ParserCombinators.Pandoc ( enclosed, blankBlock, nullBlock, - stringAnyCase + stringAnyCase, + parseFromStr ) where import Text.ParserCombinators.Parsec import Text.Pandoc.Definition @@ -138,3 +139,14 @@ stringAnyCase (x:xs) = try (do firstChar <- choice [ char (toUpper x), char (toLower x) ] rest <- stringAnyCase xs return (firstChar:rest)) + +-- | Parse contents of 'str' using 'parser' and return result. +parseFromStr :: GenParser tok st a -> [tok] -> GenParser tok st a +parseFromStr parser str = try $ do + oldInput <- getInput + setInput str + result <- parser + setInput oldInput + return result + + -- cgit v1.2.3