From 023468ea2d625516eb9ad6cef2240b2ac20091d4 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 18 Nov 2020 17:36:09 +0100 Subject: JATS writer: wrap all tables All `` elements are put inside `` elements, as the former are not valid as immediate child elements of ``. --- src/Text/Pandoc/Writers/JATS/Table.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Text') 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) <> "*" -- cgit v1.2.3