wrap(text : string) -> [string] Reformat the single paragraph in 'text' so it fits in lines of no more than 'self.width' columns, and return a list of wrapped lines. Tabs in 'text' are expanded with string.expandtabs(), and all other whitespace characters (including
(self, text)
| 345 | # -- Public interface ---------------------------------------------- |
| 346 | |
| 347 | def wrap(self, text): |
| 348 | """wrap(text : string) -> [string] |
| 349 | |
| 350 | Reformat the single paragraph in 'text' so it fits in lines of |
| 351 | no more than 'self.width' columns, and return a list of wrapped |
| 352 | lines. Tabs in 'text' are expanded with string.expandtabs(), |
| 353 | and all other whitespace characters (including newline) are |
| 354 | converted to space. |
| 355 | """ |
| 356 | chunks = self._split_chunks(text) |
| 357 | if self.fix_sentence_endings: |
| 358 | self._fix_sentence_endings(chunks) |
| 359 | return self._wrap_chunks(chunks) |
| 360 | |
| 361 | def fill(self, text): |
| 362 | """fill(text : string) -> string |