summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Man.hs6
-rw-r--r--tests/tables.man60
2 files changed, 64 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 2872fd91a..df66e17ba 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -178,13 +178,15 @@ blockToMan opts (Table caption alignments widths headers rows) =
let makeRow cols = text "T{" $$
(vcat $ intersperse (text "T}@T{") cols) $$
text "T}"
- let colheadings' = makeRow colheadings
+ let colheadings' = if all null headers
+ then empty
+ else makeRow colheadings $$ char '_'
body <- mapM (\row -> do
cols <- mapM (blockListToMan opts) row
return $ makeRow cols) rows
return $ text ".PP" $$ caption' $$
text ".TS" $$ text "tab(@);" $$ coldescriptions $$
- colheadings' $$ char '_' $$ vcat body $$ text ".TE"
+ colheadings' $$ vcat body $$ text ".TE"
blockToMan opts (BulletList items) = do
contents <- mapM (bulletListItemToMan opts) items
diff --git a/tests/tables.man b/tests/tables.man
index f49d07b0b..35922b4df 100644
--- a/tests/tables.man
+++ b/tests/tables.man
@@ -205,3 +205,63 @@ Here\[aq]s another one.
Note the blank line between rows.
T}
.TE
+.PP
+Table without column headers:
+.PP
+.TS
+tab(@);
+r l c r.
+T{
+12
+T}@T{
+12
+T}@T{
+12
+T}@T{
+12
+T}
+T{
+123
+T}@T{
+123
+T}@T{
+123
+T}@T{
+123
+T}
+T{
+1
+T}@T{
+1
+T}@T{
+1
+T}@T{
+1
+T}
+.TE
+.PP
+Multiline table without column headers:
+.PP
+.TS
+tab(@);
+cw(10.50n) lw(9.63n) rw(11.38n) lw(23.63n).
+T{
+First
+T}@T{
+row
+T}@T{
+12.0
+T}@T{
+Example of a row that spans multiple lines.
+T}
+T{
+Second
+T}@T{
+row
+T}@T{
+5.0
+T}@T{
+Here\[aq]s another one.
+Note the blank line between rows.
+T}
+.TE