【问题标题】:trac syntax highlitings on commentstrac 注释上的语法高亮
【发布时间】:2015-04-13 10:27:28
【问题描述】:

我在我的 trac 服务器上安装了 pygments。但是票证上的代码没有颜色。

这就是我在 trac.ini 上的内容:

[mimeviewer]
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb,text/x-               java:java,application/x-python:py python sage
pygments_default_style = trac
pygments_modes = text/plain:java:7
silvercity_modes =
tab_width = 8
treat_as_binary = application/octet-stream,application/pdf,application/postscript,application/msword,application/rtf,

这就是我在 cmets 中写的: {{{ #!java if(var=='true') { a ='hi'; } }}}

非常感谢您的帮助

【问题讨论】:

    标签: java syntax-highlighting highlight trac pygments


    【解决方案1】:

    尚不清楚您的标记格式是否正确。请尝试:

    {{{#!java 
    if(var=='true') { a ='hi'; }
    }}}
    

    要确认 Pygments 安装正确,请检查about 页面并确保版本列在系统信息表中。

    哪个版本的 Trac 和哪个版本的 Pygments?您需要带有 Pygments 2.x 的 Trac 1.0.3 或更高版本(最好是 1.0.4)。见#11796。如果您使用较早版本的 Trac,则应安装 Pygments 1.6

    【讨论】:

    • 你好,是的,代码没问题。 Trac 版本为 0.12.3 Pygments 未在系统信息表中列出。你知道我怎么加吗?
    • 使用您在[#11961](trac.edgewall.org/ticket/11961)中报告的信息:删除/usr/local/lib64/python2.6/site-packages/Pygments-2.0.2-py2.6.eggeasy_install pygments==1.6
    猜你喜欢
    • 2011-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-20
    • 1970-01-01
    • 2020-06-19
    • 2018-08-06
    • 1970-01-01
    相关资源
    最近更新 更多