kvitable 1.1.2.0 → 1.2.0.0
raw patch · 6 files changed
+397/−308 lines, 6 filesdep +prettyprinterPVP ok
version bump matches the API change (PVP)
Dependencies added: prettyprinter
API changes (from Hackage documentation)
- Data.KVITable.Render.ASCII: render :: Sayable "normal" v => RenderConfig -> KVITable v -> Text
+ Data.KVITable.Render.ASCII: render :: Sayable "normal" v => Maybe (Doc SayableAnn -> Text) -> RenderConfig -> KVITable v -> Text
- Data.KVITable.Render.HTML: render :: Sayable "html" v => RenderConfig -> KVITable v -> Text
+ Data.KVITable.Render.HTML: render :: Sayable "html" v => Maybe (Doc SayableAnn -> Text) -> RenderConfig -> KVITable v -> Text
Files
- CHANGELOG.md +8/−0
- kvitable.cabal +2/−1
- src/Data/KVITable/Render/ASCII.hs +60/−36
- src/Data/KVITable/Render/HTML.hs +55/−35
- test/AsciiRenderTests.hs +191/−164
- test/HTMLRenderTests.hs +81/−72
CHANGELOG.md view
@@ -1,5 +1,13 @@ # Revision history for KVITable +## 1.2.0.0 -- 2026-07-06++* Added renderer argument to the HTML and ASCII `render` functions. This is not+ backward compatible, although the previous functionality can be obtained by+ passing a new `Nothing` initial argument. This argument allows passing an+ optional renderer that can be used for various effects+ (e.g. `Prettyprinter.Render.Termina.render`).+ ## 1.1.2.0 -- 2026-06-23 * Support GHC 9.14
kvitable.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: kvitable-version: 1.1.2.0+version: 1.2.0.0 synopsis: Key/Value Indexed Table container and formatting library description: .@@ -68,6 +68,7 @@ , lucid >= 2.9 && < 2.12 , microlens >= 0.4 && < 0.6 , named-text >= 1.2 && < 1.3+ , prettyprinter >= 1.7 && < 1.8 , sayable >= 1.2.4.0 && < 1.4 , text
src/Data/KVITable/Render/ASCII.hs view
@@ -19,13 +19,14 @@ where import qualified Data.List as L-import Data.Maybe ( isNothing )+import Data.Maybe ( fromMaybe, isNothing ) import Data.Name import Data.String ( fromString ) import Data.Text ( Text ) import qualified Data.Text as T import Lens.Micro ( (^.) ) import Numeric.Natural+import qualified Prettyprinter as PP import Text.Sayable import Data.KVITable ( KVITable, KeySpec, keyVals )@@ -40,11 +41,17 @@ -- | Renders the specified table in ASCII format, using the specified -- 'RenderConfig' controls. -render :: Sayable "normal" v => RenderConfig -> KVITable v -> Text-render cfg t =+render :: Sayable "normal" v+ => Maybe (PP.Doc SayableAnn -> Text)+ -- ^ Custom renderer which can be used to reAnnotate and perform+ -- special rendering if desired. The default is the plain text+ -- rendering.+ -> RenderConfig -> KVITable v+ -> Text+render rndr cfg t = let kmap = renderingKeyVals cfg $ t ^. keyVals (fmt, hdr) = renderHdrs cfg t kmap- bdy = renderSeq cfg fmt kmap t+ bdy = renderSeq rndr cfg fmt kmap t in T.unlines $ hdr <> bdy ----------------------------------------------------------------------@@ -80,7 +87,7 @@ fmtAddColLeft :: Natural -> FmtLine -> FmtLine fmtAddColLeft leftCol (FmtLine cols s s') = FmtLine (leftCol : cols) s s' -data FmtVal = Separator | TxtVal Text | CenterVal Text+data FmtVal = Separator | TxtVal Natural Text | CenterVal Natural Text | Overage -- cells for the overflow row/column fmtRender :: FmtLine -> [FmtVal] -> Text@@ -88,31 +95,29 @@ fmtRender (FmtLine cols sigils sepsigils) vals@(val:_) = if length cols == length vals then let sig f o = case o of- Separator -> f sepsigils- TxtVal _ -> f sigils- CenterVal _ -> f sigils- Overage -> f sigils+ Separator -> f sepsigils+ TxtVal {} -> f sigils+ CenterVal {} -> f sigils+ Overage -> f sigils l = sig sep val charRepeat n c = T.pack (replicate (fromEnum n) c)- rightAlign n t = let tl = toEnum $ T.length t- rt = charRepeat (n - tl) ' ' <> t- in if tl >= n then t else rt- centerIn n t = let tl = toEnum $ T.length t- (w,e) = (n - tl - 2) `divMod` 2- m = cap sigils- ls = T.replicate (fromEnum $ w + 0) m- rs = T.replicate (fromEnum $ w + e) m- in if tl + 2 >= n- then rightAlign n t- else ls <> " " <> t <> " " <> rs+ rightAlign n w t = let rt = charRepeat (n - w) ' ' <> t+ in if w >= n then t else rt+ centerIn n w t = let (w',e) = (n - w - 2) `divMod` 2+ m = cap sigils+ ls = T.replicate (fromEnum $ w' + 0) m+ rs = T.replicate (fromEnum $ w' + e) m+ in if w + 2 >= n+ then rightAlign n w t+ else ls <> " " <> t <> " " <> rs in l <> T.concat [ sig pad fld <> (case fld of- Separator -> charRepeat sz '-'- TxtVal v -> rightAlign sz v- CenterVal t -> centerIn sz t- Overage -> centerIn sz "+"+ Separator -> charRepeat sz '-'+ TxtVal w v -> rightAlign sz w v+ CenterVal w t -> centerIn sz w t+ Overage -> centerIn sz 1 "+" ) <> sig pad fld <> sig sep fld -- KWQ or if next fld is Nothing@@ -159,7 +164,7 @@ valcoltsz = nameLength valcoltxt valsizes = nLength . sez @"normal" . snd <$> KVIT.toList t valwidth = maxOf 0 $ valcoltsz : valsizes- hdrVal = TxtVal $ nameText valcoltxt+ hdrVal = TxtVal (nameLength valcoltxt) (nameText valcoltxt) in single $ HdrLine (fmtLine $ single valwidth) (single hdrVal) "" hdrstep cfg t ([], colKeyMap) = hdrvalstep cfg t colKeyMap mempty -- switch to column-stacking mode@@ -167,7 +172,8 @@ let keyw = max (nameLength key) $ (maxOf 0 . fmap (nameLength . toHdrText)) keyvals mkhdr (hs, v) (HdrLine fmt hdrvals trailer) =- ( HdrLine (fmtAddColLeft keyw fmt) (TxtVal (nameText v) : hdrvals) trailer : hs , "")+ ( HdrLine (fmtAddColLeft keyw fmt)+ (TxtVal (nameLength v) (nameText v) : hdrvals) trailer : hs , "") in reverse $ fst $ foldl mkhdr (mempty, key) $ hdrstep cfg t (keys, colKeyMap) -- first line shows hdrval for non-colstack'd columns, others are blank @@ -189,8 +195,9 @@ then (replicate (length cwidths) (maxOf 0 cwidths)) else cwidths tr = convertName key- hdrTxt = nameText . toHdrText- in single $ HdrLine (fmtLine $ fmtcols) (TxtVal . hdrTxt <$> titles) tr+ -- hdrTxt = nameText . toHdrText+ toTxtVal x = TxtVal (nameLength x) (nameText x)+ in single $ HdrLine (fmtLine $ fmtcols) (toTxtVal . toHdrText <$> titles) tr hdrvalstep cfg t ((key,vals) : keys) steppath = let subhdrsV = \case V v -> hdrvalstep cfg t keys (snoc steppath (key,v))@@ -227,7 +234,9 @@ hdrJoin hl = foldl hlJoin (HdrLine (fmtLine mempty) mempty "") hl hlJoin (HdrLine (FmtLine c s j) v _) (HdrLine (FmtLine c' _ _) v' r) = HdrLine (FmtLine (c<>c') s j) (v<>v') r- tvals = CenterVal . nameText . toHdrText <$> vals+ tvals = let cVal v = let ht = toHdrText v+ in CenterVal (nameLength ht) (nameText ht)+ in cVal <$> vals in HdrLine (fmtLine szhdrs) tvals (convertName key) : rsz_extsubhdrs hdrvalstep _ _ [] _ = error "ASCII hdrvalstep with empty keys after matching colStackAt -- impossible" @@ -239,12 +248,14 @@ ---------------------------------------------------------------------- renderSeq :: Sayable "normal" v- => RenderConfig+ => Maybe (PP.Doc SayableAnn -> Text)+ -> RenderConfig -> FmtLine -> (TblHdrs, TblHdrs) -> KVITable v -> [Text]-renderSeq cfg fmt kmap kvitbl = fmtRender fmt . snd <$> asciiRows kmap mempty+renderSeq rndr cfg fmt kmap kvitbl =+ fmtRender fmt . snd <$> asciiRows kmap mempty where filterBlank = if hideBlankRows cfg then L.filter (not . all isNothing . snd)@@ -258,10 +269,19 @@ Nothing -> hideBlankRows cfg Just _ -> False in if skip then mempty- else single $ (False, single $ maybe (TxtVal "") TxtVal (T.pack . sez @"normal" <$> v) )+ else let toTxtVal x =+ let xl = toEnum $ length $ sez @"normal" x+ xp = maybe (fromString . sez) id rndr+ $ saying @"normal"+ $ sayable x+ in TxtVal xl xp+ in single $ (False, single $ maybe (TxtVal 0 "") toTxtVal v) asciiRows ([], colKeyMap) path = let filterOrDefaultBlankRows = fmap (fmap defaultBlanks) . filterBlank- defaultBlanks = fmap (\v -> maybe (TxtVal "") TxtVal v)+ defaultBlanks = fmap (\case+ Nothing -> TxtVal 0 ""+ Just (vl, vp) -> TxtVal vl vp+ ) in filterOrDefaultBlankRows $ single $ (False, multivalRows colKeyMap path) asciiRows ((key, keyvals) : kseq, colKeyMap) path = let subrows = \case@@ -277,14 +297,18 @@ genSubRow keyval = grprow $ fst $ foldl leftAdd (mempty, toHdrText keyval) $ subrows keyval leftAdd (acc,kv) (b,subrow) =- (snoc acc (b, TxtVal (nameText kv) : subrow)+ (snoc acc (b, TxtVal (nameLength kv) (nameText kv) : subrow) , if rowRepeat cfg then kv else "" ) in concat (genSubRow <$> keyvals) - multivalRows :: TblHdrs -> KeySpec -> [ Maybe Text ]+ multivalRows :: TblHdrs -> KeySpec -> [ Maybe (Natural, Text) ] multivalRows ((key, keyvals) : []) path =- let showEnt = T.pack . sez @"normal"+ let showEnt x = ( toEnum $ length $ sez @"normal" x+ , fromMaybe (fromString . sez) rndr+ $ saying+ $ sayable @"normal" x+ ) in (\case V v -> (showEnt <$> (KVIT.lookup' (snoc path (key,v)) kvitbl)) _ -> Nothing
src/Data/KVITable/Render/HTML.hs view
@@ -27,7 +27,7 @@ import qualified Data.List.NonEmpty as NEL import Data.Maybe ( isNothing ) import Data.Name ( Named, HTMLStyle, UTF8, convertName- , convertStyle, nameText )+ , convertStyle, fromText, nameText ) import Data.String ( fromString ) import Data.Text ( Text ) import qualified Data.Text as T@@ -35,6 +35,7 @@ import Lens.Micro ( (^.) ) import Lucid import Numeric.Natural+import qualified Prettyprinter as PP import Text.Sayable import Data.KVITable as KVIT@@ -50,11 +51,17 @@ -- definition; it is intended to be embedded in a larger HTML -- document. -render :: Sayable "html" v => RenderConfig -> KVITable v -> Text-render cfg t =+render :: Sayable "html" v+ => Maybe (PP.Doc SayableAnn -> Text)+ -- ^ Custom renderer which can be used to reAnnotate and perform+ -- special rendering if desired. The default is the plain text+ -- rendering.+ -> RenderConfig+ -> KVITable v -> Text+render rndr cfg t = let kmap = renderingKeyVals cfg $ t ^. keyVals- (fmt, hdr) = renderHdrs cfg kmap t- bdy = renderSeq cfg fmt kmap t+ (fmt, hdr) = renderHdrs rndr cfg kmap t+ bdy = renderSeq rndr cfg fmt kmap t in TL.toStrict $ renderText $ table_ [ class_ "kvitable" ] $ do maybe mempty (caption_ . toHtml . convertStyle @UTF8 @HTMLStyle)@@ -151,31 +158,33 @@ hdrFmt (HdrLine fmt _ _) = fmt renderHdrs :: Sayable "html" v- => RenderConfig+ => Maybe (PP.Doc SayableAnn -> Text)+ -> RenderConfig -> (TblHdrs, TblHdrs) -> KVITable v -> ( FmtLine, Html () )-renderHdrs cfg kmap t = ( rowfmt, sequence_ hdrs )+renderHdrs rndr cfg kmap t = ( rowfmt, sequence_ hdrs ) where hdrs = fmap renderHdr hrows- (hrows, rowfmt) = hdrstep cfg t kmap+ (hrows, rowfmt) = hdrstep rndr cfg t kmap renderHdr (HdrLine fmt hdrvals trailer) = fmtRender fmt trailer hdrvals hdrstep :: Sayable "html" v- => RenderConfig+ => Maybe (PP.Doc SayableAnn -> Text)+ -> RenderConfig -> KVITable v -> (TblHdrs, TblHdrs) -> (NEL.NonEmpty HeaderLine, FmtLine)-hdrstep _cfg t ([], []) =+hdrstep _rndr _cfg t ([], []) = let hdr = Hdr Singular False $ t ^. valueColName one = single 1 in ( HdrLine (FmtLine one) (single hdr) Nothing :| mempty , FmtLine one )-hdrstep cfg t ([], colKeys) =- hdrvalstep cfg t colKeys mempty -- switch to column stacking mode-hdrstep cfg t ((key,_) : keys, colKeys) =- let (nexthdr0 :| nexthdrs, lowestfmt) = hdrstep cfg t (keys, colKeys)+hdrstep rndr cfg t ([], colKeys) =+ hdrvalstep rndr cfg t colKeys mempty -- switch to column stacking mode+hdrstep rndr cfg t ((key,_) : keys, colKeys) =+ let (nexthdr0 :| nexthdrs, lowestfmt) = hdrstep rndr cfg t (keys, colKeys) (HdrLine fmt vals tr) = nexthdr0 fmt' = fmtAddColLeft 1 fmt val = Hdr (Rows $ nLength nexthdrs + 1) False@@ -185,13 +194,14 @@ ) hdrvalstep :: Sayable "html" v- => RenderConfig+ => Maybe (PP.Doc SayableAnn -> Text)+ -> RenderConfig -> KVITable v -> TblHdrs -> KeySpec -> (NEL.NonEmpty HeaderLine, FmtLine)-hdrvalstep _ _ [] _ = error "HTML hdrvalstep with empty keys after matching colStackAt -- impossible"-hdrvalstep cfg t ((key, titles) : []) steppath =+hdrvalstep _ _ _ [] _ = error "HTML hdrvalstep with empty keys after matching colStackAt -- impossible"+hdrvalstep rndr cfg t ((key, titles) : []) steppath = let cvalWidths kv = fmap (length . sez @"html" . snd) $ L.filter ((L.isSuffixOf (snoc steppath (key, kv))) . fst) $ KVIT.toList t@@ -199,17 +209,17 @@ V c -> if hideBlankCols cfg && 0 == (sum $ cvalWidths c) then 0 else 1 AndMore _ -> 1 fmt = FmtLine (cwidth <$> titles)- hdr = Hdr Singular False . toHdrText <$> titles+ hdr = Hdr Singular False . toHdrText rndr <$> titles k = convertStyle @UTF8 @HTMLStyle $ convertName key in ( HdrLine fmt hdr (Just k) :| mempty, fmt)-hdrvalstep _cfg _t ((_key, []) : _keys) _steppath = error "cannot happen"-hdrvalstep cfg t ((key, ttl:ttls) : keys) steppath =+hdrvalstep _ _cfg _t ((_key, []) : _keys) _steppath = error "cannot happen"+hdrvalstep rndr cfg t ((key, ttl:ttls) : keys) steppath = let titles = ttl :| ttls- subhdrsV v = hdrvalstep cfg t keys (case v of- V kv -> snoc steppath (key,kv)- _ -> steppath- )+ subhdrsV v = hdrvalstep rndr cfg t keys (case v of+ V kv -> snoc steppath (key,kv)+ _ -> steppath+ ) subTtlHdrs :: NEL.NonEmpty (NEL.NonEmpty HeaderLine, FmtLine) subTtlHdrs = subhdrsV <$> titles subhdrs :: NEL.NonEmpty (NEL.NonEmpty HeaderLine, FmtLine)@@ -233,16 +243,20 @@ then 0 else nLength $ L.filter (/= 0) subcols topfmt = FmtLine $ NEL.toList (superFmt <$> subhdrs)- tophdr = let h = Hdr Singular False . toHdrText <$> titles+ tophdr = let h = Hdr Singular False . toHdrText rndr <$> titles tr = convertStyle @UTF8 @HTMLStyle $ convertName key in HdrLine topfmt (NEL.toList h) $ Just tr in ( NEL.cons tophdr subhdr_rollup, F.fold (snd <$> subTtlHdrs)) -toHdrText :: TblHdr -> Named HTMLStyle "column header"-toHdrText th = case toHdrText' th of- Right t -> t- Left n -> fromString $ sez @"html" $ t'"{+" &+ n &+ '}'+toHdrText :: Maybe (PP.Doc SayableAnn -> Text) -> TblHdr+ -> Named HTMLStyle "column header"+toHdrText rndr th =+ case toHdrText' th of+ Right t -> t+ Left n -> maybe (fromString . sez) (fromText .) rndr+ $ saying+ $ sayable @"html" (t'"{+" &+ n &+ '}') toHdrText' :: TblHdr -> Either Natural (Named HTMLStyle "column header") toHdrText' = \case@@ -252,14 +266,15 @@ ---------------------------------------------------------------------- renderSeq :: Sayable "html" v- => RenderConfig -> FmtLine+ => Maybe (PP.Doc SayableAnn -> Text)+ -> RenderConfig -> FmtLine -> (TblHdrs, TblHdrs) -> KVITable v -> Html ()-renderSeq cfg fmt kmap t =+renderSeq rndr cfg fmt kmap t = let lst = htmlRows kmap mempty- rndr = fmtRender fmt Nothing- in sequence_ (each rndr lst)+ r = fmtRender fmt Nothing+ in sequence_ (each r lst) where each = map @@ -267,7 +282,10 @@ then L.filter (not . all isNothing) else id - mkVal = Val Singular False False . T.pack . sez @"html"+ mkVal = Val Singular False False+ . maybe (T.pack . sez) id rndr+ . saying+ . sayable @"html" htmlRows :: (TblHdrs, TblHdrs) -> KeySpec -> [ [FmtVal] ] htmlRows ([], []) path =@@ -307,7 +325,9 @@ let w = if rowRepeat cfg then 1 else nrows in Hdr (Rows w) endOfGroup kv : sr Just (Left n) ->- let m = fromString $ sez @"html" $ t'"{+" &+ n &+ '}'+ let m = maybe (fromString . sez) (fromText .) rndr+ $ saying @"html"+ (t'"{+" &+ n &+ '}') in Hdr (Cols nHdrs) True m : sr ) , if rowRepeat cfg then mb'kv else Nothing)
test/AsciiRenderTests.hs view
@@ -58,7 +58,7 @@ in [ testCase "empty table" $- cmpTables "empty table" (KTRA.render cfg0 kvi0) [sq|+ cmpTables "empty table" (KTRA.render Nothing cfg0 kvi0) [sq| **** | Value | +-------+@@ -66,7 +66,7 @@ |] , testCase "empty table with blanks" $- cmpTables "empty table" (KTRA.render cfgWBlankRows kvi0) [sq|+ cmpTables "empty table" (KTRA.render Nothing cfgWBlankRows kvi0) [sq| **** | Value | +-------+@@ -76,7 +76,7 @@ , testCase "empty table with labels" $ let kvi = mempty & KVI.keyVals @Float .~ [ ("foo", []), ("dog", []) ]- in cmpTables "empty table with labels" (KTRA.render cfg0 kvi) [sq|+ in cmpTables "empty table with labels" (KTRA.render Nothing cfg0 kvi) [sq| **** | foo | dog | Value | +-----+-----+-------+@@ -90,7 +90,7 @@ in do KVI.rows t1 @?= [ ([ "bar", "" ], "hi") , ([ "baz", "woof"], "yo") ]- cmpTables "add key" (KTRA.render cfg0 t1) [sq|+ cmpTables "add key" (KTRA.render Nothing cfg0 t1) [sq| **** | foo | dog | Value | +-----+------+-------+@@ -111,7 +111,7 @@ KVI.insert [ ("foo", "baz"), ("moon", "beam"), ("dog", "woof") ] "yo" $ KVI.insert [ ("foo", "bar"), ("moon", "pie") ] "hi" t0- in cmpTables "add key" (KTRA.render cfg0 t1) [sq|+ in cmpTables "add key" (KTRA.render Nothing cfg0 t1) [sq| **** | foo | moon | dog | says | +------+------+---------+------------+@@ -122,7 +122,7 @@ , testCase "medium sized table render, sorted" $ cmpTables "medium table"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -144,7 +144,7 @@ , testCase "medium sized table render, unsorted" $ cmpTables "medium table"- (KTRA.render (cfg0 { KTR.sortKeyVals = Nothing }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0 { KTR.sortKeyVals = Nothing }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -166,8 +166,9 @@ , testCase "medium table, sorted, blank, row skip, no repeats" $ cmpTables "medium table"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -189,10 +190,11 @@ , testCase "medium table, sorted, blank row skip, no repeats, group unknown" $ cmpTables "medium table s 0brow 0rep [unknown]"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = ["unknown"]- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = ["unknown"]+ }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -214,10 +216,11 @@ , testCase "medium table, sorted, blank row skip, no repeats, group compiler" $ cmpTables "medium table s 0brow 0rep [unknown]"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = ["compiler"]- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = ["compiler"]+ }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -244,10 +247,11 @@ , testCase "medium table, sorted, blank row skip, no repeats, multi-group" $ cmpTables "medium table s 0brow 0rep [compiler,debug]"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = ["unknown", "compiler", "unk", "debug", "huh"]- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = ["unknown", "compiler", "unk", "debug", "huh"]+ }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -277,8 +281,9 @@ , testCase "medium table, sorted, blank" $ cmpTables "medium table"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.hideBlankRows = False }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.hideBlankRows = False }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -316,9 +321,10 @@ , testCase "medium sized table render, sorted, no blank, colstack unknown" $ cmpTables "medium table s 0blnk colstk=unknown"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.colStackAt = Just "unknown"- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.colStackAt = Just "unknown"+ }) mediumKVI) [sq| **** | compiler | debug | optimization | Value | +----------+-------+--------------+-------+@@ -340,10 +346,11 @@ , testCase "medium sized table render, sorted, !blank, colstk optimization" $ cmpTables "medium table s 0blnk colstk=optimization"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.hideBlankRows = True- , KTR.colStackAt = Just "optimization"- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.hideBlankRows = True+ , KTR.colStackAt = Just "optimization"+ }) mediumKVI) [sq| **** | compiler | debug | 0 | 1 | 3 | <- optimization +----------+-------+------+------+------+@@ -359,12 +366,13 @@ , testCase "medium, sorted, !blank, !row rpt, rgrp compiler colstk optimization" $ cmpTables "medium table s 0blnk colstk=optimization rowgrp=compiler"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.hideBlankRows = True- , KTR.colStackAt = Just "optimization"- , KTR.rowRepeat = False- , KTR.rowGroup = [ "compiler" ]- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.hideBlankRows = True+ , KTR.colStackAt = Just "optimization"+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "compiler" ]+ }) mediumKVI) [sq| **** | compiler | debug | 0 | 1 | 3 | <- optimization +----------+-------+------+------+------+@@ -385,11 +393,12 @@ , testCase "medium sized table render, sorted, !blank, equisize, colstack debug" $ cmpTables "medium table s 0blnk equisize colstk=debug"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.hideBlankRows = True- , KTR.equisizedCols = True- , KTR.colStackAt = Just "debug"- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = True+ , KTR.colStackAt = Just "debug"+ }) mediumKVI) [sq| **** | compiler | _______ no _______ | ______ yes _______ | <- debug | | 0 | 1 | 3 | 0 | 1 | 3 | <- optimization@@ -403,11 +412,12 @@ , testCase "medium sized table render, sorted, !blank, fitsize, colstack debug" $ cmpTables "medium table s 0blnk fitsize colstk=debug"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "debug"- }) mediumKVI) [sq|+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "debug"+ }) mediumKVI) [sq| **** | compiler | _______ no _______ | ______ yes ______ | <- debug | | 0 | 1 | 3 | 0 | 1 | 3 | <- optimization@@ -433,7 +443,7 @@ ] step "ASCII rendering unsorted" cmpTables "small table right aligned unsorted"- (KTRA.render (cfg0 { KTR.sortKeyVals = Nothing }) tbl) [sq|+ (KTRA.render Nothing (cfg0 { KTR.sortKeyVals = Nothing }) tbl) [sq| **** | id | name | +----+--------------+@@ -443,7 +453,7 @@ ****|] step "ASCII rendering sorted" cmpTables "small table right aligned sorted"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha }) tbl) [sq|+ (KTRA.render Nothing (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha }) tbl) [sq| **** | id | name | +----+--------------+@@ -464,7 +474,7 @@ , ([("City name", "Sydney"), ("Area", "2058"), ("Population", "4336374")], 1214.8) ] in cmpTables "small table float value table"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha }) tbl) [sq|+ (KTRA.render Nothing (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha }) tbl) [sq| **** | City name | Area | Population | Annual Rainfall | +-----------+------+------------+-----------------+@@ -479,10 +489,11 @@ , testCase "big table grouped sorted" $ cmpTables "big table grouped sorted"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = [ "Location", "Biome", "Category" ]- }) zooTable2)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "Location", "Biome", "Category" ]+ }) zooTable2) [uq_f|examples/zoo.md|] , testCase "big table grouped sorted no-subtype colstack" $@@ -495,23 +506,25 @@ Nothing -> (ks,v) : newl Just v' -> (ks, v' + v) : filter ((ks /=) . fst) newl in cmpTables "big table grouped sorted no-subtype colstack"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = [ "Location", "Biome", "Category" ]- , KTR.colStackAt = Just "Name"- , KTR.equisizedCols = False- }) zt)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "Location", "Biome", "Category" ]+ , KTR.colStackAt = Just "Name"+ , KTR.equisizedCols = False+ }) zt) [uq2_f|examples/zoo.md|] , testCase "big table grouped sorted equisized" $ cmpTables "big table grouped sorted equisized"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.equisizedCols = True- , KTR.rowGroup = [ "Branch" ]- , KTR.colStackAt = Just "ghcver"- }) testedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.equisizedCols = True+ , KTR.rowGroup = [ "Branch" ]+ , KTR.colStackAt = Just "ghcver"+ }) testedTable) [sq| # Note: no seplines under system because it wasn't included in the row_group ****@@ -533,13 +546,14 @@ , testCase "big table grouped sorted fitsize colstack=ghcver" $ cmpTables "big table grouped sorted fitsize colstack=ghcver"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.equisizedCols = False- , KTR.rowGroup = [ "Branch" ]- , KTR.colStackAt = Just "ghcver"- }) testedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.equisizedCols = False+ , KTR.rowGroup = [ "Branch" ]+ , KTR.colStackAt = Just "ghcver"+ }) testedTable) [sq| # Note: no seplines under system because it wasn't included in the row_group ****@@ -561,13 +575,14 @@ , testCase "big table grouped sorted fitsize colstack=Strategy" $ cmpTables "big table grouped sorted fitsize colstack=Strategy"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.equisizedCols = False- , KTR.rowGroup = [ "Branch" ]- , KTR.colStackAt = Just "Strategy"- }) testedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.equisizedCols = False+ , KTR.rowGroup = [ "Branch" ]+ , KTR.colStackAt = Just "Strategy"+ }) testedTable) [sq| # Note: no seplines under system because it wasn't included in the row_group ****@@ -587,13 +602,14 @@ , testCase "nested table hide=blankRows,blankCols colstack=ones" $ cmpTables "nested table hide=blankRows,blankCols colstack=ones"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "ones"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "ones"+ }) nestedTable) [sq| **** | millions | thousands | hundreds | tens | 0 | 1 | <- ones@@ -620,13 +636,14 @@ , testCase "nested table colstack=tens" $ cmpTables "nested table colstack=tens"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "tens"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "tens"+ }) nestedTable) -- Note: the nestedTable declares a KeyVal of 0 for each key; -- without hideBlankCols true, this test would show a 0 value -- column for the tens stacked column.@@ -657,100 +674,109 @@ , testCase "nested table hide=blankCols,blankRows colstack=hundreds" $ cmpTables "nested table hide-blankCols,blankRows colstack=hundreds"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [uq_f|README.md|] , testCase "nested table hide=none colstack=hundreds" $ cmpTables "nested table hide=none colstack=hundreds"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [uq_f|examples/hundreds_all.md|] , testCase "nested table hide=none colstack=hundreds testfile" $ cmpTables "nested table hide=none colstack=hundreds testfile"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [sq_f|test/evenodd.md|] , testCase "nested table hide=none colstack=hundreds, maxCells=60" $ cmpTables "nested table hide=none colstack=hundreds, maxCells=60"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- , KTR.maxCells = 60- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ , KTR.maxCells = 60+ }) nestedTable) [sq3_f|test/evenodd.md|] , testCase "nested table hide=none colstack=hundreds equisized" $ cmpTables "nested table hide=none colstack=hundreds equisized"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = True- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = True+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [uq2_f|examples/hundreds_all.md|] , testCase "nested table hideBlank=rol,col colstack=thousands" $ cmpTables "nested table hideBlank=row,col colstack=thousands"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "thousands"- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "thousands"+ }) nestedTable) [uq2_f|README.md|] , testCase "nested table hideBlank=rol,col" $ cmpTables "nested table hideBlank=row,col"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ }) nestedTable) [uq3_f|README.md|] , testCase "nested table hideBlank=rol,col, maxCells=60" $ cmpTables "nested table hideBlank=row,col, maxCells=60"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.maxCells = 60- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.maxCells = 60+ }) nestedTable) [sq5_f|test/evenodd.md|] , testCase "nested table hideBlank=none" $ cmpTables "nested table hideBlank=none"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- }) nestedTable)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ }) nestedTable) [sq| **** | millions | thousands | hundreds | tens | ones | Value |@@ -882,13 +908,14 @@ , b <- [0..100::Int] ] in cmpTables "big table grouped sorted no-subtype colstack"- (KTRA.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = [ "Location", "Biome", "Category" ]- , KTR.colStackAt = Just "Batter"- , KTR.equisizedCols = False- , KTR.maxCols = 20- , KTR.maxCells = 600- }) tbl)+ (KTRA.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "Location", "Biome", "Category" ]+ , KTR.colStackAt = Just "Batter"+ , KTR.equisizedCols = False+ , KTR.maxCols = 20+ , KTR.maxCells = 600+ }) tbl) [sq_f|test/bigsquare.md|] ]
test/HTMLRenderTests.hs view
@@ -69,7 +69,7 @@ [ testCase "empty table, hide blank" $ cmpTables "empty table, hide blank"- (KTRH.render cfg0 kvi0) [sq|+ (KTRH.render Nothing cfg0 kvi0) [sq| **** <table class="kvitable"> <thead class="kvitable_head">@@ -83,7 +83,7 @@ , testCase "empty table, show blank" $ cmpTables "empty table, show blank"- (KTRH.render cfgWBlankRows kvi0) [sq|+ (KTRH.render Nothing cfgWBlankRows kvi0) [sq| **** <table class="kvitable"> <thead class="kvitable_head">@@ -100,7 +100,7 @@ , testCase "empty table with labels" $ let kvi = mempty & KVI.keyVals @Float .~ [ ("foo", []), ("dog", []) ]- in cmpTables "empty table with labels" (KTRH.render cfg0 kvi) [sq|+ in cmpTables "empty table with labels" (KTRH.render Nothing cfg0 kvi) [sq| **** <table class="kvitable"> <thead class="kvitable_head">@@ -118,93 +118,100 @@ , testCase "nested table hideBlank=rows,cols, fitted, colstack=hundreds" $ cmpTables "nested table hideBlank=rows,cols, fitted, colstack=hundreds"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [sq_f|README.md|] , testCase "nested table hide=none, fitted, colstack=hundreds" $ cmpTables "nested table hide=none, fitted, colstack=hundreds"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [sq_f|examples/hundreds_all.md|] -- duplication of the above in test/evenodd.md , testCase "nested table hide=none, fitted, colstack=hundreds" $ do cmpTables "nested table hide=none, fitted, colstack=hundreds"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ }) nestedTable) [sq2_f|test/evenodd.md|] , testCase "nested table hide=none, fitted, colstack=hundreds, maxCells=60" $ do cmpTables "nested table hide=none, fitted, colstack=hundreds, maxCells=60"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Just "hundreds"- , KTR.maxCells = 60- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "hundreds"+ , KTR.maxCells = 60+ }) nestedTable) [sq4_f|test/evenodd.md|] , testCase "nested table hide=none, fitted, no colstack, maxCells=60" $ do cmpTables "nested table hide=none, fitted, no colstack, maxCells=60"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = False- , KTR.hideBlankRows = False- , KTR.equisizedCols = False- , KTR.colStackAt = Nothing- , KTR.maxCells = 60- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = False+ , KTR.hideBlankRows = False+ , KTR.equisizedCols = False+ , KTR.colStackAt = Nothing+ , KTR.maxCells = 60+ }) nestedTable) [sq6_f|test/evenodd.md|] , testCase "nested table hideBlank=rol,col colstack=thousands" $ cmpTables "nested table hideBlank=row,col colstack=thousands"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False- , KTR.colStackAt = Just "thousands"- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ , KTR.colStackAt = Just "thousands"+ }) nestedTable) [sq2_f|README.md|] , testCase "nested table hideBlank=rol,col" $ cmpTables "nested table hideBlank=row,col"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.hideBlankCols = True- , KTR.hideBlankRows = True- , KTR.equisizedCols = False-- }) nestedTable)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.hideBlankCols = True+ , KTR.hideBlankRows = True+ , KTR.equisizedCols = False+ }) nestedTable) [sq3_f|README.md|] , testCase "big table grouped sorted" $ cmpTables "big table grouped sorted"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = [ "Location", "Biome", "Category" ]- }) zooTable2)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "Location", "Biome", "Category" ]+ }) zooTable2) [sq_f|examples/zoo.md|] , testCase "big table grouped sorted no-subtype colstack" $@@ -217,12 +224,13 @@ Nothing -> (ks,v) : newl Just v' -> (ks, v' + v) : filter ((ks /=) . fst) newl in cmpTables "big table grouped sorted no-subtype colstack"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = [ "Location", "Biome", "Category" ]- , KTR.colStackAt = Just "Name"- , KTR.equisizedCols = False- }) zt)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "Location", "Biome", "Category" ]+ , KTR.colStackAt = Just "Name"+ , KTR.equisizedCols = False+ }) zt) [sq2_f|examples/zoo.md|] , testCase "big square table, numCols and numCells limited" $@@ -241,13 +249,14 @@ , b <- [0..100::Int] ] in cmpTables "big table grouped sorted no-subtype colstack"- (KTRH.render (cfg0 { KTR.sortKeyVals = Just KTR.sortNumericAlpha- , KTR.rowRepeat = False- , KTR.rowGroup = [ "Location", "Biome", "Category" ]- , KTR.colStackAt = Just "Batter"- , KTR.equisizedCols = False- , KTR.maxCols = 20- , KTR.maxCells = 600- }) tbl)+ (KTRH.render Nothing (cfg0+ { KTR.sortKeyVals = Just KTR.sortNumericAlpha+ , KTR.rowRepeat = False+ , KTR.rowGroup = [ "Location", "Biome", "Category" ]+ , KTR.colStackAt = Just "Batter"+ , KTR.equisizedCols = False+ , KTR.maxCols = 20+ , KTR.maxCells = 600+ }) tbl) [sq2_f|test/bigsquare.md|] ]