From d3716eaeb6d0f2e0be549baf0a346cba1e5a4ff0 Mon Sep 17 00:00:00 2001 From: damon-sava-stanley Date: Fri, 11 Feb 2022 11:58:29 -0500 Subject: Add DokuWiki table alignment for #5202 (#7908) Closes #5202. Within each cell, determine the cell alignment as per https://www.dokuwiki.org/wiki:syntax#tables. The current approach, as per the issue treats the first row's alignment as determining that of the entire column. Given this, it wastes some work in determining an alignment for every cell. --- test/Tests/Readers/DokuWiki.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/Tests/Readers/DokuWiki.hs b/test/Tests/Readers/DokuWiki.hs index 84ba86d46..db52a34a6 100644 --- a/test/Tests/Readers/DokuWiki.hs +++ b/test/Tests/Readers/DokuWiki.hs @@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} {- | Module : Tests.Readers.DokuWiki Copyright : © 2018-2020 Alexander Krotov @@ -300,6 +301,17 @@ tests = [ testGroup "inlines" , "| bat | baz |" ] =?> simpleTable [plain "foo", plain "bar"] [[plain "bat", plain "baz"]] + , "Table with alignment" =: + T.unlines [ "^ 0 ^ 1 ^ 2 ^ 3 ^" + , "| a | b | c |d |" + ] =?> + table emptyCaption + (map (, ColWidthDefault) [AlignLeft, AlignCenter, AlignRight, AlignDefault]) + (TableHead nullAttr + [Row nullAttr . map (simpleCell . plain) $ ["0", "1", "2", "3"]]) + [TableBody nullAttr 0 [] + [Row nullAttr . map (simpleCell . plain) $ ["a", "b", "c", "d"]]] + (TableFoot nullAttr []) , "Table with colspan" =: T.unlines [ "^ 0,0 ^ 0,1 ^ 0,2 ^" , "| 1,0 | 1,1 ||" -- cgit v1.2.3