diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-02 11:56:52 -0400 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-02 12:10:45 -0400 |
commit | effc348965f20f4131ac3b0357303c548d851308 (patch) | |
tree | ef96496d17f3678c1b85e4c0bd54544b6ccef318 /src/Text/Pandoc/Readers/Docx.hs | |
parent | 1138ae6656784c1ca82511b0f27675f8cbc19cf8 (diff) | |
download | pandoc-effc348965f20f4131ac3b0357303c548d851308.tar.gz |
Docx reader: Handle Alt text and titles in images.
We use the "description" field as alt text and the "title" field as
title. These can be accessed through the "Format Picture" dialog in
Word.
Diffstat (limited to 'src/Text/Pandoc/Readers/Docx.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index fa534f801..2c171fe0b 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -317,10 +317,10 @@ runToInlines (Footnote bps) = do runToInlines (Endnote bps) = do blksList <- smushBlocks <$> (mapM bodyPartToBlocks bps) return $ note blksList -runToInlines (InlineDrawing fp bs ext) = do +runToInlines (InlineDrawing fp title alt bs ext) = do mediaBag <- gets docxMediaBag modify $ \s -> s { docxMediaBag = insertMedia fp Nothing bs mediaBag } - return $ imageWith (extentToAttr ext) fp "" "" + return $ imageWith (extentToAttr ext) fp title $ text alt extentToAttr :: Extent -> Attr extentToAttr (Just (w, h)) = @@ -401,10 +401,10 @@ parPartToInlines (BookMark _ anchor) = unless inHdrBool (modify $ \s -> s { docxAnchorMap = M.insert anchor newAnchor anchorMap}) return $ spanWith (newAnchor, ["anchor"], []) mempty -parPartToInlines (Drawing fp bs ext) = do +parPartToInlines (Drawing fp title alt bs ext) = do mediaBag <- gets docxMediaBag modify $ \s -> s { docxMediaBag = insertMedia fp Nothing bs mediaBag } - return $ imageWith (extentToAttr ext) fp "" "" + return $ imageWith (extentToAttr ext) fp title $ text alt parPartToInlines (InternalHyperLink anchor runs) = do ils <- smushInlines <$> mapM runToInlines runs return $ link ('#' : anchor) "" ils |