@@ -102,9 +102,9 @@ readDocxWithWarnings :: ReaderOptions
102102 -> Either PandocError (Pandoc, MediaBag, [String])
103103readDocxWithWarnings opts bytes
104104 | Right archive <- toArchiveOrFail bytes
105− , Right (docx, warnings) <- archiveToDocxWithWarnings archive = do
106− (meta, blks, mediaBag) <- docxToOutput opts docx
107− return (Pandoc meta blks, mediaBag, warnings)
105+ , Right (docx, parserWarnings) <- archiveToDocxWithWarnings archive = do
106+ (meta, blks, mediaBag, warnings) <- docxToOutput opts docx
107+ return (Pandoc meta blks, mediaBag, parserWarnings ++ warnings)
108108readDocxWithWarnings _ _ =
109109 Left (ParseFailure "couldn't parse docx file")
110110
@@ -118,12 +118,14 @@ readDocx opts bytes = do
118118data DState = DState { docxAnchorMap :: M.Map String String
119119 , docxMediaBag :: MediaBag
120120 , docxDropCap :: Inlines
121+ , docxWarnings :: [String]
121122 }
122123
123124instance Default DState where
124125 def = DState { docxAnchorMap = M.empty
125126 , docxMediaBag = mempty
126127 , docxDropCap = mempty
128+ , docxWarnings = []
127129 }
128130
129131data DEnv = DEnv { docxOptions :: ReaderOptions
@@ -581,18 +583,20 @@ rewriteLink' il = return il
581583rewriteLinks :: [Block] -> DocxContext [Block]
582584rewriteLinks = mapM (walkM rewriteLink')
583585
584−bodyToOutput :: Body -> DocxContext (Meta, [Block], MediaBag)
586+bodyToOutput :: Body -> DocxContext (Meta, [Block], MediaBag, [String])
585587bodyToOutput (Body bps) = do
586588 let (metabps, blkbps) = sepBodyParts bps
587589 meta <- bodyPartsToMeta metabps
588590 blks <- smushBlocks <$> mapM bodyPartToBlocks blkbps
589591 blks' <- rewriteLinks $ blocksToDefinitions $ blocksToBullets $ toList blks
590592 mediaBag <- gets docxMediaBag
593+ warnings <- gets docxWarnings
591594 return $ (meta,
592595 blks',
593− mediaBag)
596+ mediaBag,
597+ warnings)
594598
595−docxToOutput :: ReaderOptions -> Docx -> Either PandocError (Meta, [Block], MediaBag)
599+docxToOutput :: ReaderOptions -> Docx -> Either PandocError (Meta, [Block], MediaBag, [String])
596600docxToOutput opts (Docx (Document _ body)) =
597601 let dEnv = def { docxOptions = opts} in
598602 evalDocxContext (bodyToOutput body) dEnv def