@@ -99,12 +99,12 @@ readDocx opts bytes =
9999 Nothing -> error $ "couldn't parse docx file"
100100
101101spansToKeep :: [String]
102−spansToKeep = ["list-item", "Definition", "DefinitionTerm"]
102+spansToKeep = []
103103
104104
105105-- This is empty, but we put it in for future-proofing.
106106divsToKeep :: [String]
107−divsToKeep = []
107+divsToKeep = ["list-item", "Definition", "DefinitionTerm"]
108108
109109runStyleToContainers :: RunStyle -> [Container Inline]
110110runStyleToContainers rPr =
@@ -139,18 +139,18 @@ divAttrToContainers (c:cs) _ | isJust (isHeaderClass c) =
139139 in
140140 [(Container $ \blks ->
141141 Header n ("", delete ("Heading" ++ show n) cs, []) (blksToInlines blks))]
142−divAttrToContainers (c:_) _ | c `elem` codeDivs =
142+divAttrToContainers (c:cs) kvs | c `elem` divsToKeep =
143+ (Container $ Div ("", [c], [])) : (divAttrToContainers cs kvs)
144+divAttrToContainers (c:cs) kvs | c `elem` codeDivs =
143145 -- This is a bit of a cludge. We make the codeblock from the raw
144146 -- parparts in bodyPartToBlocks. But we need something to match against.
145− [Container $ \_ -> CodeBlock ("", [], []) ""]
147+ (Container $ \_ -> CodeBlock ("", [], []) "") : (divAttrToContainers cs kvs)
146148divAttrToContainers (c:cs) kvs | c `elem` listParagraphDivs =
147149 let kvs' = filter (\(k,_) -> k /= "indent") kvs
148150 in
149151 (Container $ Div ("", [c], [])) : (divAttrToContainers cs kvs')
150152divAttrToContainers (c:cs) kvs | c `elem` blockQuoteDivs =
151153 (Container BlockQuote) : (divAttrToContainers (cs \\ blockQuoteDivs) kvs)
152−divAttrToContainers (c:cs) kvs | c `elem` divsToKeep =
153− (Container $ Div ("", [c], [])) : (divAttrToContainers cs kvs)
154154divAttrToContainers (_:cs) kvs = divAttrToContainers cs kvs
155155divAttrToContainers [] (kv:kvs) | fst kv == "indent" =
156156 (Container BlockQuote) : divAttrToContainers [] kvs
@@ -298,7 +298,12 @@ blockCodeContainer _ = False
298298bodyPartToBlocks :: ReaderOptions -> Docx -> BodyPart -> [Block]
299299bodyPartToBlocks _ _ (Paragraph pPr parparts)
300300 | any blockCodeContainer (parStyleToContainers pPr) =
301− [CodeBlock ("", [], []) (concatMap parPartToString parparts)]
301+ let
302+ otherConts = filter (not . blockCodeContainer) (parStyleToContainers pPr)
303+ in
304+ rebuild
305+ otherConts
306+ [CodeBlock ("", [], []) (concatMap parPartToString parparts)]
302307bodyPartToBlocks opts docx (Paragraph pPr parparts) =
303308 case parPartsToInlines opts docx parparts of
304309 [] ->
@@ -372,7 +377,7 @@ makeImagesSelfContained _ inline = inline
372377bodyToBlocks :: ReaderOptions -> Docx -> Body -> [Block]
373378bodyToBlocks opts docx (Body bps) =
374379 map (makeHeaderAnchors) $
375− bottomUp blocksToDefinitions $
380+ blocksToDefinitions $
376381 blocksToBullets $
377382 concatMap (bodyPartToBlocks opts docx) bps
378383