Paragraph wrapping and filling.
The parawrap module is an extended version of the built-in textwrap module. Like the standard module, it provides two convenience functions, wrap() and fill(). It also provides ParagraphWrapper, which is the class that does all the work. In addition, there is a split() function that splits up paragraphs.
Wraps text (a string) so every line is at most width characters long. Respects paragraph breaks, which are lines separated by multiple newlines. Returns a list of output lines, without final newlines.
Optional keyword arguments correspond to the instance attributes of ParagraphWrapper, which mirrors textwrap.TextWrapper. width defaults to 70.
Wraps text and returns a single string containing the wrapped paragraphs. fill() is shorthand for:
In particular, fill() accepts exactly the same keyword arguments as wrap().
To install from PyPi:
$ pip install parawrap
You can get a copy of the source by using:
$ git clone https://github.com/ecometrica/parawrap.git
Note that this program requires Python 2.6 or higher.
Please check our issue tracker for known bugs and feature requests.
We accept pull requests for fixes and new features.
Simon Law wrote this program, with the generous support of Ecometrica.