sindre-0.6: A programming language for simple GUIs
LicenseMIT-style (see LICENSE)
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Sindre.Formatting

Description

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.

Synopsis

Documentation

data Format Source #

A formatting command is either a change to the drawing state, or a string to be printed at the current location.

Constructors

Fg String

Draw text in the given colour.

DefFg

Draw text in the default colour.

Bg String

Draw the background in the given colour.

DefBg

Draw the background in the default colour.

Text Text

Draw the given string.

Instances

Instances details
Eq Format Source # 
Instance details

Defined in Sindre.Formatting

Methods

(==) :: Format -> Format -> Bool #

(/=) :: Format -> Format -> Bool #

Ord Format Source # 
Instance details

Defined in Sindre.Formatting

Show Format Source # 
Instance details

Defined in Sindre.Formatting

Mold FormatString Source # 
Instance details

Defined in Sindre.Formatting

type FormatString = [Format] Source #

A list of formatting commands, interpreted left-to-right.

textContents :: FormatString -> Text Source #

The human-readable part of a format string, with formatting directives stripped.

startBg :: FormatString -> Maybe String Source #

The first background colour preceding any default background colour or text entry specified in the format string, if any.

parseFormatString :: Text -> Either String FormatString Source #

Parse a format string, returning either an error message or the result of the parse.

unparseFormatString :: FormatString -> Text Source #

Prettyprint a FormatString to a string that, when parsed by parseFormatString, results in the original FormatString