简体   繁体   English

是否有一个用于Trac的wiki处理器来格式化和着色Python回溯?

[英]Is there a wiki processor for Trac to format and colour Python tracebacks?

Understandably many of the tickets we file in Trac contain tracebacks. 可以理解的是,我们在Trac中提交的许多票证都包含回溯。 It would be excellent if these were nicely formatted and syntax highlighted. 如果这些格式很好并且语法突出显示,那将是非常好的。

I've conducted a cursory Google search for a Python traceback wiki processor and have not found any quick hits. 我已经对Google追踪wiki处理器进行了粗略的谷歌搜索,但没有发现任何快速点击。

I'm happy to roll my own if anyone can recommend a traceback formatter (stand alone or embedded in an open source project) that outputs HTML/reStructuredText/etc. 如果有人可以推荐一个输出HTML / reStructuredText /等的追溯格式化程序(独立或嵌入在开源项目中),我很乐意推出自己的。

I don't believe you need that patch. 我不相信你需要那个补丁。 You could specify the shortcode mapping in the trac.ini , but you can also (at least in trac 0.12) just use the mime type directly: 您可以在trac.ini中指定短代码映射,但您也可以(至少在trac 0.12中)直接使用mime类型:

{{{
#!text/x-python-traceback
<traceback>
}}}

See more at http://trac.edgewall.org/wiki/TracSyntaxColoring . 有关详情,请访问http://trac.edgewall.org/wiki/TracSyntaxColoring x-python-traceback isn't in the list there, but you'll get an error previewing if trac can't handle it and it WorkedForMe. x-python-traceback不在列表中,但是如果trac无法处理它并且它可以处理WorkedForMe,则会出现错误预览。

Pygments支持语法着色Python回溯,并且有一个trac插件 ,但维基页面声称Trac 0.11原生支持Pygments。

Trac 0.11 supports Pygments but doesn't expose the pytb formatting type. Trac 0.11支持Pygments,但不公开pytb格式化类型。 Here's a patch against Trac 0.11.3 to add support for Python tracebacks. 这是针对Trac 0.11.3的补丁,用于添加对Python回溯的支持。

diff -r 5a0c5e3255b4 mimeview/api.py
--- a/mimeview/api.py   Tue Aug 11 11:33:45 2009 +1000
+++ b/mimeview/api.py   Mon Aug 24 15:13:34 2009 +1000
@@ -348,6 +348,7 @@
     'text/x-perl':            ['pl', 'pm', 'PL', 'perl'],
     'text/x-php':             ['php', 'php3', 'php4'],
     'text/x-python':          ['py', 'python'],
+    'text/x-python-traceback':['pytb'],
     'text/x-pyrex':           ['pyx'],
     'text/x-ruby':            ['rb', 'ruby'],
     'text/x-scheme':          ['scm'],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM