Copyright | © 2020 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <[email protected]> |
Stability | alpha |
Portability | Requires GHC 8 or later. |
Safe Haskell | None |
Language | Haskell2010 |
Foreign.Lua.Module.DocLayout
Description
Synopsis
- pushModule :: Lua NumResults
- preloadModule :: String -> Lua ()
- after_break :: Text -> Lua (Doc Text)
- before_non_blank :: Doc Text -> Lua (Doc Text)
- blankline :: Doc Text
- blanklines :: Int -> Lua (Doc Text)
- braces :: Doc Text -> Lua (Doc Text)
- brackets :: Doc Text -> Lua (Doc Text)
- cblock :: Int -> Doc Text -> Lua (Doc Text)
- chomp :: Doc Text -> Lua (Doc Text)
- concat :: [Doc Text] -> Optional (Doc Text) -> Lua (Doc Text)
- cr :: Doc Text
- double_quotes :: Doc Text -> Lua (Doc Text)
- empty :: Doc Text
- flush :: Doc Text -> Lua (Doc Text)
- hang :: Int -> Doc Text -> Doc Text -> Lua (Doc Text)
- inside :: Doc Text -> Doc Text -> Doc Text -> Lua (Doc Text)
- lblock :: Int -> Doc Text -> Lua (Doc Text)
- literal :: Text -> Lua (Doc Text)
- nest :: Int -> Doc Text -> Lua (Doc Text)
- nestle :: Doc Text -> Lua (Doc Text)
- nowrap :: Doc Text -> Lua (Doc Text)
- parens :: Doc Text -> Lua (Doc Text)
- prefixed :: Text -> Doc Text -> Lua (Doc Text)
- quotes :: Doc Text -> Lua (Doc Text)
- rblock :: Int -> Doc Text -> Lua (Doc Text)
- space :: Doc Text
- vfill :: Text -> Lua (Doc Text)
- render :: Doc Text -> Optional Int -> Lua Text
- is_empty :: Doc Text -> Lua Bool
- height :: Doc Text -> Lua Int
- min_offset :: Doc Text -> Lua Int
- offset :: Doc Text -> Lua Int
- real_length :: Text -> Lua Int
- update_column :: Doc Text -> Int -> Lua Int
- peekDoc :: StackIndex -> Lua (Doc Text)
- pushDoc :: Doc Text -> Lua ()
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.
Doc constructors and combinators
after_break :: Text -> Lua (Doc Text) Source #
Creates a
which is conditionally included only if it
comes at the beginning of a line.Doc
before_non_blank :: Doc Text -> Lua (Doc Text) Source #
Conditionally includes the given
unless it is
followed by a blank space.Doc
A carriage return. Does nothing if we're at the beginning of a line; otherwise inserts a newline.
lblock :: Int -> Doc Text -> Lua (Doc Text) Source #
Creates a block with the given width and content, aligned to the left.
prefixed :: Text -> Doc Text -> Lua (Doc Text) 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).
Rendering
render :: Doc Text -> Optional Int -> Lua Text Source #
Render a
. 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.Doc
Document Querying
min_offset :: Doc Text -> Lua Int Source #
Returns the minimal width of a
when reflowed at
breakable spaces.Doc
real_length :: Text -> Lua Int 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 :: Doc Text -> Int -> Lua Int Source #
Returns the column that would be occupied by the last laid out character.
Marshaling
peekDoc :: StackIndex -> Lua (Doc Text) Source #
Retrieve a Doc Text
value from the Lua stack. Strings are
converted to plain
values.Doc