package textwrap
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=23c2b6963e8ae28d087b28960025e3d2aab9cc64bcca3b5a97c53038132404d9
sha512=0cba54075fc17c0dc3b60e9b9b241f7e85f2c6e372325e2a949ea251becd8a5c2d3ea843d2240ff005f3f9d76a1fbe20654405513cadc90c32f420bfc60af79b
Description
An almost complete port of Python's textwrap library to OCaml.
Added to opam-repository:
README
textwrap
An almost complete port of Python's [textwrap] 1 library to OCaml.
Installation
Install using the Dune build tool:
$ dune build
$ dune installor for immediate use:
$ dune utopOr using opam 2.0:
$ opam install .Example
So, 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. |Missing features
The only feature OCaml version is missing from the original [textwrap] 1 is [break_on_hyphens] 2, which requires a decent regex engine to implement; unfortunately, this is not the case for [Str] 3.
Dev Dependencies
None
Optional Dependencies
None
Used by (1)
Conflicts
None
Build status
Results of building textwrap with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.2.1 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure