Skip to content

Commit

Permalink
DocBook writer: output identifiers of figure blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Flupp committed Feb 9, 2023
1 parent 9eee4a2 commit d23f6a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Text/Pandoc/Writers/DocBook.hs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ blockToDocBook opts (Table _ blkCapt specs thead tbody tfoot) = do
return $ inTagsIndented tableType $ captionDoc $$
inTags True "tgroup" [("cols", tshow (length aligns))] (
coltags $$ head' $$ body')
blockToDocBook opts (Figure attr capt@(Caption _ caption) body) = do
blockToDocBook opts (Figure attr@(id', _, _) capt@(Caption _ caption) body) = do
-- TODO: probably better to handle nested figures as mediaobject
let isAcceptable = \case
Table {} -> All False
Expand All @@ -344,10 +344,11 @@ blockToDocBook opts (Figure attr capt@(Caption _ caption) body) = do
DocBook4 -> pure mempty -- docbook4 requires media
DocBook5 -> blocksToDocBook opts body
mediaobjects <- mapM toMediaobject body
version <- ask
return $
if isEmpty $ mconcat mediaobjects
then mempty -- figures must have at least some content
else inTagsIndented "figure" $
else inTags True "figure" [(idName version, id') | not (T.null id')] $
inTagsSimple "title" title $$
mconcat mediaobjects

Expand Down

0 comments on commit d23f6a8

Please sign in to comment.