diff options
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 9d17ab118..8b0b295ab 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -640,7 +640,14 @@ bodyPartToBlocks (ListItem pPr numId lvl (Just levelInfo) parparts) = do , ("text", txt) , ("start", show start) ] - modify $ \st -> st{ docxListState = M.insert (numId, lvl) start listState} + modify $ \st -> st{ docxListState = + -- expire all the continuation data for lists of level > this one: + -- a new level 1 list item resets continuation for level 2+ + let expireKeys = [ (numid', lvl') + | (numid', lvl') <- M.keys listState + , lvl' > lvl + ] + in foldr M.delete (M.insert (numId, lvl) start listState) expireKeys } blks <- bodyPartToBlocks (Paragraph pPr parparts) return $ divWith ("", ["list-item"], kvs) blks bodyPartToBlocks (ListItem pPr _ _ _ parparts) = |