Portability | portable |
---|---|
Stability | provisional |
Parser and definition of the dzen2-inspired formatting language used by Sindre. A format string is a sequence of commands changing drawing option parameters, and things to draw.
- data Format
- type FormatString = [Format]
- textContents :: FormatString -> Text
- startBg :: FormatString -> Maybe String
- parseFormatString :: Text -> Either String FormatString
- unparseFormatString :: FormatString -> Text
Documentation
A formatting command is either a change to the drawing state, or a string to be printed at the current location.
type FormatString = [Format]Source
A list of formatting commands, interpreted left-to-right.
textContents :: FormatString -> TextSource
The human-readable part of a format string, with formatting directives stripped.
startBg :: FormatString -> Maybe StringSource
The first background colour preceding any default background colour or text entry specified in the format string, if any.
parseFormatString :: Text -> Either String FormatStringSource
Parse a format string, returning either an error message or the result of the parse.
unparseFormatString :: FormatString -> TextSource
Prettyprint a FormatString
to a string that, when parsed by
parseFormatString
, results in the original FormatString