aboutsummaryrefslogtreecommitdiff
path: root/haddock-library/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-library/fixtures')
-rw-r--r--haddock-library/fixtures/Fixtures.hs9
-rw-r--r--haddock-library/fixtures/examples/table-simple.input7
-rw-r--r--haddock-library/fixtures/examples/table-simple.parsed52
-rw-r--r--haddock-library/fixtures/examples/table1.input12
-rw-r--r--haddock-library/fixtures/examples/table1.parsed81
-rw-r--r--haddock-library/fixtures/examples/table2.input7
-rw-r--r--haddock-library/fixtures/examples/table2.parsed46
-rw-r--r--haddock-library/fixtures/examples/table3.input7
-rw-r--r--haddock-library/fixtures/examples/table3.parsed50
-rw-r--r--haddock-library/fixtures/examples/table4.input17
-rw-r--r--haddock-library/fixtures/examples/table4.parsed26
-rw-r--r--haddock-library/fixtures/examples/table5.input8
-rw-r--r--haddock-library/fixtures/examples/table5.parsed53
13 files changed, 375 insertions, 0 deletions
diff --git a/haddock-library/fixtures/Fixtures.hs b/haddock-library/fixtures/Fixtures.hs
index 3707e0a8..f75ff664 100644
--- a/haddock-library/fixtures/Fixtures.hs
+++ b/haddock-library/fixtures/Fixtures.hs
@@ -151,3 +151,12 @@ instance ToExpr Picture
deriving instance Generic Example
instance ToExpr Example
+
+deriving instance Generic (Table id)
+instance ToExpr id => ToExpr (Table id)
+
+deriving instance Generic (TableRow id)
+instance ToExpr id => ToExpr (TableRow id)
+
+deriving instance Generic (TableCell id)
+instance ToExpr id => ToExpr (TableCell id)
diff --git a/haddock-library/fixtures/examples/table-simple.input b/haddock-library/fixtures/examples/table-simple.input
new file mode 100644
index 00000000..d9c49f87
--- /dev/null
+++ b/haddock-library/fixtures/examples/table-simple.input
@@ -0,0 +1,7 @@
++------+--------------+------------------------------------------+
+| code | message | description |
++======+==============+==========================================+
+| 200 | @OK@ | operation successful |
++------+--------------+------------------------------------------+
+| 204 | @No Content@ | operation successful, no body returned |
++------+--------------+------------------------------------------+
diff --git a/haddock-library/fixtures/examples/table-simple.parsed b/haddock-library/fixtures/examples/table-simple.parsed
new file mode 100644
index 00000000..b5e62453
--- /dev/null
+++ b/haddock-library/fixtures/examples/table-simple.parsed
@@ -0,0 +1,52 @@
+DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " 200 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocAppend
+ (DocString " ")
+ (DocAppend
+ (DocMonospaced (DocString "OK"))
+ (DocString " ")),
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ " operation successful ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " 204 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocAppend
+ (DocString " ")
+ (DocAppend
+ (DocMonospaced (DocString "No Content"))
+ (DocString " ")),
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ " operation successful, no body returned ",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " code ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " message ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ " description ",
+ tableCellRowspan = 1}]]}
diff --git a/haddock-library/fixtures/examples/table1.input b/haddock-library/fixtures/examples/table1.input
new file mode 100644
index 00000000..a007020c
--- /dev/null
+++ b/haddock-library/fixtures/examples/table1.input
@@ -0,0 +1,12 @@
++------------------------+------------+----------+----------+
+| Header row, column 1 | Header 2 | Header 3 | Header 4 |
+| (header rows optional) | | | |
++========================+============+==========+==========+
+| body row 1, column 1 | column 2 | column 3 | column 4 |
++------------------------+------------+----------+----------+
+| body row 2 | Cells may span columns. |
++------------------------+------------+---------------------+
+| body row 3 | Cells may | \[ |
++------------------------+ span rows. | f(n) = \sum_{i=1} |
+| body row 4 | | \] |
++------------------------+------------+---------------------+
diff --git a/haddock-library/fixtures/examples/table1.parsed b/haddock-library/fixtures/examples/table1.parsed
new file mode 100644
index 00000000..2fa58fd8
--- /dev/null
+++ b/haddock-library/fixtures/examples/table1.parsed
@@ -0,0 +1,81 @@
+DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " body row 1, column 1 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 4 ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " body row 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 3,
+ tableCellContents = DocString " Cells may span columns. ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " body row 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat
+ [" Cells may \n",
+ " span rows. \n",
+ " "]),
+ tableCellRowspan = 2},
+ TableCell
+ {tableCellColspan = 2,
+ tableCellContents = DocAppend
+ (DocString " ")
+ (DocAppend
+ (DocMathDisplay
+ (concat
+ [" \n",
+ " f(n) = \\sum_{i=1} \n",
+ " "]))
+ (DocString " ")),
+ tableCellRowspan = 2}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " body row 4 ",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat
+ [" Header row, column 1 \n",
+ " (header rows optional) "]),
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat [" Header 2 \n", " "]),
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat [" Header 3 \n", " "]),
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat [" Header 4 \n", " "]),
+ tableCellRowspan = 1}]]}
diff --git a/haddock-library/fixtures/examples/table2.input b/haddock-library/fixtures/examples/table2.input
new file mode 100644
index 00000000..aa5d0862
--- /dev/null
+++ b/haddock-library/fixtures/examples/table2.input
@@ -0,0 +1,7 @@
++--------------+----------+-----------+-----------+
+| row 1, col 1 | column 2 | column 3 | column 4 |
++--------------+----------+-----------+-----------+
+| row 2 | |
++--------------+----------+-----------+-----------+
+| row 3 | | | |
++--------------+----------+-----------+-----------+
diff --git a/haddock-library/fixtures/examples/table2.parsed b/haddock-library/fixtures/examples/table2.parsed
new file mode 100644
index 00000000..e3dbf0b4
--- /dev/null
+++ b/haddock-library/fixtures/examples/table2.parsed
@@ -0,0 +1,46 @@
+DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 1, col 1 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 4 ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 3,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = []}
diff --git a/haddock-library/fixtures/examples/table3.input b/haddock-library/fixtures/examples/table3.input
new file mode 100644
index 00000000..a6ca84ca
--- /dev/null
+++ b/haddock-library/fixtures/examples/table3.input
@@ -0,0 +1,7 @@
++--------------+----------+-----------+-----------+
+| row 1, col 1 | column 2 | column 3 | column 4 |
++--------------+----------+-----------+-----------+
+| row 2 | Use the command ``ls | more``. |
++--------------+----------+-----------+-----------+
+| row 3 | | | |
++--------------+----------+-----------+-----------+
diff --git a/haddock-library/fixtures/examples/table3.parsed b/haddock-library/fixtures/examples/table3.parsed
new file mode 100644
index 00000000..cabff9cb
--- /dev/null
+++ b/haddock-library/fixtures/examples/table3.parsed
@@ -0,0 +1,50 @@
+DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 1, col 1 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 4 ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 2,
+ tableCellContents = DocString " Use the command ``ls ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " more``. ",
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = []}
diff --git a/haddock-library/fixtures/examples/table4.input b/haddock-library/fixtures/examples/table4.input
new file mode 100644
index 00000000..2c5611c8
--- /dev/null
+++ b/haddock-library/fixtures/examples/table4.input
@@ -0,0 +1,17 @@
+Single outer cell:
+
++-------------+
+| outer |
+| |
++-------+ |
+| inner | |
++-------+-----+
+
+Broken (only inner cell is rendered):
+
++-------+-----+
+| inner | |
++-------+ |
+| |
+| outer |
++-------------+
diff --git a/haddock-library/fixtures/examples/table4.parsed b/haddock-library/fixtures/examples/table4.parsed
new file mode 100644
index 00000000..cfdd6f0f
--- /dev/null
+++ b/haddock-library/fixtures/examples/table4.parsed
@@ -0,0 +1,26 @@
+DocAppend
+ (DocParagraph (DocString "Single outer cell:"))
+ (DocAppend
+ (DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat
+ [" outer \n",
+ " \n",
+ "-------+ \n",
+ " inner | "]),
+ tableCellRowspan = 1}]],
+ tableHeaderRows = []})
+ (DocAppend
+ (DocParagraph (DocString "Broken (only inner cell is rendered):"))
+ (DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " inner ",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = []})))
diff --git a/haddock-library/fixtures/examples/table5.input b/haddock-library/fixtures/examples/table5.input
new file mode 100644
index 00000000..7cf26512
--- /dev/null
+++ b/haddock-library/fixtures/examples/table5.input
@@ -0,0 +1,8 @@
++--------------+----------+-----------+-----------+
+| row 1, col 1 | column 2 | column 3 | column 4 |
++==============+==========+===========+===========+
+| row 2 | Use the command @ls | more@. |
+| | |
+| +----------+-----------+-----------+
+| row 3 | | | |
++--------------+----------+-----------+-----------+
diff --git a/haddock-library/fixtures/examples/table5.parsed b/haddock-library/fixtures/examples/table5.parsed
new file mode 100644
index 00000000..9a547ad3
--- /dev/null
+++ b/haddock-library/fixtures/examples/table5.parsed
@@ -0,0 +1,53 @@
+DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ (concat
+ [" row 2 \n",
+ " \n",
+ " \n",
+ " row 3 "]),
+ tableCellRowspan = 2},
+ TableCell
+ {tableCellColspan = 3,
+ tableCellContents = DocAppend
+ (DocString " Use the command ")
+ (DocAppend
+ (DocMonospaced (DocString "ls | more"))
+ (DocString
+ (concat
+ [". \n",
+ " "]))),
+ tableCellRowspan = 1}],
+ TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " ",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " row 1, col 1 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 2 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 3 ",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString " column 4 ",
+ tableCellRowspan = 1}]]}