(self, text)
return result
Wrap all paragraphs in the provided text.
Wrap all paragraphs in the provided text.
Wrap all paragraphs in the provided text .
def optwrap(self, text):
        """Wrap all paragraphs in the provided text."""
        if not self.body_width:
            return text

        assert wrap, "Requires Python 2.3."
        result = ''
        newlines = 0
        for para in text.split("\n"):
            if len(para) > 0:
                if not skipwrap(para):
                    for line in wrap(para, self.body_width):
                        result += line + "\n"
                    result += "\n"
                    newlines = 2
                else:
                    if not onlywhite(para):
                        result += para + "\n"
                        newlines = 1
            else:
                if newlines < 2:
                    result += "\n"
                    newlines += 1
        return result
def optwrap ( self , text ) : if not self . body_width : return text assert wrap , "Requires Python 2.3." result = '' newlines = 0 for para in text . split ( "\n" ) : if len ( para ) > 0 : if not skipwrap ( para ) : for line in wrap ( para , self . body_width ) : result += line + "\n" result += "\n" newlines = 2 else : if not onlywhite ( para ) : result += para + "\n" newlines = 1 else : if newlines < 2 : result += "\n" newlines += 1 return result