flexible-unlit-0.2013.276.0: A configurable reimplementation of unlit

Portabilityportable
Stabilityexperimental
Maintainerrhymoid@gmail.com
Safe HaskellNone

Language.Preprocessor.Unlit

Contents

Description

 

Synopsis

unlit

unlit :: Text -> ([UnlitError], Text)Source

Runs unlitLinesWith on a blob of text, using the default parsers of GHC.

unlitLinesWith :: [Parser Text] -> [Text] -> ([UnlitError], [Text])Source

Parsers

birdParser :: Parser TextSource

Parser for blocks of code prefixed by > or <.

latexParser :: Parser TextSource

Parser for blocks of code delimited by \begin{code} and \end{code} or \begin{pseudocode} and \end{pseudocode}.

cppParser :: Parser TextSource

Parser for lines prefixed by #.

pandocMarkdownParser :: (Text -> Active) -> Parser TextSource

Parser for lines fenced by backticks or tildes.

Defining custom parsers

newtype Parser x Source

Constructors

Parser (x -> [x] -> Maybe ([Classified x], Maybe [x])) 

data Classified x Source

Constructors

Program NeedHug Active x

Program lines.

Comment

Comment lines.

Blank

Blank lines.

data Active Source

Constructors

Active

An active line of code.

Inactive

An inactive line of code.

Splitting and joining lines

lines :: Text -> [Text]Source

Breaks a Text up into a list of Texts at newline sequences. The resulting strings do not contain newline sequences.

unlines :: [Text] -> TextSource

Joins lines of Text. In the resulting string, lines are terminated with a single newline character ('\\n').