From c794a79a2aa8062017884f1b04c731281e7b2023 Mon Sep 17 00:00:00 2001 From: defanor Date: Fri, 1 Dec 2017 13:16:15 +0300 Subject: Skip empty table headers Pandoc adds them even when they are undefined, no need to add an additional horizontal rule in such a case. --- Pancake/Rendering.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Pancake') diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs index 55aabd6..0149655 100644 --- a/Pancake/Rendering.hs +++ b/Pancake/Rendering.hs @@ -438,7 +438,8 @@ renderBlock (P.Table caption aligns widths headers rows) = do (mapM (fmap (length . unstyled . concat . rLines) . renderCell 80)) rows pure $ map (\l -> fromIntegral l / fromIntegral (sum lens) * 0.7 + 1 / fromIntegral (length lens) * 0.3) lens - mapM_ (\r -> renderBlock P.HorizontalRule >> tableRow ws r) (headers : rows) + let withHead = if all null headers then id else (headers :) + mapM_ (\r -> renderBlock P.HorizontalRule >> tableRow ws r) (withHead rows) renderBlock P.HorizontalRule where renderCell :: Int -> [P.Block] -> Renderer [RendererOutput] -- cgit v1.2.3