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
This commit is contained in:
parent
9ad7c73b57
commit
87eb8be143
2 changed files with 3 additions and 4 deletions
|
@ -170,12 +170,11 @@ parseMarkdown = do
|
||||||
updateState (\state -> state { stateParseRaw = True })
|
updateState (\state -> state { stateParseRaw = True })
|
||||||
-- need to parse raw HTML, since markdown allows it
|
-- need to parse raw HTML, since markdown allows it
|
||||||
(title, author, date) <- option ([],[],"") titleBlock
|
(title, author, date) <- option ([],[],"") titleBlock
|
||||||
oldState <- getState
|
|
||||||
-- go through once just to get list of reference keys
|
-- go through once just to get list of reference keys
|
||||||
keysUsed <- lookAhead $ (do {manyTill (referenceKey <|> (do{anyLine; return Null})) eof;
|
keysUsed <- lookAhead $ (do {manyTill (referenceKey <|> (do{anyLine; return Null})) eof;
|
||||||
newState <- getState;
|
newState <- getState;
|
||||||
return $ stateKeysUsed newState})
|
return $ stateKeysUsed newState})
|
||||||
setState (oldState { stateKeysUsed = keysUsed })
|
updateState (\st -> st { stateKeysUsed = keysUsed })
|
||||||
blocks <- parseBlocks -- go through again, for real
|
blocks <- parseBlocks -- go through again, for real
|
||||||
let blocks' = filter (/= Null) blocks
|
let blocks' = filter (/= Null) blocks
|
||||||
state <- getState
|
state <- getState
|
||||||
|
|
|
@ -100,12 +100,12 @@ titleTransform ((Header 1 head1):rest) = -- title, no subtitle
|
||||||
titleTransform blocks = (blocks, [])
|
titleTransform blocks = (blocks, [])
|
||||||
|
|
||||||
parseRST = do
|
parseRST = do
|
||||||
state <- getState
|
|
||||||
-- first pass: get anonymous keys
|
-- first pass: get anonymous keys
|
||||||
keyBlocks <- lookAhead $ manyTill (anonymousKey <|> (do{anyLine; return Null})) eof
|
keyBlocks <- lookAhead $ manyTill (anonymousKey <|> (do{anyLine; return Null})) eof
|
||||||
let anonymousKeys = filter (/= Null) keyBlocks
|
let anonymousKeys = filter (/= Null) keyBlocks
|
||||||
-- run parser again to fill in anonymous links...
|
-- run parser again to fill in anonymous links...
|
||||||
setState (state { stateKeyBlocks = anonymousKeys })
|
updateState (\st -> st { stateKeyBlocks = anonymousKeys })
|
||||||
|
state <- getState
|
||||||
blocks <- parseBlocks
|
blocks <- parseBlocks
|
||||||
let blocks' = filter isNotAnonKeyBlock blocks
|
let blocks' = filter isNotAnonKeyBlock blocks
|
||||||
let (blocks'', title) = if stateStandalone state
|
let (blocks'', title) = if stateStandalone state
|
||||||
|
|
Loading…
Add table
Reference in a new issue