Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Text.Layout.Table.Justify
Description
Produce justified text, which is spread over multiple rows, and join it
with other columns. For a simple cut, chunksOf
from the split
package
is best suited.
- justifyTextsAsGrid :: [(Int, String)] -> [[String]]
- justifyWordListsAsGrid :: [(Int, [String])] -> [[String]]
- justifyText :: Int -> String -> [String]
- justify :: Int -> [String] -> [String]
- dimorphicSummands :: Int -> Int -> [Int]
- dimorphicSummandsBy :: (Int -> a) -> Int -> Int -> [a]
- columnsAsGrid :: Position V -> [[[a]]] -> [[[a]]]
- vpadCols :: Position V -> a -> [[a]] -> [[a]]
Documentation
justifyTextsAsGrid :: [(Int, String)] -> [[String]] Source
Justifies texts and presents the resulting lines in a grid structure (each text in one column).
justifyWordListsAsGrid :: [(Int, [String])] -> [[String]] Source
Justifies lists of words and presents the resulting lines in a grid structure (each list of words in one column). This is useful if you don't want to split just at whitespaces.
justifyText :: Int -> String -> [String] Source
justify :: Int -> [String] -> [String] Source
Fits as many words on a line, depending on the given width. Every line, but the last one, gets equally filled with spaces between the words, as far as possible.
dimorphicSummands :: Int -> Int -> [Int] Source
Splits a given number into summands of 2 different values, where the first one is exactly one bigger than the second one. Splitting 40 spaces into 9 almost equal parts would result in:
>>>
dimorphicSummands 40 9
[5,5,5,5,4,4,4,4,4]
dimorphicSummandsBy :: (Int -> a) -> Int -> Int -> [a] Source
Vertical alignment of whole columns
columnsAsGrid :: Position V -> [[[a]]] -> [[[a]]] Source
Merges multiple columns together and merges them to a valid grid without holes. The following example clarifies this:
>>>
columnsAsGrid top [justifyText 10 "This text will not fit on one line.", ["42", "23"]]
[["This text","42"],["will not","23"],["fit on one",""],["line.",""]]