diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-19 00:18:46 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-19 00:18:46 +0000 |
commit | 81eba062f2e447fb1c266bc3f08b3b1ce2aeabc4 (patch) | |
tree | 87406afbd0e9e27fe0e16aad1e83edd223005ede /src/Text/Pandoc/Readers/Markdown.hs | |
parent | 4e149f898a3fff677e042f670f04a7d42c78edd3 (diff) | |
download | pandoc-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/Markdown.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index abf8061e0..f4b97527f 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -195,10 +195,7 @@ noteBlock = try $ do raw <- sepBy rawLines (try (blankline >> indentSpaces)) optional blanklines -- parse the extracted text, which may contain various block elements: - rest <- getInput - setInput $ (joinWithSep "\n" raw) ++ "\n\n" - contents <- parseBlocks - setInput rest + contents <- parseFromString parseBlocks $ (joinWithSep "\n" raw) ++ "\n\n" return $ NoteBlock ref contents -- @@ -307,10 +304,7 @@ emailBlockQuote = try $ do blockQuote = do raw <- emailBlockQuote <|> emacsBoxQuote -- parse the extracted block, which may contain various block elements: - rest <- getInput - setInput $ (joinWithSep "\n" raw) ++ "\n\n" - contents <- parseBlocks - setInput rest + contents <- parseFromString parseBlocks $ (joinWithSep "\n" raw) ++ "\n\n" return $ BlockQuote contents -- @@ -393,11 +387,8 @@ listItem start = try $ do let oldContext = stateParserContext state setState $ state {stateParserContext = ListItemState} -- parse the extracted block, which may contain various block elements: - rest <- getInput let raw = concat (first:continuations) - setInput raw - contents <- parseBlocks - setInput rest + contents <- parseFromString parseBlocks raw updateState (\st -> st {stateParserContext = oldContext}) return contents @@ -419,10 +410,7 @@ definitionListItem = try $ do state <- getState let oldContext = stateParserContext state -- parse the extracted block, which may contain various block elements: - rest <- getInput - setInput (concat raw) - contents <- parseBlocks - setInput rest + contents <- parseFromString parseBlocks $ concat raw updateState (\st -> st {stateParserContext = oldContext}) return ((normalizeSpaces term), contents) |