git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #4573 from expipiplus1/haddock-links

Haddock Writer: Support Haddock tables

commit7f258cd3597d5bcae7d44ebb7254d2059bc8652d authorJohn MacFarlane <jgm@berkeley.edu> dateMon 20 Apr 2020, 09:13 (7 years ago) parent9b5e571fd5994c
2 files changed+71−71
src/Text/Pandoc/Writers/Haddock.hs+1−1 test/tables.haddock+70−70
src/Text/Pandoc/Writers/Haddock.hs+1−1
@@ -124,7 +124,7 @@ blockToHaddock opts (Table _ blkCapt specs thead tbody tfoot) = do
124124 tbl <- gridTable opts blockListToHaddock
125125 (all null headers) (map (const AlignDefault) aligns)
126126 widths headers rows
127− return $ prefixed "> " (tbl $$ blankline $$ caption'') $$ blankline
127+ return $ (tbl $$ blankline $$ caption'') $$ blankline
128128blockToHaddock opts (BulletList items) = do
129129 contents <- mapM (bulletListItemToHaddock opts) items
130130 return $ (if isTightList items then vcat else vsep) contents <> blankline
test/tables.haddock+70−70
@@ -1,90 +1,90 @@
11Simple table with caption:
22
3−> +-------+------+--------+---------+
4−> | Right | Left | Center | Default |
5−> +=======+======+========+=========+
6−> | 12 | 12 | 12 | 12 |
7−> +-------+------+--------+---------+
8−> | 123 | 123 | 123 | 123 |
9−> +-------+------+--------+---------+
10−> | 1 | 1 | 1 | 1 |
11−> +-------+------+--------+---------+
12−>
13−> Demonstration of simple table syntax.
3++-------+------+--------+---------+
4+| Right | Left | Center | Default |
5++=======+======+========+=========+
6+| 12 | 12 | 12 | 12 |
7++-------+------+--------+---------+
8+| 123 | 123 | 123 | 123 |
9++-------+------+--------+---------+
10+| 1 | 1 | 1 | 1 |
11++-------+------+--------+---------+
12+
13+Demonstration of simple table syntax.
1414
1515Simple table without caption:
1616
17−> +-------+------+--------+---------+
18−> | Right | Left | Center | Default |
19−> +=======+======+========+=========+
20−> | 12 | 12 | 12 | 12 |
21−> +-------+------+--------+---------+
22−> | 123 | 123 | 123 | 123 |
23−> +-------+------+--------+---------+
24−> | 1 | 1 | 1 | 1 |
25−> +-------+------+--------+---------+
17++-------+------+--------+---------+
18+| Right | Left | Center | Default |
19++=======+======+========+=========+
20+| 12 | 12 | 12 | 12 |
21++-------+------+--------+---------+
22+| 123 | 123 | 123 | 123 |
23++-------+------+--------+---------+
24+| 1 | 1 | 1 | 1 |
25++-------+------+--------+---------+
2626
2727Simple table indented two spaces:
2828
29−> +-------+------+--------+---------+
30−> | Right | Left | Center | Default |
31−> +=======+======+========+=========+
32−> | 12 | 12 | 12 | 12 |
33−> +-------+------+--------+---------+
34−> | 123 | 123 | 123 | 123 |
35−> +-------+------+--------+---------+
36−> | 1 | 1 | 1 | 1 |
37−> +-------+------+--------+---------+
38−>
39−> Demonstration of simple table syntax.
29++-------+------+--------+---------+
30+| Right | Left | Center | Default |
31++=======+======+========+=========+
32+| 12 | 12 | 12 | 12 |
33++-------+------+--------+---------+
34+| 123 | 123 | 123 | 123 |
35++-------+------+--------+---------+
36+| 1 | 1 | 1 | 1 |
37++-------+------+--------+---------+
38+
39+Demonstration of simple table syntax.
4040
4141Multiline table with caption:
4242
43−> +----------+---------+-----------+--------------------------+
44−> | Centered | Left | Right | Default aligned |
45−> | Header | Aligned | Aligned | |
46−> +==========+=========+===========+==========================+
47−> | First | row | 12.0 | Example of a row that |
48−> | | | | spans multiple lines. |
49−> +----------+---------+-----------+--------------------------+
50−> | Second | row | 5.0 | Here’s another one. Note |
51−> | | | | the blank line between |
52−> | | | | rows. |
53−> +----------+---------+-----------+--------------------------+
54−>
55−> Here’s the caption. It may span multiple lines.
43++----------+---------+-----------+--------------------------+
44+| Centered | Left | Right | Default aligned |
45+| Header | Aligned | Aligned | |
46++==========+=========+===========+==========================+
47+| First | row | 12.0 | Example of a row that |
48+| | | | spans multiple lines. |
49++----------+---------+-----------+--------------------------+
50+| Second | row | 5.0 | Here’s another one. Note |
51+| | | | the blank line between |
52+| | | | rows. |
53++----------+---------+-----------+--------------------------+
54+
55+Here’s the caption. It may span multiple lines.
5656
5757Multiline table without caption:
5858
59−> +----------+---------+-----------+--------------------------+
60−> | Centered | Left | Right | Default aligned |
61−> | Header | Aligned | Aligned | |
62−> +==========+=========+===========+==========================+
63−> | First | row | 12.0 | Example of a row that |
64−> | | | | spans multiple lines. |
65−> +----------+---------+-----------+--------------------------+
66−> | Second | row | 5.0 | Here’s another one. Note |
67−> | | | | the blank line between |
68−> | | | | rows. |
69−> +----------+---------+-----------+--------------------------+
59++----------+---------+-----------+--------------------------+
60+| Centered | Left | Right | Default aligned |
61+| Header | Aligned | Aligned | |
62++==========+=========+===========+==========================+
63+| First | row | 12.0 | Example of a row that |
64+| | | | spans multiple lines. |
65++----------+---------+-----------+--------------------------+
66+| Second | row | 5.0 | Here’s another one. Note |
67+| | | | the blank line between |
68+| | | | rows. |
69++----------+---------+-----------+--------------------------+
7070
7171Table without column headers:
7272
73−> +-----+-----+-----+-----+
74−> | 12 | 12 | 12 | 12 |
75−> +-----+-----+-----+-----+
76−> | 123 | 123 | 123 | 123 |
77−> +-----+-----+-----+-----+
78−> | 1 | 1 | 1 | 1 |
79−> +-----+-----+-----+-----+
73++-----+-----+-----+-----+
74+| 12 | 12 | 12 | 12 |
75++-----+-----+-----+-----+
76+| 123 | 123 | 123 | 123 |
77++-----+-----+-----+-----+
78+| 1 | 1 | 1 | 1 |
79++-----+-----+-----+-----+
8080
8181Multiline table without column headers:
8282
83−> +----------+---------+-----------+--------------------------+
84−> | First | row | 12.0 | Example of a row that |
85−> | | | | spans multiple lines. |
86−> +----------+---------+-----------+--------------------------+
87−> | Second | row | 5.0 | Here’s another one. Note |
88−> | | | | the blank line between |
89−> | | | | rows. |
90−> +----------+---------+-----------+--------------------------+
83++----------+---------+-----------+--------------------------+
84+| First | row | 12.0 | Example of a row that |
85+| | | | spans multiple lines. |
86++----------+---------+-----------+--------------------------+
87+| Second | row | 5.0 | Here’s another one. Note |
88+| | | | the blank line between |
89+| | | | rows. |
90++----------+---------+-----------+--------------------------+