Say I've got this source snippet in a trac ticket:

var a = 1;
var b = 2;
alert(b);

In order to have it rendered as source code, I put up the needed {{{ ... }}} block around the statement:

{{{#!js
    var a = 1;
    var b = 2;
    alert(b);
}}}

How do I achieve it that the line var b = 2; is rendered for example in red?

有帮助吗?

解决方案

Cascading WikiProcessors is not supported for external lexers like for javascript.

Trac's own processors for advanced tables and paragraphs (lend from HTML tag) are the exceptions. So the following works in some way:

{{{#!js
    var a = 1;
}}}
{{{#!div style="color:red"
{{{#!js
    var b = 2;
}}}
}}}
{{{#!js
    alert(b);
}}}

But it's breaking the code into pieces as a side-effect of cascaded div's with default styling (includes margin/padding).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top