mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
58e741a0d6
The ANSI writer is now able to keep track of row spans and apply them in rows. [API change] T.P.Writers.Shared: Add functions `insertCurrentSpansAtColumn`, `takePreviousSpansAtColumn` and `decrementTrailingRowSpans` for applying and keeping track of RowSpans over multiple rows. Fixes: #10149
297 lines
6.6 KiB
Markdown
297 lines
6.6 KiB
Markdown
Row spans
|
|
```
|
|
% pandoc -f html --columns 24 -t ansi
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<td rowspan="3">1</td>
|
|
<td>2</td>
|
|
<td>3</td>
|
|
<td>4</td>
|
|
<td rowspan="4">5</td>
|
|
<td>6</td>
|
|
</tr>
|
|
<tr>
|
|
<td>2</td>
|
|
<td colspan="2" rowspan="2">3</td>
|
|
<td>6</td>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan="2">2</td>
|
|
<td>6</td>
|
|
</tr>
|
|
<tr>
|
|
<td>1</td>
|
|
<td>3</td>
|
|
<td>4</td>
|
|
<td>6</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="2">a</td>
|
|
<td rowspan="2">c</td>
|
|
<td>d</td>
|
|
<td>e</td>
|
|
<td>f</td>
|
|
</tr>
|
|
<tr>
|
|
<td>a</td>
|
|
<td>b</td>
|
|
<td colspan="3" rowspan="2">d</td>
|
|
</tr>
|
|
<tr>
|
|
<td>a</td>
|
|
<td>b</td>
|
|
<td>c</td>
|
|
</tr>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="2" rowspan="4">A</td>
|
|
<td>C</td>
|
|
<td>D</td>
|
|
<td colspan="2" rowspan="3">E</td>
|
|
</tr>
|
|
<tr>
|
|
<td>C</td>
|
|
<td>D</td>
|
|
</tr>
|
|
<tr>
|
|
<td>C</td>
|
|
<td>D</td>
|
|
</tr>
|
|
<tr>
|
|
<td>C</td>
|
|
<td>D</td>
|
|
<td>E</td>
|
|
<td>F</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
^D
|
|
1 2 3 4 5 6
|
|
2 3 6
|
|
2 6
|
|
1 3 4 6
|
|
─── ─── ─── ─── ─── ───
|
|
a c d e f
|
|
a b d
|
|
a b c
|
|
─── ─── ─── ─── ─── ───
|
|
A C D E
|
|
C D
|
|
C D
|
|
C D E F[0m]8;;\
|
|
```
|
|
|
|
Empty rows
|
|
```
|
|
% pandoc -f native --columns 12 -t ansi
|
|
[ Table
|
|
( "" , [] , [] )
|
|
(Caption Nothing [])
|
|
[ ( AlignDefault , ColWidthDefault )
|
|
, ( AlignDefault , ColWidthDefault )
|
|
, ( AlignDefault , ColWidthDefault )
|
|
]
|
|
(TableHead
|
|
( "" , [] , [] )
|
|
[ Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 3)
|
|
(ColSpan 2)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
, Row ( "" , [] , [] ) []
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "2" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
])
|
|
[ TableBody
|
|
( "" , [] , [] )
|
|
(RowHeadColumns 0)
|
|
[]
|
|
[ Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "2" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 2)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 4)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "2" ] ]
|
|
]
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
, Row ( "" , [] , [] ) []
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
]
|
|
]
|
|
(TableFoot
|
|
( "" , [] , [] )
|
|
[ Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "2" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 2)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
, Row ( "" , [] , [] ) []
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "2" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 3)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "3" ] ]
|
|
]
|
|
, Row
|
|
( "" , [] , [] )
|
|
[ Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "1" ] ]
|
|
, Cell
|
|
( "" , [] , [] )
|
|
AlignDefault
|
|
(RowSpan 1)
|
|
(ColSpan 1)
|
|
[ Plain [ Str "2" ] ]
|
|
]
|
|
, Row ( "" , [] , [] ) []
|
|
])
|
|
]
|
|
^D
|
|
1 3
|
|
3
|
|
1 2 3
|
|
─── ─── ───
|
|
1 2 3
|
|
1 2
|
|
1 3
|
|
1 3
|
|
─── ─── ───
|
|
1 2 3
|
|
1 2 3
|
|
1 2[0m]8;;\
|
|
```
|