From 34151e8da8e1863b7954d87c1713b97f3a944545 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sun, 13 Sep 2020 23:20:26 +0200 Subject: HTML writer: support intermediate table headers Closes: #6314 --- src/Text/Pandoc/Writers/HTML.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 9e6e22283..8162da66a 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -919,7 +919,7 @@ tableToHtml opts (Ann.Table attr caption colspecs thead tbodies tfoot) = do nl opts coltags <- colSpecListToHtml opts colspecs head' <- tableHeadToHtml opts thead - body' <- mconcat <$> mapM (tableBodyToHtml opts) tbodies + bodies <- intersperse (nl opts) <$> mapM (tableBodyToHtml opts) tbodies foot' <- tableFootToHtml opts tfoot let (ident,classes,kvs) = attr -- When widths of columns are < 100%, we need to set width for the whole @@ -940,7 +940,7 @@ tableToHtml opts (Ann.Table attr caption colspecs thead tbodies tfoot) = do captionDoc coltags head' - body' + mconcat bodies foot' nl opts @@ -948,8 +948,14 @@ tableBodyToHtml :: PandocMonad m => WriterOptions -> Ann.TableBody -> StateT WriterState m Html -tableBodyToHtml opts (Ann.TableBody attr _rowHeadCols _intm rows) = - addAttrs opts attr . H.tbody =<< bodyRowsToHtml opts rows +tableBodyToHtml opts (Ann.TableBody attr _rowHeadCols inthead rows) = + addAttrs opts attr . H.tbody =<< do + intermediateHead <- + if null inthead + then return mempty + else headerRowsToHtml opts Thead inthead + bodyRows <- bodyRowsToHtml opts rows + return $ intermediateHead <> bodyRows tableHeadToHtml :: PandocMonad m => WriterOptions -- cgit v1.2.3