diff options
Diffstat (limited to 'haddock-library/fixtures/examples')
12 files changed, 142 insertions, 91 deletions
| diff --git a/haddock-library/fixtures/examples/list-blocks1.input b/haddock-library/fixtures/examples/list-blocks1.input new file mode 100644 index 00000000..72a0640b --- /dev/null +++ b/haddock-library/fixtures/examples/list-blocks1.input @@ -0,0 +1,15 @@ +* Something about foo + +    @ +    foo :: a -> b -> c +    foo a b = bar c b +    @ + +* Something about bar + +    @ +    bar :: a -> b -> c +    bar a b = foo b a +    @ + +* And then we continue diff --git a/haddock-library/fixtures/examples/list-blocks1.parsed b/haddock-library/fixtures/examples/list-blocks1.parsed new file mode 100644 index 00000000..9fc4f0ba --- /dev/null +++ b/haddock-library/fixtures/examples/list-blocks1.parsed @@ -0,0 +1,12 @@ +DocUnorderedList +  [DocAppend +     (DocParagraph (DocString "Something about foo")) +     (DocCodeBlock +        (DocString +           (concat ["foo :: a -> b -> c\n", "foo a b = bar c b\n"]))), +   DocAppend +     (DocParagraph (DocString "Something about bar")) +     (DocCodeBlock +        (DocString +           (concat ["bar :: a -> b -> c\n", "bar a b = foo b a\n"]))), +   DocParagraph (DocString "And then we continue")] diff --git a/haddock-library/fixtures/examples/list-blocks2.input b/haddock-library/fixtures/examples/list-blocks2.input new file mode 100644 index 00000000..91492adb --- /dev/null +++ b/haddock-library/fixtures/examples/list-blocks2.input @@ -0,0 +1,10 @@ +=== Title + +* List directly +* after the title + +    @ +    with some inline things +    @ + +* is parsed weirdly diff --git a/haddock-library/fixtures/examples/list-blocks2.parsed b/haddock-library/fixtures/examples/list-blocks2.parsed new file mode 100644 index 00000000..169677b7 --- /dev/null +++ b/haddock-library/fixtures/examples/list-blocks2.parsed @@ -0,0 +1,10 @@ +DocAppend +  (DocAppend +     (DocHeader +        Header {headerLevel = 3, headerTitle = DocString "Title"}) +     (DocUnorderedList +        [DocParagraph (DocString "List directly"), +         DocAppend +           (DocParagraph (DocString "after the title")) +           (DocCodeBlock (DocString "with some inline things\n"))])) +  (DocUnorderedList [DocParagraph (DocString "is parsed weirdly")]) 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}]]} | 
