]> gitweb.factorcode.org Git - factor.git/blob - basis/wrap/words/words-docs.factor
422aea0ac3be1b624db1f8b8d5ba483ad1d1fd19
[factor.git] / basis / wrap / words / words-docs.factor
1 ! Copyright (C) 2009 Daniel Ehrenberg
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.syntax help.markup math kernel ;
4 IN: wrap.words
5
6 ABOUT: "wrap.words"
7
8 ARTICLE: "wrap.words" "Word object wrapping"
9 "The " { $vocab-link "wrap.words" } " vocabulary implements word wrapping on abstract word objects, which have certain properties making it a more suitable input representation than strings."
10 { $subsection wrap-words }
11 { $subsection word }
12 { $subsection <word> } ;
13
14 HELP: wrap-words
15 { $values { "words" { "a sequence of " { $instance word } "s" } } { "line-max" integer } { "line-ideal" integer } { "lines" "a sequence of sequences of words" } }
16 { $description "Divides the words into lines, where the sum of the lengths of the words on a line (not counting breaks at the end of the line) is at most the given maximum. The returned set of lines is optimized to minimize the square of the deviation of each line from the ideal width. It is not guaranteed to be the minimal number of lines. Every line except for the first one starts with a non-break, and every one but the last ends with a break." } ;
17
18 HELP: word
19 { $class-description "A word is a Factor object annotated with a length (in the " { $snippet "width" } " slot) and knowledge about whether it is an allowable position for an optional line break (in the " { $snippet "break?" } " slot). Words can be created with " { $link <word> } "." }
20 { $see-also wrap-words } ;
21
22 HELP: <word>
23 { $values { "key" object } { "width" integer } { "break?" { { $link t } " or " { $link POSTPONE: f } } } { "word" word } }
24 { $description "Creates a " { $link word } " object with the given parameters." }
25 { $see-also wrap-words } ;