diff options
Diffstat (limited to 'pylint/reporters/ureports/html_writer.py')
-rw-r--r-- | pylint/reporters/ureports/html_writer.py | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/pylint/reporters/ureports/html_writer.py b/pylint/reporters/ureports/html_writer.py index 005ac62..c5f74d3 100644 --- a/pylint/reporters/ureports/html_writer.py +++ b/pylint/reporters/ureports/html_writer.py @@ -27,18 +27,6 @@ class HTMLWriter(BaseWriter): super(HTMLWriter, self).__init__() self.snippet = snippet - @staticmethod - def handle_attrs(layout): - """get an attribute string from layout member attributes""" - attrs = u'' - klass = getattr(layout, 'klass', None) - if klass: - attrs += u' class="%s"' % klass - nid = getattr(layout, 'id', None) - if nid: - attrs += u' id="%s"' % nid - return attrs - def begin_format(self): """begin to format a layout""" super(HTMLWriter, self).begin_format() @@ -55,20 +43,20 @@ class HTMLWriter(BaseWriter): def visit_section(self, layout): """display a section as html, using div + h[section level]""" self.section += 1 - self.writeln(u'<div%s>' % self.handle_attrs(layout)) + self.writeln(u'<div>') self.format_children(layout) self.writeln(u'</div>') self.section -= 1 def visit_title(self, layout): """display a title using <hX>""" - self.write(u'<h%s%s>' % (self.section, self.handle_attrs(layout))) + self.write(u'<h%s>' % self.section) self.format_children(layout) self.writeln(u'</h%s>' % self.section) def visit_table(self, layout): """display a table as html""" - self.writeln(u'<table%s>' % self.handle_attrs(layout)) + self.writeln(u'<table>') table_content = self.get_table_content(layout) for i, row in enumerate(table_content): if i == 0 and layout.rheaders: @@ -76,7 +64,7 @@ class HTMLWriter(BaseWriter): elif i+1 == len(table_content) and layout.rrheaders: self.writeln(u'<tr class="header">') else: - self.writeln(u'<tr class="%s">' % (i%2 and 'even' or 'odd')) + self.writeln(u'<tr class="%s">' % (u'even' if i % 2 else u'odd')) for j, cell in enumerate(row): cell = cell or u' ' if (layout.rheaders and i == 0) or \ @@ -89,30 +77,12 @@ class HTMLWriter(BaseWriter): self.writeln(u'</tr>') self.writeln(u'</table>') - def visit_list(self, layout): - """display a list as html""" - self.writeln(u'<ul%s>' % self.handle_attrs(layout)) - for row in list(self.compute_content(layout)): - self.writeln(u'<li>%s</li>' % row) - self.writeln(u'</ul>') - def visit_paragraph(self, layout): """display links (using <p>)""" self.write(u'<p>') self.format_children(layout) self.write(u'</p>') - def visit_span(self, layout): - """display links (using <p>)""" - self.write(u'<span%s>' % self.handle_attrs(layout)) - self.format_children(layout) - self.write(u'</span>') - - def visit_link(self, layout): - """display links (using <a>)""" - self.write(u' <a href="%s"%s>%s</a>' % (layout.url, - self.handle_attrs(layout), - layout.label)) def visit_verbatimtext(self, layout): """display verbatim text (using <pre>)""" self.write(u'<pre>') |