summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2023-02-17 23:40:56 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2023-02-18 00:09:21 +0100
commitff20354c5883d7782b1e3fec09d394de2e3d646f (patch)
tree7370f562cfa01824c7cb7ed928e5491b9d58f45f /src
parentd08d1c04c54a91eceff2ad3e8cc628b730a7cc9b (diff)
Docx reader: parse image alt texts in LibreOffice generated files
LibreOffice tags images slightly differently than Word; this change lets the parses take that difference into account when looking for an image description (alt text).
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index 9e922ff76..3f02a6abb 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -810,7 +810,8 @@ expandDrawingId s = do
getTitleAndAlt :: NameSpaces -> Element -> (T.Text, T.Text)
getTitleAndAlt ns element =
- let mbDocPr = findChildByName ns "wp" "inline" element >>=
+ let mbDocPr = (findChildByName ns "wp" "inline" element <|> -- Word
+ findChildByName ns "wp" "anchor" element) >>= -- LibreOffice
findChildByName ns "wp" "docPr"
title = fromMaybe "" (mbDocPr >>= findAttrByName ns "" "title")
alt = fromMaybe "" (mbDocPr >>= findAttrByName ns "" "descr")