summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-11-29 10:01:31 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2022-11-29 10:16:41 -0800
commit513bdef40b556dfca61be2681088b3b74b86e86b (patch)
tree29e856740a1fde3f43b3ce3b1105b44f06c82868 /src/Text
parentfe799eea91089aa90b935d2cab5cd87223906f65 (diff)
DocBook writer: Fix position of textobject.
It is a child of `inlinemediaobject`, not `imageobject`. Add regression tests for #8437. Closes #8437.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs2
-rw-r--r--src/Text/Pandoc/Writers/DocBook.hs6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 50faa9cd4..30611780f 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -833,7 +833,7 @@ getMediaobject e = do
|| named "textobject" x
|| named "alt" x) el of
Nothing -> return mempty
- Just z -> mconcat <$>
+ Just z -> trimInlines . mconcat <$>
mapM parseInline (elContent z)
let (capt, title) = if null figTitle
then (getCaption e, tit)
diff --git a/src/Text/Pandoc/Writers/DocBook.hs b/src/Text/Pandoc/Writers/DocBook.hs
index 9f494c21f..b79c7b081 100644
--- a/src/Text/Pandoc/Writers/DocBook.hs
+++ b/src/Text/Pandoc/Writers/DocBook.hs
@@ -447,8 +447,10 @@ inlineToDocBook opts (Image attr ils (src, tit)) = return $
then mempty
else inTagsIndented "textobject" $
inTagsSimple "phrase" $ literal (stringify ils)
- in inTagsIndented "inlinemediaobject" $ inTagsIndented "imageobject" $
- titleDoc $$ imageToDocBook opts attr src $$ alt
+ in inTagsIndented "inlinemediaobject" $
+ inTagsIndented "imageobject"
+ (titleDoc $$ imageToDocBook opts attr src)
+ $$ alt
inlineToDocBook opts (Note contents) =
inTagsIndented "footnote" <$> blocksToDocBook opts contents