def wrap(self, source, outfile):
        line_no = 1
        for i, t in HtmlFormatter.wrap(self, source, outfile):
            # If this is a source code line we want to add a span tag at the
            # end.
            if i == 1:
                for error in self.errors:
                    if error['line'] == line_no:
                        try:
                            if error['inconclusive'] == 'true':
                                # only print verbose msg if it really differs
                                # from actual message
                                if error.get('verbose') and (error['verbose'] != error['msg']):
                                    index = t.rfind('\n')
                                    t = t[:index] + HTML_EXPANDABLE_INCONCLUSIVE % (error['msg'], html_escape(error['verbose'].replace("\\012", '\n'))) + t[index + 1:]
                                else:
                                    t = t.replace('\n', HTML_INCONCLUSIVE % error['msg'])
                        except KeyError:
                            if error.get('verbose') and (error['verbose'] != error['msg']):
                                index = t.rfind('\n')
                                t = t[:index] + HTML_EXPANDABLE_ERROR % (error['msg'], html_escape(error['verbose'].replace("\\012", '\n'))) + t[index + 1:]
                            else:
                                t = t.replace('\n', HTML_ERROR % error['msg'])

                line_no = line_no + 1
            yield i, t
 def wrap(self, source, outfile):
     line_no = 1
     for i, t in HtmlFormatter.wrap(self, source, outfile):
         # If this is a source code line we want to add a span tag at the
         # end.
         if i == 1:
             for error in self.errors:
                 if error['line'] == line_no:
                     t = t.replace('\n', HTML_ERROR % error['msg'])
             line_no = line_no + 1
         yield i, t
예제 #3
0
 def wrap(self, source, outfile):
     for i, (c, t) in enumerate(HtmlFormatter.wrap(self, source, outfile)):
         as_functions = self.lines.get(i - 1, None)
         if as_functions is not None:
             yield 0, ('<div title=%s style="background: #ccffcc">[%2d]' %
                       (quoteattr('as ' + ', '.join(as_functions)),
                        len(as_functions)))
         else:
             yield 0, '    '
         yield c, t
         if as_functions is not None:
             yield 0, '</div>'
예제 #4
0
 def wrap(self, source, outfile):
     for i, (c, t) in enumerate(HtmlFormatter.wrap(self, source, outfile)):
         as_functions = self.lines.get(i-1, None)
         if as_functions is not None:
             yield 0, ('<div title=%s style="background: #ccffcc">[%2d]' %
                       (quoteattr('as ' + ', '.join(as_functions)),
                        len(as_functions)))
         else:
             yield 0, '    '
         yield c, t
         if as_functions is not None:
             yield 0, '</div>'
예제 #5
0
파일: highlighter.py 프로젝트: glguy/hpaste
 def wrap(self, source, outfile):
     return self._wrap_lines(HtmlFormatter.wrap(self, source, outfile))