git.iko.soy/typeable/pandoc
on master help sign in
Got rid of two unneeded 'getState's. Note that

lookAhead automatically saves and restores the state. git-svn-id: https://pandoc.googlecode.com/svn/trunk@538 788f1e2b-df1e-0410-8736-df70ead52e1b

commit87eb8be14348354473f7a209be91189480f29d8a authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 15 Feb 2007, 01:43 (20 years ago) parent9ad7c73
2 files changed+3−4
src/Text/Pandoc/Readers/Markdown.hs+1−2 src/Text/Pandoc/Readers/RST.hs+2−2
src/Text/Pandoc/Readers/Markdown.hs+1−2
@@ -170,12 +170,11 @@ parseMarkdown = do
170170 updateState (\state -> state { stateParseRaw = True })
171171 -- need to parse raw HTML, since markdown allows it
172172 (title, author, date) <- option ([],[],"") titleBlock
173− oldState <- getState
174173 -- go through once just to get list of reference keys
175174 keysUsed <- lookAhead $ (do {manyTill (referenceKey <|> (do{anyLine; return Null})) eof;
176175 newState <- getState;
177176 return $ stateKeysUsed newState})
178− setState (oldState { stateKeysUsed = keysUsed })
177+ updateState (\st -> st { stateKeysUsed = keysUsed })
179178 blocks <- parseBlocks -- go through again, for real
180179 let blocks' = filter (/= Null) blocks
181180 state <- getState
src/Text/Pandoc/Readers/RST.hs+2−2
@@ -100,12 +100,12 @@ titleTransform ((Header 1 head1):rest) = -- title, no subtitle
100100titleTransform blocks = (blocks, [])
101101
102102parseRST = do
103− state <- getState
104103 -- first pass: get anonymous keys
105104 keyBlocks <- lookAhead $ manyTill (anonymousKey <|> (do{anyLine; return Null})) eof
106105 let anonymousKeys = filter (/= Null) keyBlocks
107106 -- run parser again to fill in anonymous links...
108− setState (state { stateKeyBlocks = anonymousKeys })
107+ updateState (\st -> st { stateKeyBlocks = anonymousKeys })
108+ state <- getState
109109 blocks <- parseBlocks
110110 let blocks' = filter isNotAnonKeyBlock blocks
111111 let (blocks'', title) = if stateStandalone state