]> gitweb.factorcode.org Git - factor.git/blob - basis/wrap/wrap-docs.factor
Fixes #2966
[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-subsections
11     { "String word wrapping" "wrap.strings" }
12     { "Word object wrapping" "wrap.words" }
13 } ;
14
15 HELP: element
16 { $class-description "An element to be wrapped. It has the following slots:" }
17 { $slots
18     { "contents" "The object being wrapped." }
19     { "black" "The width of the object (e.g., the text length)." }
20     { "white" "The space after the object (e.g., trailing whitespace)." }
21 } ;
22
23 HELP: wrap
24 { $values { "elements" { $sequence element } } { "width" real } { "array" array } }
25 { $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." } ;