hslua-module-doclayout-1.2.0.1: Lua module wrapping Text.DocLayout.

Copyright | © 2020-2024 Albert Krewinkel
License | MIT
Maintainer | Albert Krewinkel <albert+hslua@zeitkraut.de>
Safe Haskell | None
Language | Haskell2010

HsLua.Module.DocLayout

Contents

- Module
- Doc constructors and combinators
- Rendering
- Document Querying
- Styling
- Marshaling
- Orphan instances

Description

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

This module defines orphan instances for `Doc Text`.

Synopsis

- documentedModule :: LuaError e => Module e
- pushModule :: LuaError e => Module e -> LuaE e ()
- preloadModule :: LuaError e => Module e -> LuaE e ()
- description :: Text
- fields :: LuaError e => [Field e]
- functions :: LuaError e => [DocumentedFunction e]
- after_break :: LuaError e => DocumentedFunction e
- before_non_blank :: LuaError e => DocumentedFunction e
- blankline :: LuaError e => Field e
- blanklines :: LuaError e => DocumentedFunction e
- braces :: LuaError e => DocumentedFunction e
- brackets :: LuaError e => DocumentedFunction e
- cblock :: LuaError e => DocumentedFunction e
- chomp :: LuaError e => DocumentedFunction e
- concat :: LuaError e => DocumentedFunction e
- cr :: LuaError e => Field e
- double_quotes :: LuaError e => DocumentedFunction e
- empty :: LuaError e => Field e
- flush :: LuaError e => DocumentedFunction e
- hang :: LuaError e => DocumentedFunction e
- inside :: LuaError e => DocumentedFunction e
- lblock :: LuaError e => DocumentedFunction e
- literal :: LuaError e => DocumentedFunction e
- nest :: LuaError e => DocumentedFunction e
- nestle :: LuaError e => DocumentedFunction e
- nowrap :: LuaError e => DocumentedFunction e
- parens :: LuaError e => DocumentedFunction e
- prefixed :: LuaError e => DocumentedFunction e
- quotes :: LuaError e => DocumentedFunction e
- rblock :: LuaError e => DocumentedFunction e
- space :: LuaError e => Field e
- vfill :: LuaError e => DocumentedFunction e
- render :: LuaError e => DocumentedFunction e
- is_empty :: LuaError e => DocumentedFunction e
- height :: LuaError e => DocumentedFunction e
- min_offset :: LuaError e => DocumentedFunction e
- offset :: LuaError e => DocumentedFunction e
- real_length :: DocumentedFunction e
- update_column :: LuaError e => DocumentedFunction e
- bold :: LuaError e => DocumentedFunction e
- italic :: LuaError e => DocumentedFunction e
- underlined :: LuaError e => DocumentedFunction e
- strikeout :: LuaError e => DocumentedFunction e
- fg :: LuaError e => DocumentedFunction e
- bg :: LuaError e => DocumentedFunction e
- peekDoc :: LuaError e => Peeker e (Doc Text)
- pushDoc :: LuaError e => Pusher e (Doc Text)

# Module

documentedModule :: LuaError e => Module e Source #

Self-documenting module.

pushModule :: LuaError e => Module e -> LuaE e () #

preloadModule :: LuaError e => Module e -> LuaE e () #

description :: Text Source #

Textual description of the "doclayout" module.

fields :: LuaError e => [Field e] Source #

Exposed fields.

functions :: LuaError e => [DocumentedFunction e] Source #

Exposed module functions.

# Doc constructors and combinators

after_break :: LuaError e => DocumentedFunction e Source #

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

before_non_blank :: LuaError e => DocumentedFunction e Source #

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

blankline :: LuaError e => Field e Source #

Wrapped and documented `blankline` value.

blanklines :: LuaError e => DocumentedFunction e Source #

Insert blank lines unless they exist already.

braces :: LuaError e => DocumentedFunction e Source #

Puts a ``Doc`` in curly braces.

brackets :: LuaError e => DocumentedFunction e Source #

Puts a ``Doc`` in square brackets.

cblock :: LuaError e => DocumentedFunction e Source #

Like ``lblock`` but aligned centered.

chomp :: LuaError e => DocumentedFunction e Source #

Chomps trailing blank space off of a ``Doc``.

concat :: LuaError e => DocumentedFunction e Source #

Concatenates a list of ``Doc``s.

cr :: LuaError e => Field e Source #

Wrapped and documented `cr` value.

double_quotes :: LuaError e => DocumentedFunction e Source #

Wraps a ``Doc`` in double quotes

empty :: LuaError e => Field e Source #

Wrapped and documented `empty` value.

flush :: LuaError e => DocumentedFunction e Source #

Makes a ``Doc`` flush against the left margin.

hang :: LuaError e => DocumentedFunction e Source #

Creates a hanging indent.

inside :: LuaError e => DocumentedFunction e Source #

Encloses a ``Doc`` inside a start and end ``Doc``.

lblock :: LuaError e => DocumentedFunction e Source #

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

literal :: LuaError e => DocumentedFunction e Source #

Creates a ``Doc`` from a string.

nest :: LuaError e => DocumentedFunction e Source #

Indents a ``Doc`` by the specified number of spaces.

nestle :: LuaError e => DocumentedFunction e Source #

Removes leading blank lines from a ``Doc``.

nowrap :: LuaError e => DocumentedFunction e Source #

Makes a ``Doc`` non-reflowable.

parens :: LuaError e => DocumentedFunction e Source #

Puts a ``Doc`` in parentheses.

prefixed :: LuaError e => DocumentedFunction e 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 :: LuaError e => DocumentedFunction e Source #

Wraps a ``Doc`` in single quotes.

rblock :: LuaError e => DocumentedFunction e Source #

Like ``rblock`` but aligned to the right.

space :: LuaError e => Field e Source #

Wrapped and documented `space` value.

vfill :: LuaError e => DocumentedFunction e 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 :: LuaError e => DocumentedFunction e 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 :: LuaError e => DocumentedFunction e Source #

`True` iff the document is empty.

height :: LuaError e => DocumentedFunction e Source #

Returns the height of a block or other Doc.

min_offset :: LuaError e => DocumentedFunction e Source #

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

offset :: LuaError e => DocumentedFunction e Source #

Returns the width of a ``Doc``.

real_length :: DocumentedFunction e 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 :: LuaError e => DocumentedFunction e Source #

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

# Styling

bold :: LuaError e => DocumentedFunction e Source #

italic :: LuaError e => DocumentedFunction e Source #

underlined :: LuaError e => DocumentedFunction e Source #

strikeout :: LuaError e => DocumentedFunction e Source #

fg :: LuaError e => DocumentedFunction e Source #

bg :: LuaError e => DocumentedFunction e Source #

# Marshaling

peekDoc :: LuaError e => Peeker e (Doc Text) Source #

Retrieve a `Doc Text` value from the Lua stack. Strings are converted to plain ``Doc`` values.

pushDoc :: LuaError e => Pusher e (Doc Text) Source #

Push a `Doc Text` value to the Lua stack.

# Orphan instances

Peekable (Doc Text) Source # |
Instance details Methods safepeek :: LuaError e => Peeker e (Doc Text)
Pushable (Doc Text) Source # |
Instance details Methods push :: LuaError e => Doc Text -> LuaE e () #