git.iko.soy/typeable/pandoc
on master help sign in
Small fix to haddock "tables".
commitc4182b39ca009f02fc4e0768056d37d64b93df7c authorJohn MacFarlane <jgm@berkeley.edu> dateWed 18 Jun 2014, 18:08 (12 years ago) parentbc037b6
2 files changed+11−6
src/Text/Pandoc/Writers/Haddock.hs+2−2 tests/tables.haddock+9−4
src/Text/Pandoc/Writers/Haddock.hs+2−2
@@ -129,7 +129,7 @@ blockToHaddock opts (BlockQuote blocks) =
129129-- Haddock doesn't have tables. Use haddock tables in code.
130130blockToHaddock opts (Table caption aligns widths headers rows) = do
131131 caption' <- inlineListToHaddock opts caption
132− let caption'' = if null caption || not (isEnabled Ext_table_captions opts)
132+ let caption'' = if null caption
133133 then empty
134134 else blankline <> caption' <> blankline
135135 rawHeaders <- mapM (blockListToHaddock opts) headers
@@ -148,7 +148,7 @@ blockToHaddock opts (Table caption aligns widths headers rows) = do
148148 | otherwise -> fmap (id,) $
149149 gridTable opts (all null headers) aligns widths
150150 rawHeaders rawRows
151− return $ prefixed "> " $ nst $ tbl $$ blankline $$ caption'' $$ blankline
151+ return $ (prefixed "> " $ nst $ tbl $$ blankline $$ caption'') $$ blankline
152152blockToHaddock opts (BulletList items) = do
153153 contents <- mapM (bulletListItemToHaddock opts) items
154154 return $ cat contents <> blankline
tests/tables.haddock+9−4
@@ -6,6 +6,8 @@ Simple table with caption:
66> 123 123 123 123
77> 1 1 1 1
88>
9+> Demonstration of simple table syntax.
10+
911Simple table without caption:
1012
1113> Right Left Center Default
@@ -13,7 +15,7 @@ Simple table without caption:
1315> 12 12 12 12
1416> 123 123 123 123
1517> 1 1 1 1
16−>
18+
1719Simple table indented two spaces:
1820
1921> Right Left Center Default
@@ -22,6 +24,8 @@ Simple table indented two spaces:
2224> 123 123 123 123
2325> 1 1 1 1
2426>
27+> Demonstration of simple table syntax.
28+
2529Multiline table with caption:
2630
2731> --------------------------------------------------------------
@@ -36,6 +40,8 @@ Multiline table with caption:
3640> rows.
3741> --------------------------------------------------------------
3842>
43+> Here\'s the caption. It may span multiple lines.
44+
3945Multiline table without caption:
4046
4147> --------------------------------------------------------------
@@ -49,7 +55,7 @@ Multiline table without caption:
4955> the blank line between
5056> rows.
5157> --------------------------------------------------------------
52−>
58+
5359Table without column headers:
5460
5561> ----- ----- ----- -----
@@ -57,7 +63,7 @@ Table without column headers:
5763> 123 123 123 123
5864> 1 1 1 1
5965> ----- ----- ----- -----
60−>
66+
6167Multiline table without column headers:
6268
6369> ----------- ---------- ------------ --------------------------
@@ -68,5 +74,4 @@ Multiline table without column headers:
6874> the blank line between
6975> rows.
7076> ----------- ---------- ------------ --------------------------
71−>
7277