hslua-module-doclayout-0.2.0.1: Lua module wrapping Text.DocLayout.
Copyright© 2020 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <albert+hslua@zeitkraut.de>
Stabilityalpha
PortabilityRequires GHC 8 or later.
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Module.DocLayout

Description

Provides a Lua module which wraps DocLayout. The Doc' type is specialized to Text@.

This module defines orphan instances for Doc Text.

Synopsis

Module

pushModule :: Lua NumResults Source #

Pushes the doclayout module to the Lua stack.

preloadModule :: String -> Lua () Source #

Add the doclayout module under the given name to the table of preloaded packages.

description :: Text Source #

Textual description of the "doclayout" module.

fields :: [Field] Source #

Exposed fields.

functions :: [(Text, HaskellFunction)] Source #

Exposed module functions.

Doc constructors and combinators

after_break :: HaskellFunction Source #

Creates a Doc which is conditionally included only if it comes at the beginning of a line.

before_non_blank :: HaskellFunction Source #

Conditionally includes the given Doc unless it is followed by a blank space.

blankline :: Field Source #

Wrapped and documented blankline value.

blanklines :: HaskellFunction Source #

Insert blank lines unless they exist already.

braces :: HaskellFunction Source #

Puts a Doc in curly braces.

brackets :: HaskellFunction Source #

Puts a Doc in square brackets.

cblock :: HaskellFunction Source #

Like lblock but aligned centered.

chomp :: HaskellFunction Source #

Chomps trailing blank space off of a Doc.

concat :: HaskellFunction Source #

Concatenates a list of Docs.

cr :: Field Source #

Wrapped and documented cr value.

double_quotes :: HaskellFunction Source #

Wraps a Doc in double quotes

empty :: Field Source #

Wrapped and documented empty value.

flush :: HaskellFunction Source #

Makes a Doc flush against the left margin.

hang :: HaskellFunction Source #

Creates a hanging indent.

inside :: HaskellFunction Source #

Encloses a Doc inside a start and end Doc.

lblock :: HaskellFunction Source #

Creates a block with the given width and content, aligned to the left.

literal :: HaskellFunction Source #

Creates a Doc from a string.

nest :: HaskellFunction Source #

Indents a Doc by the specified number of spaces.

nestle :: HaskellFunction Source #

Removes leading blank lines from a Doc.

nowrap :: HaskellFunction Source #

Makes a Doc non-reflowable.

parens :: HaskellFunction Source #

Puts a Doc in parentheses.

prefixed :: HaskellFunction Source #

Uses the specified string as a prefix for every line of the inside document (except the first, if not at the beginning of the line).

quotes :: HaskellFunction Source #

Wraps a Doc in single quotes.

rblock :: HaskellFunction Source #

Like rblock but aligned to the right.

space :: Field Source #

Wrapped and documented space value.

vfill :: HaskellFunction Source #

An expandable border that, when placed next to a box, expands to the height of the box. Strings cycle through the list provided.

Rendering

render :: HaskellFunction Source #

Render a Doc. The text is reflowed on breakable spaces to match the given line length. Text is not reflowed if the line length parameter is omitted or nil.

Document Querying

is_empty :: HaskellFunction Source #

True iff the document is empty.

height :: HaskellFunction Source #

Returns the height of a block or other Doc.

min_offset :: HaskellFunction Source #

Returns the minimal width of a Doc when reflowed at breakable spaces.

offset :: HaskellFunction Source #

Returns the width of a Doc.

real_length :: HaskellFunction Source #

Returns the real length of a string in a monospace font: 0 for a combining character, 1, for a regular character, 2 for an East Asian wide character.

update_column :: HaskellFunction Source #

Returns the column that would be occupied by the last laid out character.

Marshaling

pushDoc :: Pusher (Doc Text) Source #

Push a Doc Text value to the Lua stack.

Orphan instances

Peekable (Doc Text) Source # 
Instance details

Methods

peek :: StackIndex -> Lua (Doc Text) #

Pushable (Doc Text) Source # 
Instance details

Methods

push :: Doc Text -> Lua () #