diff options
Diffstat (limited to 'logilab/common/ureports/text_writer.py')
-rw-r--r-- | logilab/common/ureports/text_writer.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/logilab/common/ureports/text_writer.py b/logilab/common/ureports/text_writer.py index b894c09..ae92774 100644 --- a/logilab/common/ureports/text_writer.py +++ b/logilab/common/ureports/text_writer.py @@ -3,18 +3,18 @@ # # This file is part of logilab-common. # -# logilab-common is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation, either version 2.1 of the License, or (at your option) any -# later version. +# logilab-common is free software: you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation, either version 2.1 of the License, +# or (at your option) any later version. # # logilab-common is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # -# You should have received a copy of the GNU Lesser General Public License along -# with logilab-common. If not, see <http://www.gnu.org/licenses/>. +# You should have received a copy of the GNU Lesser General Public License +# along with logilab-common. If not, see <http://www.gnu.org/licenses/>. """Text formatting drivers for ureports""" from __future__ import print_function @@ -28,6 +28,7 @@ from logilab.common.ureports import BaseWriter TITLE_UNDERLINES = [u'', u'=', u'-', u'`', u'.', u'~', u'^'] BULLETS = [u'*', u'-'] + class TextWriter(BaseWriter): """format layouts as text (ReStructured inspiration but not totally handled yet) @@ -89,7 +90,8 @@ class TextWriter(BaseWriter): format_strings = u' '.join([u'%%-%ss'] * len(cols_width)) format_strings = format_strings % tuple(cols_width) format_strings = format_strings.split(' ') - table_linesep = u'\n+' + u'+'.join([u'-'*w for w in cols_width]) + u'+\n' + table_linesep = ( + u'\n+' + u'+'.join([u'-'*w for w in cols_width]) + u'+\n') headsep = u'\n+' + u'+'.join([u'='*w for w in cols_width]) + u'+\n' # FIXME: layout.cheaders self.write(table_linesep) @@ -111,7 +113,6 @@ class TextWriter(BaseWriter): for field, value in table_content: self.write(format_string % (field, value)) - def visit_list(self, layout): """display a list layout as text""" bullet = BULLETS[self.list_level % len(BULLETS)] @@ -126,7 +127,7 @@ class TextWriter(BaseWriter): """add a hyperlink""" if layout.label != layout.url: self.write(u'`%s`_' % layout.label) - self.pending_urls.append( (layout.label, layout.url) ) + self.pending_urls.append((layout.label, layout.url)) else: self.write(layout.url) |