aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/RST.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-19 00:18:46 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-19 00:18:46 +0000
commit81eba062f2e447fb1c266bc3f08b3b1ce2aeabc4 (patch)
tree87406afbd0e9e27fe0e16aad1e83edd223005ede /src/Text/Pandoc/Readers/RST.hs
parent4e149f898a3fff677e042f670f04a7d42c78edd3 (diff)
downloadpandoc-81eba062f2e447fb1c266bc3f08b3b1ce2aeabc4.tar.gz
Refactor RST and Markdown readers using parseFromString.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@864 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Readers/RST.hs')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 878c1355c..abbf502a1 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -328,10 +328,7 @@ rawLaTeXBlock = try $ do
blockQuote = try $ do
raw <- indentedBlock True
-- parse the extracted block, which may contain various block elements:
- rest <- getInput
- setInput $ raw ++ "\n\n"
- contents <- parseBlocks
- setInput rest
+ contents <- parseFromString parseBlocks $ raw ++ "\n\n"
return $ BlockQuote contents
--
@@ -344,10 +341,7 @@ definitionListItem = try $ do
term <- many1Till inline endline
raw <- indentedBlock True
-- parse the extracted block, which may contain various block elements:
- rest <- getInput
- setInput $ raw ++ "\n\n"
- contents <- parseBlocks
- setInput rest
+ contents <- parseFromString parseBlocks $ raw ++ "\n\n"
return (normalizeSpaces term, contents)
definitionList = try $ do
@@ -408,12 +402,9 @@ listItem start = try $ do
-- see definition of "endline"
state <- getState
let oldContext = stateParserContext state
- remaining <- getInput
setState $ state {stateParserContext = ListItemState}
-- parse the extracted block, which may itself contain block elements
- setInput $ concat (first:rest) ++ blanks
- parsed <- parseBlocks
- setInput remaining
+ parsed <- parseFromString parseBlocks $ concat (first:rest) ++ blanks
updateState (\st -> st {stateParserContext = oldContext})
return parsed