aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-05-19 15:51:40 -0700
committerJohn MacFarlane <[email protected]>2025-05-19 15:51:40 -0700
commit97b7d483339acfc25e900d17bbba40ef7a440349 (patch)
tree54fb1e2b3c5fb3d87f2be26e25a24ebe9b4788cf /src
parentf4c7fccd9346e50f99ba770512c71ffeb497bf70 (diff)
gridTable: fix (3.7) regression with missing cell alignments.
Closes #10853.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 1cb3046d3..06827b1b5 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -438,9 +438,11 @@ gridRows (x:xs) =
rowAndBottom thisRow nextRow =
let isLastRow = null nextRow
border1 = render Nothing (formatBorder cellBottomBorder False thisRow)
- border2 = render Nothing (formatBorder cellTopBorder False nextRow)
+ border2 = render Nothing (formatBorder cellTopBorder True nextRow)
go '+' _ = '+'
go _ '+' = '+'
+ go ':' _ = ':'
+ go _ ':' = ':'
go '|' '-' = '+'
go '-' '|' = '+'
go '|' '=' = '+'
@@ -454,7 +456,7 @@ gridRows (x:xs) =
else literal $ T.zipWith go border1 border2
in formatRow thisRow $$ combinedBorder
-formatBorder :: (RenderedCell a -> LineStyle) -> Bool -> [RenderedCell a]
+formatBorder :: Show a => (RenderedCell a -> LineStyle) -> Bool -> [RenderedCell a]
-> Doc Text
formatBorder borderStyle alignMarkers cs =
borderParts <> if lastBorderStyle == NoLine
@@ -476,7 +478,8 @@ formatBorder borderStyle alignMarkers cs =
DoubleLine -> '='
(leftalign, rightalign) =
case cellAlign c of
- _ | not alignMarkers -> (lineChar,lineChar)
+ _ | not alignMarkers || borderStyle c /= DoubleLine
+ -> (lineChar,lineChar)
AlignLeft -> (':',lineChar)
AlignCenter -> (':',':')
AlignRight -> (lineChar,':')