aboutsummaryrefslogtreecommitdiff
path: root/haddock-library/fixtures/examples
diff options
context:
space:
mode:
authorAlina Banerjee <alinab@users.noreply.github.com>2019-08-01 16:01:39 -0500
committerAlec Theriault <alec.theriault@gmail.com>2020-03-20 20:24:17 -0400
commitdec888641006eb685a642ec489b198c61a5736dc (patch)
treed9634c3b0e1f7b656ebb572db003e7fc12590359 /haddock-library/fixtures/examples
parent053c9add568dad4264f4629bff0de9b10d9316e1 (diff)
Update parsing to strip whitespace from table cells (#1074)
* Update parsing to strip leading & trailing whitespace from table cells * Update fixture data to disallow whitespaces at both ends in table cells * Add test case for whitespaces stripped from both ends of table cells * Update table reference test data for html tests
Diffstat (limited to 'haddock-library/fixtures/examples')
-rw-r--r--haddock-library/fixtures/examples/table-cell-strip-whitespaces.input5
-rw-r--r--haddock-library/fixtures/examples/table-cell-strip-whitespaces.parsed29
-rw-r--r--haddock-library/fixtures/examples/table-simple.parsed28
-rw-r--r--haddock-library/fixtures/examples/table1.parsed45
-rw-r--r--haddock-library/fixtures/examples/table2.parsed20
-rw-r--r--haddock-library/fixtures/examples/table3.parsed22
-rw-r--r--haddock-library/fixtures/examples/table4.parsed10
-rw-r--r--haddock-library/fixtures/examples/table5.parsed27
8 files changed, 95 insertions, 91 deletions
diff --git a/haddock-library/fixtures/examples/table-cell-strip-whitespaces.input b/haddock-library/fixtures/examples/table-cell-strip-whitespaces.input
new file mode 100644
index 00000000..f5e3756d
--- /dev/null
+++ b/haddock-library/fixtures/examples/table-cell-strip-whitespaces.input
@@ -0,0 +1,5 @@
++------+--------------+-------------------------------------------------+
+| C1 | C2 | C3 |
++======+==============+=================================================+
+| row | 'test' | 'test table cell with .. whitepspace ' |
++------+--------------+-------------------------------------------------+
diff --git a/haddock-library/fixtures/examples/table-cell-strip-whitespaces.parsed b/haddock-library/fixtures/examples/table-cell-strip-whitespaces.parsed
new file mode 100644
index 00000000..19002369
--- /dev/null
+++ b/haddock-library/fixtures/examples/table-cell-strip-whitespaces.parsed
@@ -0,0 +1,29 @@
+DocTable
+ Table
+ {tableBodyRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString "row",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocIdentifier "test",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString
+ "'test table cell with .. whitepspace '",
+ tableCellRowspan = 1}]],
+ tableHeaderRows = [TableRow
+ [TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString "C1",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString "C2",
+ tableCellRowspan = 1},
+ TableCell
+ {tableCellColspan = 1,
+ tableCellContents = DocString "C3",
+ tableCellRowspan = 1}]]}
diff --git a/haddock-library/fixtures/examples/table-simple.parsed b/haddock-library/fixtures/examples/table-simple.parsed
index b5e62453..d027c75d 100644
--- a/haddock-library/fixtures/examples/table-simple.parsed
+++ b/haddock-library/fixtures/examples/table-simple.parsed
@@ -3,50 +3,40 @@ DocTable
{tableBodyRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " 200 ",
+ tableCellContents = DocString "200",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocAppend
- (DocString " ")
- (DocAppend
- (DocMonospaced (DocString "OK"))
- (DocString " ")),
+ tableCellContents = DocMonospaced (DocString "OK"),
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString
- " operation successful ",
+ tableCellContents = DocString "operation successful",
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " 204 ",
+ tableCellContents = DocString "204",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocAppend
- (DocString " ")
- (DocAppend
- (DocMonospaced (DocString "No Content"))
- (DocString " ")),
+ tableCellContents = DocMonospaced (DocString "No Content"),
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
tableCellContents = DocString
- " operation successful, no body returned ",
+ "operation successful, no body returned",
tableCellRowspan = 1}]],
tableHeaderRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " code ",
+ tableCellContents = DocString "code",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " message ",
+ tableCellContents = DocString "message",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString
- " description ",
+ tableCellContents = DocString "description",
tableCellRowspan = 1}]]}
diff --git a/haddock-library/fixtures/examples/table1.parsed b/haddock-library/fixtures/examples/table1.parsed
index 2fa58fd8..8b8908f4 100644
--- a/haddock-library/fixtures/examples/table1.parsed
+++ b/haddock-library/fixtures/examples/table1.parsed
@@ -3,79 +3,66 @@ DocTable
{tableBodyRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " body row 1, column 1 ",
+ tableCellContents = DocString "body row 1, column 1",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 2 ",
+ tableCellContents = DocString "column 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 3 ",
+ tableCellContents = DocString "column 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 4 ",
+ tableCellContents = DocString "column 4",
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " body row 2 ",
+ tableCellContents = DocString "body row 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 3,
- tableCellContents = DocString " Cells may span columns. ",
+ tableCellContents = DocString "Cells may span columns.",
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " body row 3 ",
+ tableCellContents = DocString "body row 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
tableCellContents = DocString
- (concat
- [" Cells may \n",
- " span rows. \n",
- " "]),
+ (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 " ")),
+ tableCellContents = DocMathDisplay
+ (concat ["\n", "f(n) = \\sum_{i=1}\n"]),
tableCellRowspan = 2}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " body row 4 ",
+ tableCellContents = DocString "body row 4",
tableCellRowspan = 1}]],
tableHeaderRows = [TableRow
[TableCell
{tableCellColspan = 1,
tableCellContents = DocString
(concat
- [" Header row, column 1 \n",
- " (header rows optional) "]),
+ ["Header row, column 1\n",
+ "(header rows optional)"]),
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString
- (concat [" Header 2 \n", " "]),
+ tableCellContents = DocString "Header 2\n",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString
- (concat [" Header 3 \n", " "]),
+ tableCellContents = DocString "Header 3\n",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString
- (concat [" Header 4 \n", " "]),
+ tableCellContents = DocString "Header 4\n",
tableCellRowspan = 1}]]}
diff --git a/haddock-library/fixtures/examples/table2.parsed b/haddock-library/fixtures/examples/table2.parsed
index e3dbf0b4..44cc813b 100644
--- a/haddock-library/fixtures/examples/table2.parsed
+++ b/haddock-library/fixtures/examples/table2.parsed
@@ -3,44 +3,44 @@ DocTable
{tableBodyRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 1, col 1 ",
+ tableCellContents = DocString "row 1, col 1",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 2 ",
+ tableCellContents = DocString "column 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 3 ",
+ tableCellContents = DocString "column 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 4 ",
+ tableCellContents = DocString "column 4",
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 2 ",
+ tableCellContents = DocString "row 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 3,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 3 ",
+ tableCellContents = DocString "row 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1}]],
tableHeaderRows = []}
diff --git a/haddock-library/fixtures/examples/table3.parsed b/haddock-library/fixtures/examples/table3.parsed
index cabff9cb..c978b50f 100644
--- a/haddock-library/fixtures/examples/table3.parsed
+++ b/haddock-library/fixtures/examples/table3.parsed
@@ -3,48 +3,48 @@ DocTable
{tableBodyRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 1, col 1 ",
+ tableCellContents = DocString "row 1, col 1",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 2 ",
+ tableCellContents = DocString "column 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 3 ",
+ tableCellContents = DocString "column 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 4 ",
+ tableCellContents = DocString "column 4",
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 2 ",
+ tableCellContents = DocString "row 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 2,
- tableCellContents = DocString " Use the command ``ls ",
+ tableCellContents = DocString "Use the command ``ls",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " more``. ",
+ tableCellContents = DocString "more``.",
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 3 ",
+ tableCellContents = DocString "row 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1}]],
tableHeaderRows = []}
diff --git a/haddock-library/fixtures/examples/table4.parsed b/haddock-library/fixtures/examples/table4.parsed
index cfdd6f0f..c4dabb0d 100644
--- a/haddock-library/fixtures/examples/table4.parsed
+++ b/haddock-library/fixtures/examples/table4.parsed
@@ -8,10 +8,10 @@ DocAppend
{tableCellColspan = 1,
tableCellContents = DocString
(concat
- [" outer \n",
- " \n",
- "-------+ \n",
- " inner | "]),
+ ["outer\n",
+ "\n",
+ "-------+\n",
+ "inner |"]),
tableCellRowspan = 1}]],
tableHeaderRows = []})
(DocAppend
@@ -21,6 +21,6 @@ DocAppend
{tableBodyRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " inner ",
+ tableCellContents = DocString "inner",
tableCellRowspan = 1}]],
tableHeaderRows = []})))
diff --git a/haddock-library/fixtures/examples/table5.parsed b/haddock-library/fixtures/examples/table5.parsed
index 9a547ad3..f9a387bb 100644
--- a/haddock-library/fixtures/examples/table5.parsed
+++ b/haddock-library/fixtures/examples/table5.parsed
@@ -4,50 +4,43 @@ DocTable
[TableCell
{tableCellColspan = 1,
tableCellContents = DocString
- (concat
- [" row 2 \n",
- " \n",
- " \n",
- " row 3 "]),
+ (concat ["row 2\n", "\n", "\n", "row 3"]),
tableCellRowspan = 2},
TableCell
{tableCellColspan = 3,
tableCellContents = DocAppend
- (DocString " Use the command ")
+ (DocString "Use the command ")
(DocAppend
(DocMonospaced (DocString "ls | more"))
- (DocString
- (concat
- [". \n",
- " "]))),
+ (DocString ".\n")),
tableCellRowspan = 1}],
TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " ",
+ tableCellContents = DocEmpty,
tableCellRowspan = 1}]],
tableHeaderRows = [TableRow
[TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " row 1, col 1 ",
+ tableCellContents = DocString "row 1, col 1",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 2 ",
+ tableCellContents = DocString "column 2",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 3 ",
+ tableCellContents = DocString "column 3",
tableCellRowspan = 1},
TableCell
{tableCellColspan = 1,
- tableCellContents = DocString " column 4 ",
+ tableCellContents = DocString "column 4",
tableCellRowspan = 1}]]}