当前位置: 首页>>代码示例>>Python>>正文


Python HtmlFormatter.wrap方法代码示例

本文整理汇总了Python中pygments.formatters.HtmlFormatter.wrap方法的典型用法代码示例。如果您正苦于以下问题:Python HtmlFormatter.wrap方法的具体用法?Python HtmlFormatter.wrap怎么用?Python HtmlFormatter.wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygments.formatters.HtmlFormatter的用法示例。


在下文中一共展示了HtmlFormatter.wrap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wrap

# 需要导入模块: from pygments.formatters import HtmlFormatter [as 别名]
# 或者: from pygments.formatters.HtmlFormatter import wrap [as 别名]
    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
开发者ID:ClausSteuer,项目名称:LineSegmentsIntersectionSplitter,代码行数:28,代码来源:cppcheck-htmlreport.py

示例2: wrap

# 需要导入模块: from pygments.formatters import HtmlFormatter [as 别名]
# 或者: from pygments.formatters.HtmlFormatter import wrap [as 别名]
 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
开发者ID:leibnewton,项目名称:codestylechecker,代码行数:13,代码来源:cpplint_htmlreport.py

示例3: wrap

# 需要导入模块: from pygments.formatters import HtmlFormatter [as 别名]
# 或者: from pygments.formatters.HtmlFormatter import wrap [as 别名]
 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>'
开发者ID:7924102,项目名称:numpy,代码行数:14,代码来源:c_coverage_report.py

示例4: wrap

# 需要导入模块: from pygments.formatters import HtmlFormatter [as 别名]
# 或者: from pygments.formatters.HtmlFormatter import wrap [as 别名]
 def wrap(self, source, outfile):
     return self._wrap_lines(HtmlFormatter.wrap(self, source, outfile))
开发者ID:glguy,项目名称:hpaste,代码行数:4,代码来源:highlighter.py


注:本文中的pygments.formatters.HtmlFormatter.wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。