aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/RST.hs15
1 files changed, 8 insertions, 7 deletions
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