SimpleTableGenerator: Simple table generator

[ gpl, library, text ] [ Propose Tags ] [ Report a vulnerability ]

Pass a 2D-list of strings and get a single string with table contents.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.2.0.0
Dependencies base (>=4.8 && <5), split (>=0.2 && <0.3) [details]
License GPL-3.0-only
Author klntsky
Maintainer klntsky@openmailbox.org
Category Text
Source repo head: git clone git://github.com/8084/SimpleTableGenerator.git
Uploaded by klntsky at 2017-02-22T19:08:35Z
Distributions NixOS:0.2.0.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1084 total (8 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-02-22 [all 1 reports]

Readme for SimpleTableGenerator-0.2.0.0

[back to package description]

SimpleTableGenerator

About

This library is for drawing text tables.

Pass a 2D-list of strings representing cells and get a single string with table contents.

makeDefaultSimpleTable :: [[String]] -> String

Newlines are supported.

Basic usage

putStrLn $ makeDefaultSimpleTable [["1","2","3"], ["One","Two","Three"], ["First", "Second"]]
┌───────┬────────┬───────┐
│ 1     │ 2      │ 3     │
├───────┼────────┼───────┤
│ One   │ Two    │ Three │
├───────┼────────┼───────┤
│ First │ Second │       │
└───────┴────────┴───────┘

Advanced usage

You can configure the table by constructing SimpleTableConfig and passing it to makeSimpleTable.

putStrLn $ makeSimpleTable simpleTableConfig {
    tableBorders = "+++++++++-|",
    colMinWidths  = [3, 4],
    rowMinHeights = [2],
    padFunction   = simpleTableLeftPad,
    cellPadFunction = simpleTableBottomPad,
    horizontalPadding = 0,
    verticalPadding = 1,
    paddingStr = ".,`"
    } [["a"], ["b", "c"]]
+---+----+
|.,`|.,`.|
|.,a|.,`.|
|.,`|.,`.|
|.,`|.,`.|
+---+----+
|.,`|.,`.|
|.,b|.,`c|
|.,`|.,`.|
+---+----+

Check out the docs for more info.