Copyright | (C) 2014 Francesco Ariis |
---|---|
License | BSD3 (see LICENSE file) |
Maintainer | Francesco Ariis <fa-ml@ariis.it> |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Simple functions to break a String to fit a maximum text width, using Knuth-Liang hyphenation algorithm.
Example:
import Text.Hyphenation import Text.LineBreak hyp = Just english_US bf = BreakFormat 25 4 '-' hyp cs = "Using hyphenation with gruesomely non parsimonious wording." main = putStr $ breakString bf cs
will output:
Using hyphenation with gruesomely non parsimo- nious wording.
- breakString :: BreakFormat -> String -> String
- breakStringLn :: BreakFormat -> String -> [String]
- data BreakFormat = BreakFormat {
- bfMaxCol :: Int
- bfTabRep :: Int
- bfHyphenSymbol :: Char
- bfHyphenator :: Maybe Hyphenator
Documentation
breakString :: BreakFormat -> String -> String Source
Breaks some text (String) to make it fit in a certain width. The output is a String, suitable for writing to screen or file.
breakStringLn :: BreakFormat -> String -> [String] Source
Convenience for lines $ breakString bf cs
data BreakFormat Source
How to break the strings: maximum width of the lines, number of spaces
to replace tabs with (dumb replacement), symbol to use to hyphenate
words, hypenator to use (language, exceptions, etc.; refer to
Text.Hyphenation for usage instructions). To break lines without
hyphenating, put Nothing
in bfHyphenator
.
BreakFormat | |
|