git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Added LPState.

Plan is to use this instead of ParserState in LP.

commit82ddec698e782fef83dcd1b1fba79cd3b698c717 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 25 Mar 2014, 15:38 (13 years ago) parent6992050
1 file changed+18
src/Text/Pandoc/Readers/LaTeX.hs+18
src/Text/Pandoc/Readers/LaTeX.hs+18
@@ -43,6 +43,7 @@ import Text.Pandoc.Parsing hiding ((<|>), many, optional, space,
4343import qualified Text.Pandoc.UTF8 as UTF8
4444import Data.Char ( chr, ord )
4545import Control.Monad
46+import Data.Default
4647import Text.Pandoc.Builder
4748import Data.Char (isLetter, isAlphaNum)
4849import Control.Applicative
@@ -71,6 +72,23 @@ parseLaTeX = do
7172 let (Pandoc _ bs') = doc bs
7273 return $ Pandoc meta bs'
7374
75+data LPState = LPState{
76+ lpMeta :: Meta
77+ , lpOptions :: ReaderOptions
78+ , lpHasChapters :: Bool
79+ , lpParserContext :: ParserContext
80+ , lpQuoteContext :: QuoteContext
81+ } deriving Show
82+
83+instance Default LPState where
84+ def = LPState{
85+ lpMeta = nullMeta
86+ , lpOptions = def
87+ , lpHasChapters = False
88+ , lpParserContext = NullState
89+ , lpQuoteContext = NoQuote
90+ }
91+
7492type LP = Parser [Char] ParserState
7593
7694anyControlSeq :: LP String