git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Handle title text in images.

We already handled alt text. This just puts the image "title" into the docx "title" attr.

commit378603c7703c26caa17d8b9d6c7692c96dc5a8c2 authorJesse Rosenthal <jrosenthal@jhu.edu> dateWed 2 Nov 2016, 12:08 (10 years ago) parenteffc348
1 file changed+2−2
src/Text/Pandoc/Writers/Docx.hs+2−2
src/Text/Pandoc/Writers/Docx.hs+2−2
@@ -1169,7 +1169,7 @@ inlineToOpenXML' opts (Link _ txt (src,_)) = do
11691169 M.insert src i extlinks }
11701170 return i
11711171 return [ mknode "w:hyperlink" [("r:id",id')] contents ]
1172−inlineToOpenXML' opts (Image attr alt (src, _)) = do
1172+inlineToOpenXML' opts (Image attr alt (src, title)) = do
11731173 -- first, check to see if we've already done this image
11741174 pageWidth <- asks envPrintWidth
11751175 imgs <- gets stImages
@@ -1220,7 +1220,7 @@ inlineToOpenXML' opts (Image attr alt (src, _)) = do
12201220 mknode "wp:inline" []
12211221 [ mknode "wp:extent" [("cx",show xemu),("cy",show yemu)] ()
12221222 , mknode "wp:effectExtent" [("b","0"),("l","0"),("r","0"),("t","0")] ()
1223− , mknode "wp:docPr" [("descr",stringify alt),("id","1"),("name","Picture")] ()
1223+ , mknode "wp:docPr" [("descr",stringify alt), ("title", title), ("id","1"),("name","Picture")] ()
12241224 , graphic ]
12251225 let imgext = case mt >>= extensionFromMimeType of
12261226 Just x -> '.':x