linebreak-0.1.0.3: breaks strings to fit width

Copyright(C) 2013 Francesco Ariis
LicenseBSD3 (see LICENSE file)
MaintainerFrancesco Ariis <fa-ml@ariis.it>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

Text.LineBreak

Description

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 '-' hyp
cs = "Using hyphenation with gruesomely non parsimonious wording."

main = putStr $ breakString bf cs

will output:

Using hyphenation with
gruesomely non parsimo-
nious wording.

Synopsis

Documentation

breakString :: BreakFormat -> String -> String Source

Breaks a 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, symbol to use to hyphenate a word, Hypenator to use (language, exceptions, etc. Refer to Text.Hyphenation for more info). To break lines without hyphenating, put Nothing in bfHyphenator.