hledger-lib-1.30: A reusable library providing the core functionality of hledger

Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Tabular.AsciiWide

Description

Text.Tabular.AsciiArt from tabular-0.2.2.7, modified to treat wide characters as double width.

Synopsis

- module Text.Tabular
- data TableOpts = TableOpts {
  - prettyTable :: Bool
  - tableBorders :: Bool
  - borderSpaces :: Bool
  }
- render :: Bool -> (rh -> Text) -> (ch -> Text) -> (a -> Text) -> Table rh ch a -> Text
- renderTable :: TableOpts -> (rh -> Cell) -> (ch -> Cell) -> (a -> Cell) -> Table rh ch a -> Text
- renderTableB :: TableOpts -> (rh -> Cell) -> (ch -> Cell) -> (a -> Cell) -> Table rh ch a -> Builder
- renderTableByRowsB :: TableOpts -> ([ch] -> [Cell]) -> ((rh, [a]) -> (Cell, [Cell])) -> Table rh ch a -> Builder
- renderRow :: TableOpts -> Header Cell -> Text
- renderRowB :: TableOpts -> Header Cell -> Builder
- renderColumns :: TableOpts -> [Int] -> Header Cell -> Builder
- data Cell = Cell Align [WideBuilder]
- data Align
  - = TopRight
  - | BottomRight
  - | BottomLeft
  - | TopLeft
- emptyCell :: Cell
- textCell :: Align -> Text -> Cell
- textsCell :: Align -> [Text] -> Cell
- cellWidth :: Cell -> Int
- concatTables :: Properties -> Table rh ch a -> Table rh ch2 a -> Table rh ch a

# Documentation

module Text.Tabular

data TableOpts Source #

The options to use for rendering a table.

Constructors

TableOpts |

Fields

- prettyTable :: Bool

  Pretty tables

- tableBorders :: Bool

  Whether to display the outer borders

- borderSpaces :: Bool

  Whether to display spaces around bars

#### Instances

Instances details

Show TableOpts Source # |
Instance details Defined in Text.Tabular.AsciiWide Methods showsPrec :: Int -> TableOpts -> ShowS Source # show :: TableOpts -> String Source # showList :: [TableOpts] -> ShowS Source #
Default TableOpts Source # |
Instance details Defined in Text.Tabular.AsciiWide Methods def :: TableOpts #

render :: Bool -> (rh -> Text) -> (ch -> Text) -> (a -> Text) -> Table rh ch a -> Text Source #

Render a table according to common options, for backwards compatibility

renderTable Source #

Arguments

:: TableOpts | Options controlling Table rendering
-> (rh -> Cell) | Rendering function for row headers
-> (ch -> Cell) | Rendering function for column headers
-> (a -> Cell) | Function determining the string and width of a cell
-> Table rh ch a |
-> Text |

Render a table according to various cell specifications>

renderTableB Source #

Arguments

:: TableOpts | Options controlling Table rendering
-> (rh -> Cell) | Rendering function for row headers
-> (ch -> Cell) | Rendering function for column headers
-> (a -> Cell) | Function determining the string and width of a cell
-> Table rh ch a |
-> Builder |

A version of renderTable which returns the underlying Builder.

renderTableByRowsB Source #

Arguments

:: TableOpts | Options controlling Table rendering
-> ([ch] -> [Cell]) | Rendering function for column headers
-> ((rh, [a]) -> (Cell, [Cell])) | Rendering function for row and row header
-> Table rh ch a |
-> Builder |

A version of renderTable that operates on rows (including the `row` of column headers) and returns the underlying Builder.

renderRow :: TableOpts -> Header Cell -> Text Source #

Render a single row according to cell specifications.

renderRowB :: TableOpts -> Header Cell -> Builder Source #

A version of renderRow which returns the underlying Builder.

renderColumns Source #

Arguments

:: TableOpts | rendering options for the table
-> [Int] | max width for each column
-> Header Cell |
-> Builder |

We stop rendering on the shortest list!

data Cell Source #

Cell contents along an alignment

Constructors

Cell Align [WideBuilder] |

data Align Source #

How to align text in a cell

Constructors

TopRight |
BottomRight |
BottomLeft |
TopLeft |

#### Instances

Instances details

Show Align Source # |
Instance details Defined in Text.Tabular.AsciiWide Methods showsPrec :: Int -> Align -> ShowS Source # show :: Align -> String Source # showList :: [Align] -> ShowS Source #

emptyCell :: Cell Source #

textCell :: Align -> Text -> Cell Source #

Create a single-line cell from the given contents with its natural width.

textsCell :: Align -> [Text] -> Cell Source #

Create a multi-line cell from the given contents with its natural width.

cellWidth :: Cell -> Int Source #

Return the width of a Cell.

concatTables :: Properties -> Table rh ch a -> Table rh ch2 a -> Table rh ch a Source #

Add the second table below the first, discarding its column headings.