linebreak-1.1.0.0: breaks strings to fit width
Copyright(C) 2014 Francesco Ariis
LicenseBSD3 (see LICENSE file)
MaintainerFrancesco Ariis <fa-ml@ariis.it>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.LineBreak

Description

Simple functions to break a String to fit a maximum text width, using Knuth-Liang hyphenation algorithm.

Example:

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.
Synopsis

Line breaking

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.

Hypenators

Convenience reexport from Text.Hyphenation.Language.

data Hyphenator #

A Hyphenator is combination of an alphabet normalization scheme, a set of Patterns, a set of Exceptions to those patterns and a number of characters at each end to skip hyphenating.

afrikaans :: Hyphenator #

Hyphenators for a wide array of languages.

armenian :: Hyphenator #

Hyphenators for a wide array of languages.

assamese :: Hyphenator #

Hyphenators for a wide array of languages.

basque :: Hyphenator #

Hyphenators for a wide array of languages.

bengali :: Hyphenator #

Hyphenators for a wide array of languages.

bulgarian :: Hyphenator #

Hyphenators for a wide array of languages.

catalan :: Hyphenator #

Hyphenators for a wide array of languages.

chinese :: Hyphenator #

Hyphenators for a wide array of languages.

coptic :: Hyphenator #

Hyphenators for a wide array of languages.

croatian :: Hyphenator #

Hyphenators for a wide array of languages.

czech :: Hyphenator #

Hyphenators for a wide array of languages.

danish :: Hyphenator #

Hyphenators for a wide array of languages.

dutch :: Hyphenator #

Hyphenators for a wide array of languages.

english_US :: Hyphenator #

>>> hyphenate english_US "supercalifragilisticexpialadocious"
["su","per","cal","ifrag","ilis","tic","ex","pi","al","ado","cious"]

favors US hyphenation

english_GB :: Hyphenator #

>>> hyphenate english_GB "supercalifragilisticexpialadocious"
["su","per","cal","i","fra","gil","istic","ex","pi","alado","cious"]

favors UK hyphenation

esperanto :: Hyphenator #

Hyphenators for a wide array of languages.

estonian :: Hyphenator #

Hyphenators for a wide array of languages.

ethiopic :: Hyphenator #

Hyphenators for a wide array of languages.

finnish :: Hyphenator #

Hyphenators for a wide array of languages.

french :: Hyphenator #

>>> hyphenate french "anticonstitutionnellement"
["an","ti","cons","ti","tu","tion","nel","le","ment"]

friulan :: Hyphenator #

Hyphenators for a wide array of languages.

galician :: Hyphenator #

Hyphenators for a wide array of languages.

georgian :: Hyphenator #

Hyphenators for a wide array of languages.

german_1901 :: Hyphenator #

Hyphenators for a wide array of languages.

german_1996 :: Hyphenator #

Hyphenators for a wide array of languages.

german_Swiss :: Hyphenator #

Hyphenators for a wide array of languages.

greek_Ancient :: Hyphenator #

Hyphenators for a wide array of languages.

greek_Mono :: Hyphenator #

Hyphenators for a wide array of languages.

greek_Poly :: Hyphenator #

Hyphenators for a wide array of languages.

gujarati :: Hyphenator #

Hyphenators for a wide array of languages.

hindi :: Hyphenator #

Hyphenators for a wide array of languages.

hungarian :: Hyphenator #

Hyphenators for a wide array of languages.

icelandic :: Hyphenator #

>>> hyphenate icelandic "va\240lahei\240avegavinnuverkf\230rageymslusk\250r"
["va\240la","hei\240a","vega","vinnu","verk","f\230ra","geymslu","sk\250r"]

indonesian :: Hyphenator #

Hyphenators for a wide array of languages.

interlingua :: Hyphenator #

Hyphenators for a wide array of languages.

irish :: Hyphenator #

Hyphenators for a wide array of languages.

italian :: Hyphenator #

Hyphenators for a wide array of languages.

kannada :: Hyphenator #

Hyphenators for a wide array of languages.

kurmanji :: Hyphenator #

Hyphenators for a wide array of languages.

latin :: Hyphenator #

Hyphenators for a wide array of languages.

latin_Classic :: Hyphenator #

Hyphenators for a wide array of languages.

latvian :: Hyphenator #

Hyphenators for a wide array of languages.

lithuanian :: Hyphenator #

Hyphenators for a wide array of languages.

malayalam :: Hyphenator #

Hyphenators for a wide array of languages.

marathi :: Hyphenator #

Hyphenators for a wide array of languages.

mongolian :: Hyphenator #

Hyphenators for a wide array of languages.

norwegian_Bokmal :: Hyphenator #

Hyphenators for a wide array of languages.

norwegian_Nynorsk :: Hyphenator #

Hyphenators for a wide array of languages.

occitan :: Hyphenator #

Hyphenators for a wide array of languages.

oriya :: Hyphenator #

Hyphenators for a wide array of languages.

panjabi :: Hyphenator #

Hyphenators for a wide array of languages.

piedmontese :: Hyphenator #

Hyphenators for a wide array of languages.

polish :: Hyphenator #

Hyphenators for a wide array of languages.

portuguese :: Hyphenator #

Hyphenators for a wide array of languages.

romanian :: Hyphenator #

Hyphenators for a wide array of languages.

romansh :: Hyphenator #

Hyphenators for a wide array of languages.

russian :: Hyphenator #

Hyphenators for a wide array of languages.

sanskrit :: Hyphenator #

Hyphenators for a wide array of languages.

serbian_Cyrillic :: Hyphenator #

Hyphenators for a wide array of languages.

serbocroatian_Cyrillic :: Hyphenator #

Hyphenators for a wide array of languages.

serbocroatian_Latin :: Hyphenator #

Hyphenators for a wide array of languages.

slovak :: Hyphenator #

Hyphenators for a wide array of languages.

slovenian :: Hyphenator #

Hyphenators for a wide array of languages.

spanish :: Hyphenator #

Hyphenators for a wide array of languages.

swedish :: Hyphenator #

Hyphenators for a wide array of languages.

tamil :: Hyphenator #

Hyphenators for a wide array of languages.

telugu :: Hyphenator #

Hyphenators for a wide array of languages.

thai :: Hyphenator #

Hyphenators for a wide array of languages.

turkish :: Hyphenator #

Hyphenators for a wide array of languages.

turkmen :: Hyphenator #

Hyphenators for a wide array of languages.

ukrainian :: Hyphenator #

Hyphenators for a wide array of languages.

uppersorbian :: Hyphenator #

Hyphenators for a wide array of languages.

welsh :: Hyphenator #

Hyphenators for a wide array of languages.