format.pl -- Print formatted text to a terminal
This module is the core of the plain text rendering module, providing format_paragraph/2 which formats a plain text block, respecting left and right margins, text alignment, ANSI style elements, etc.
- format_paragraph(+Text, +Options)
- Format a paragraph to the current output. Options defined are:
- width(+Width)
- Width of a line. Default is 72.
- margin_left(+Indent)
- Indent all lines with Indent spaces.
- margin_right(+Margin)
- Additional right margin (same as reducing
width
) - hang(+Hang)
- Additional indent for the first line. Can be negative.
- bullet(+Bullet)
- Bullet placed before the first line.
- text_align(Alignment)
- One of
left
,right
,center
orjustify
- pad(+Char)
- If present, padd to the right using Char. Currently Char must be ' '.
- trim_line(Line0, Line) is det
- Remove leading and trailing white space (
b(_,_)
) tokens from a line. - format_line(+Line, +Width, +LineNo, +Options) is det[private]
- float_right(+Line0, -Line, -Right) is semidet[private]
- space_dim(+Line, -SpaceVars, -Width)[private]
- spread(+Spread, +SPC, -Spaces)[private]
- Distribute Spread spaces over SPC places, producing a list of counts.
- emit_line(+Content)[private]
- words(+Input, -Words) is det[multifile]
- Turn the Input into a list of
w(Word, Len, Attributes)
terms.