Home | Trees | Indices | Help |
|
---|
|
Formats long strings so that they neatly fit within a certain width without words being split across lines. This is a singleton class, invoke as:
from wsatools.Utilities import WordWrapper for line in lines: print(WordWrapper.wrap(line))
To Do: Instead of not wrapping pre-formatted lines, handle the case of a new-line character when calculating the overlap.
|
|||
Inherited from |
|
|||
|
|||
str |
|
||
str |
|
|
|||
Inherited from |
|
Returns supplied line with neatly placed linebreaks to wrap the line within a certain width. If the line already contains line breaks or is within the width specified by WordWrapper.wrapWidth then it remains unaffected. If a WordWrapper.indent value is supplied then it is assumed that the first character in the line is located at the column number equal to the WordWrapper.indent value. Wrapped lines will then have a gap after each line-break to maintain the indentation.
|
Recursive calls to this function with the next line of text to be wrapped appends lines to WordWrapper._wrappedLines truncated to the width specified by WordWrapper.wrapWidth. The remaining text is used as the input to the function until there is no more overrun, and the fully wrapped text is returned.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Sep 8 15:46:57 2014 | http://epydoc.sourceforge.net |