summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-03-13 03:19:13 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-03-13 03:19:13 +0000
commit533dd14f985545601b33e50fac87f1e31016e292 (patch)
treeebe28fc4e342b7c2489c9db30507315b3bb7ebbf
parentbc31d9fe28db967bf02bc165300f68b5061f8db9 (diff)
Man writer: properly handle headerless tables.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1881 788f1e2b-df1e-0410-8736-df70ead52e1b
-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