aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-05-15 14:57:45 -0700
committerJohn MacFarlane <[email protected]>2025-05-15 14:57:45 -0700
commitadc05a6cd42b10712c6896e9de220d99375593be (patch)
tree4da91b37a3bd85a95e0572e68de6702be7f8a84f /src
parent7aed3b2693cac53fdda6bc75cfc2c3c6a47d785c (diff)
gridTable: more improvements to colspan handling.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 5864da81c..f286360e2 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -83,7 +83,7 @@ import Text.Pandoc.Translations (setTranslations)
import Data.Maybe (fromMaybe)
import qualified Text.Pandoc.Writers.AnnotatedTable as Ann
-import Debug.Trace
+-- import Debug.Trace
-- | Create template Context from a 'Meta' and an association list
-- of variables, specified at the command line or in the writer.
@@ -339,8 +339,8 @@ resetWidths (w:ws) (c:cs) =
case cellColSpan c of
1 -> c{ cellWidth = w } : resetWidths ws cs
n | n < 1 -> c : resetWidths ws cs
- | otherwise -> c{ cellWidth = sum (take n ws) + (3 * (n - 1)) }
- : resetWidths (drop n ws) cs
+ | otherwise -> c{ cellWidth = sum (take (n - 1) ws) + (3 * (n - 1)) + 1 }
+ : resetWidths (drop (n - 1) ws) cs
redoWidths :: WriterOptions -> [ColSpec] -> [[RenderedCell Text]] -> [[RenderedCell Text]]
redoWidths _ _ [] = []
@@ -380,8 +380,8 @@ addDummies widths = reverse . snd . foldl' addDummy (0,[])
where
addDummy (i,cs) c =
case cellColNum c - i of
- 0 -> (i+1, c:cs)
- len -> (cellColNum c + 1, c : makeDummy widths i len : cs)
+ 0 -> (cellColNum c + cellColSpan c, c:cs)
+ len -> (cellColNum c + cellColSpan c, c : makeDummy widths i len : cs)
setTopBorder :: LineStyle -> [[RenderedCell Text]] -> [[RenderedCell Text]]