Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Text wrapping and filling for OCaml
OCaml Makefile
tag: 0.1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
src
.gitignore
LICENSE
Makefile
README.md
_oasis
_tags
configure
myocamlbuild.ml
setup.ml

README.md

textwrap

An incomplete port of Python's textwrap library to OCaml. What's in the box?

# let w = Wrapper.make 4 in
  print_endline (Wrapper.fill w "Hello world!");;
Hell
o wo
rld!
- : unit = ()

Here's a table of Wrapper.make arguments, controlling various aspects of wrapping:

| argument             | default | description                                        |
|----------------------+---------+----------------------------------------------------|
| initial_indent       | ""      | string that will be prepended to the first line    |
|                      |         | of wrapped output.                                 |
| subsequent_indent    | ""      | string that will be prepended to all but the       |
|                      |         | first lines of wrapped output.                     |
| expand_tabs          | true    | expand tabs in input string to spaces before       |
|                      |         | further processing -- each tab will become         |
|                      |         | 8 spaces; if `false`, each tab is treaded as a     |
|                      |         | single character.                                  |
| replace_whitespace   | true    | replace all whitespace characters in the input     |
|                      |         | text by spaces *after* tab expansion.              |
| fix_sentence_endings | false   | ensure that sentence-ending punctuation is         |
|                      |         | allways followed by two spaces.                    |
| break_long_words     | true    | break words longer than 'width', if `false`, those |
|                      |         | words won't be broken and some lines might be      |
|                      |         | longer that 'width'.                               |
| drop_whitespace      | true    | drop leading and trailing whitespace from lines.   |
Something went wrong with that request. Please try again.