Skip to content

Commit f1e64ee

Browse files
committed
RST writer: don't emit alignment markers in grid tables.
Closes #10857.
1 parent 97b7d48 commit f1e64ee

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/Text/Pandoc/Writers/RST.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ blockToRST (Table _attrs blkCapt specs thead tbody tfoot) = do
339339
modify $ \st -> st{ stOptions = oldOpts }
340340
return result
341341
opts <- gets stOptions
342-
let renderGrid = gridTable opts blocksToDoc specs thead tbody tfoot
342+
let specs' = map (\(_,width) -> (AlignDefault, width)) specs
343+
renderGrid = gridTable opts blocksToDoc specs' thead tbody tfoot
343344
isSimple = all (== 0) widths && length widths > 1
344345
renderSimple = do
345346
tbl' <- simpleTable opts blocksToDoc headers rows

test/tables-rstsubset.native

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@
462462
, Str "lines."
463463
]
464464
])
465-
[ ( AlignCenter , ColWidth 0.15 )
466-
, ( AlignLeft , ColWidth 0.1375 )
467-
, ( AlignRight , ColWidth 0.1625 )
468-
, ( AlignLeft , ColWidth 0.35 )
465+
[ ( AlignDefault , ColWidth 0.15 )
466+
, ( AlignDefault , ColWidth 0.1375 )
467+
, ( AlignDefault , ColWidth 0.1625 )
468+
, ( AlignDefault , ColWidth 0.35 )
469469
]
470470
(TableHead
471471
( "" , [] , [] )
@@ -606,10 +606,10 @@
606606
, Table
607607
( "" , [] , [] )
608608
(Caption Nothing [])
609-
[ ( AlignCenter , ColWidth 0.15 )
610-
, ( AlignLeft , ColWidth 0.1375 )
611-
, ( AlignRight , ColWidth 0.1625 )
612-
, ( AlignLeft , ColWidth 0.35 )
609+
[ ( AlignDefault , ColWidth 0.15 )
610+
, ( AlignDefault , ColWidth 0.1375 )
611+
, ( AlignDefault , ColWidth 0.1625 )
612+
, ( AlignDefault , ColWidth 0.35 )
613613
]
614614
(TableHead
615615
( "" , [] , [] )

test/tables.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Multiline table with caption:
3939
+-----------+----------+------------+---------------------------+
4040
| Centered | Left | Right | Default aligned |
4141
| Header | Aligned | Aligned | |
42-
+:=========:+:=========+===========:+:==========================+
42+
+===========+==========+============+===========================+
4343
| First | row | 12.0 | Example of a row that |
4444
| | | | spans multiple lines. |
4545
+-----------+----------+------------+---------------------------+
@@ -53,7 +53,7 @@ Multiline table without caption:
5353
+-----------+----------+------------+---------------------------+
5454
| Centered | Left | Right | Default aligned |
5555
| Header | Aligned | Aligned | |
56-
+:=========:+:=========+===========:+:==========================+
56+
+===========+==========+============+===========================+
5757
| First | row | 12.0 | Example of a row that |
5858
| | | | spans multiple lines. |
5959
+-----------+----------+------------+---------------------------+

0 commit comments

Comments
 (0)