From 8b3ac981713b109ce01b0c369117ae9a09bb22c4 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 31 Dec 2006 18:14:51 +0000 Subject: Simplified list parsing code in RST reader. git-svn-id: https://pandoc.googlecode.com/svn/trunk@356 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/RST.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 419876ed1..a3b9bfca7 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -453,13 +453,14 @@ listItem start = try (do -- count as list item markers, even if not separated by blank space. -- see definition of "endline" state <- getState - let parsed = case runParser parseBlocks - (state {stateParserContext = ListItemState}) "list item" - raw of - Left err -> error $ "Raw:\n" ++ raw ++ - "\nError:\n" ++ show err - Right result -> result - where raw = concat (first:rest) ++ blanks + 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 + updateState (\st -> st {stateParserContext = oldContext}) return parsed) orderedList = try (do -- cgit v1.2.3