aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/JATS
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-11-18 17:36:09 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2020-11-18 18:10:17 +0100
commit023468ea2d625516eb9ad6cef2240b2ac20091d4 (patch)
tree8ed4c8bbb7043868c277541bc0d06cee21e3a324 /src/Text/Pandoc/Writers/JATS
parent56f607b50b1bdff6762f46160c99615535f20abd (diff)
downloadpandoc-023468ea2d625516eb9ad6cef2240b2ac20091d4.tar.gz
JATS writer: wrap all tables
All `<table>` elements are put inside `<table-wrap>` elements, as the former are not valid as immediate child elements of `<body>`.
Diffstat (limited to 'src/Text/Pandoc/Writers/JATS')
-rw-r--r--src/Text/Pandoc/Writers/JATS/Table.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/JATS/Table.hs b/src/Text/Pandoc/Writers/JATS/Table.hs
index cccd866aa..dd7678f63 100644
--- a/src/Text/Pandoc/Writers/JATS/Table.hs
+++ b/src/Text/Pandoc/Writers/JATS/Table.hs
@@ -32,12 +32,13 @@ tableToJATS :: PandocMonad m
-> JATS m (Doc Text)
tableToJATS opts _attr blkCapt specs th tb tf = do
blockToJATS <- asks jatsBlockWriter
- case toLegacyTable blkCapt specs th tb tf of
- ([], aligns, widths, headers, rows) -> captionlessTable aligns widths headers rows
- (caption, aligns, widths, headers, rows) -> do
- captionDoc <- inTagsIndented "caption" <$> blockToJATS opts (Para caption)
- tbl <- captionlessTable aligns widths headers rows
- return $ inTags True "table-wrap" [] $ captionDoc $$ tbl
+ let (caption, aligns, widths, headers, rows) =
+ toLegacyTable blkCapt specs th tb tf
+ captionDoc <- if null caption
+ then return mempty
+ else inTagsIndented "caption" <$> blockToJATS opts (Para caption)
+ tbl <- captionlessTable aligns widths headers rows
+ return $ inTags True "table-wrap" [] $ captionDoc $$ tbl
where
captionlessTable aligns widths headers rows = do
let percent w = tshow (truncate (100*w) :: Integer) <> "*"