]> gitweb.factorcode.org Git - factor.git/blob - basis/wrap/wrap-docs.factor
fd4e345750e15aee5097112e30a7e6dba888e8b1
[factor.git] / basis / wrap / wrap-docs.factor
1 ! Copyright (C) 2009 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays help.markup help.syntax kernel math strings ;
4 IN: wrap
5
6 ABOUT: "wrap"
7
8 ARTICLE: "wrap" "Word wrapping"
9 "The " { $vocab-link "wrap" } " vocabulary implements word wrapping. Wrapping can take place based on simple strings, assumed to be monospace, or abstract word objects."
10 { $vocab-subsection "String word wrapping" "wrap.strings" }
11 { $vocab-subsection "Word object wrapping" "wrap.words" } ;
12
13 HELP: element
14 { $class-description "An element to be wrapped. It has the following slots:" }
15 { $table
16     { { $slot "contents" } "The object being wrapped." }
17     { { $slot "black" } "The width of the object (e.g., the text length)." }
18     { { $slot "white" } "The space after the object (e.g., trailing whitespace)." }
19 } ;
20
21 HELP: wrap
22 { $values { "elements" { $sequence element } } { "width" real } { "array" array } }
23 { $description "Break the " { $snippet "elements" } " into lines such that the total width of each line tries to be less than " { $snippet "width" } " while attempting to minimize the raggedness represented by the amount of space at the end of each line. Returns an array of lines." } ;