Syntax highlighting for PHP refuses to work on Wiki pages in my installation of Trac. It works beautifully when browsing source, but not in the Wiki. Javascript, C, and Python syntax highlighting work in the Wiki, but not PHP. Woe is me.
I have Trac 0.11.7
installed on Ubuntu 10.04
. My web server is Apache 2.2.14
.
I have manually installed Pygments. No luck. I have changed the Pygments Theme in preferences. No luck.
I have absolutely 0 errors logged in the trac
and apache
logs. Logging level for Trac is set to WARNING
(and Trac logging is working - I have other errors from earlier today). Firebug also displays no error with everything turned on (except one unrelated "Unknown property '-moz-opacity'" CSS error).
Viewing the HTML source of the page shows that the code is simply spit out as preformatted text. It does not have the tons of <span>
's all other syntax-highlighted code blocks have.
This is the code I'm using in the Wiki:
{{{
#!php
if(true)
{
echo 'hi';
}
}}}
And this is the result:
<div class="code"><pre><span class="x">if(true)
{
echo 'hi';
}
</span></pre></div>
Please help :-)
For an example of what I would expect, here's some JS code that works:
{{{
#!js
if(true)
{
alert('hi');
}
}}}
And this is the result:
<div class="code"><pre><span class="k">if</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span>
<span class="p">{</span>
<span class="nx">alert</span><span class="p">(</span><span class="s1">'hi'</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
I believe you can resolve this by including the <?php
tag:
{{{
#!php
<?php
if(true)
{
echo 'hi';
}
}}}
That works for me on my Trac wiki, anyhow. I still haven't been able to determine if this is intended behavior or a bug, though.