darcs-2.12.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.Text

Contents

- Text construction.
- Text formatting.
- Text processing

Synopsis

- sentence :: Doc -> Doc
- formatText :: Int -> [String] -> String
- formatParas :: Int -> [String] -> [String]
- formatPara :: Int -> [[a]] -> [[[a]]]
- chompTrailingNewline :: String -> String
- breakCommand :: String -> (String, [String])
- quote :: String -> String
- pathlist :: [FilePath] -> Doc

# Text construction.

sentence :: Doc -> Doc #

# Text formatting.

formatText :: Int -> [String] -> String #

Take a list of paragraphs and format them to the given line length, with a blank line between paragraphs.

formatParas :: Int -> [String] -> [String] #

formatPara :: Int -> [[a]] -> [[[a]]] #

Take a list of words and split it up so that each chunk fits into the specified width when spaces are included. Any words longer than the specified width end up in a chunk of their own.

chompTrailingNewline :: String -> String #

# Text processing

breakCommand :: String -> (String, [String]) #

quote :: String -> String #

Quote a string for screen output.

pathlist :: [FilePath] -> Doc #

Format a list of `FilePath`s as quoted text. It deliberately refuses to use English.andClauses but rather separates the quoted strings only with a space, because this makes it usable for copy and paste e.g. as arguments to another shell command.