From 6a23ac0d1dc91260fb86abd517cfbdf24b0dfe1b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 29 Nov 2022 09:37:31 -0800 Subject: DocBook writer: render image alt text using textobject element. See #8437. --- src/Text/Pandoc/Writers/DocBook.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/DocBook.hs b/src/Text/Pandoc/Writers/DocBook.hs index db94a518e..c7db4c699 100644 --- a/src/Text/Pandoc/Writers/DocBook.hs +++ b/src/Text/Pandoc/Writers/DocBook.hs @@ -438,13 +438,17 @@ inlineToDocBook opts (Link attr txt (src, _)) then inTags False "link" $ ("xlink:href", src) : idAndRole attr else inTags False "ulink" $ ("url", src) : idAndRole attr ) <$> inlinesToDocBook opts txt -inlineToDocBook opts (Image attr _ (src, tit)) = return $ +inlineToDocBook opts (Image attr ils (src, tit)) = return $ let titleDoc = if T.null tit then empty else inTagsIndented "objectinfo" $ inTagsIndented "title" (literal $ escapeStringForXML tit) + alt = if null ils + then mempty + else inTagsIndented "textobject" $ + inTags False "phrase" [] $ literal (stringify ils) in inTagsIndented "inlinemediaobject" $ inTagsIndented "imageobject" $ - titleDoc $$ imageToDocBook opts attr src + titleDoc $$ imageToDocBook opts attr src $$ alt inlineToDocBook opts (Note contents) = inTagsIndented "footnote" <$> blocksToDocBook opts contents -- cgit v1.2.3