Portability | portable |
---|---|
Stability | alpha |
Maintainer | John MacFarlane <jgm@berkeley.edu> |
Functions for the manipulation of fixed-width blocks of text. These are used in the construction of plain-text tables.
- data TextBlock = TextBlock Int Int [String]
- docToBlock :: Int -> Doc -> TextBlock
- blockToDoc :: TextBlock -> Doc
- widthOfBlock :: TextBlock -> Int
- heightOfBlock :: TextBlock -> Int
- hcatBlocks :: [TextBlock] -> TextBlock
- hsepBlocks :: [TextBlock] -> TextBlock
- centerAlignBlock :: TextBlock -> TextBlock
- leftAlignBlock :: TextBlock -> TextBlock
- rightAlignBlock :: TextBlock -> TextBlock
Documentation
A fixed-width block of text. Parameters are width of block, height of block, and list of lines.
Convert a Doc
element into a TextBlock
with a specified width.
blockToDoc :: TextBlock -> DocSource
Convert a TextBlock
to a Doc
element.
widthOfBlock :: TextBlock -> IntSource
Returns width of a TextBlock
(number of columns).
heightOfBlock :: TextBlock -> IntSource
Returns height of a TextBlock
(number of rows).
hcatBlocks :: [TextBlock] -> TextBlockSource
Concatenates a list of TextBlock
s into a new TextBlock
in
which they appear side by side.
hsepBlocks :: [TextBlock] -> TextBlockSource
Like hcatBlocks
, but inserts space between the TextBlock
s.
centerAlignBlock :: TextBlock -> TextBlockSource
Centers the contents of a TextBlock
within the block.
leftAlignBlock :: TextBlock -> TextBlockSource
Left-aligns the contents of a TextBlock
within the block.
rightAlignBlock :: TextBlock -> TextBlockSource
Right-aligns the contents of a TextBlock
within the block.