Question
Is there a way to use text coloring in <verbatim>?
and why can I see colors in the Preview in my installation - here at twiki.org it's not working:
<verbatim>
this stext is verbatim %RED%<- nice try!%ENDCOLOR%
</verbatim>
Environment
| TWiki version: |
TWiki20040119beta |
| TWiki plugins: |
|
| Server OS: |
Red Hat Linux |
| Web server: |
Apache/2.0.40 |
| Perl version: |
5.8.0 |
| Client OS: |
|
| Web Browser: |
|
--
StephanPulver - 30 Mar 2004
Answer
Here's my patch to this problem:
cvs diff -c -r1.18 -r1.19 TWiki.pm
Index: TWiki.pm
===================================================================
RCS file: /var/cvs/twiki/lib/TWiki.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -c -r1.18 -r1.19
*** TWiki.pm 2003/08/20 14:43:24 1.18
--- TWiki.pm 2003/09/15 13:13:03 1.19
***************
*** 1934,1940 ****
m|<pre>|i && ( $insidePRE = 1 );
m|</pre>|i && ( $insidePRE = 0 );
if( m|<verbatim>|i ) {
! s|<verbatim>|<pre>|goi;
$insideVERBATIM = 1;
}
if( m|</verbatim>|i ) {
--- 1934,1940 ----
m|<pre>|i && ( $insidePRE = 1 );
m|</pre>|i && ( $insidePRE = 0 );
if( m|<verbatim>|i ) {
! s|<verbatim>|<pre class=verbatim>|goi;
$insideVERBATIM = 1;
}
if( m|</verbatim>|i ) {
***************
*** 1957,1963 ****
s/\&/&/go;
s/\</</go;
s/\>/>/go;
! s/\<pre\>/<pre>/go; # fix escaped <pre>
}
# Wiki Plugin Hook
--- 1957,1963 ----
s/\&/&/go;
s/\</</go;
s/\>/>/go;
! s/\<pre class=verbatim\>/<pre class=verbatim>/go; # fix escaped <pre>
}
# Wiki Plugin Hook
</verbatim>
Of course, you need to include a stylesheet in the <head section of your templates.
My defintions look like this:
<verbatim>
.verbatim {
background: #eeeeee;
color: #330000;
font-size: 90%;
}
</verbatim>
-- Main.PeterKlausner - 30 Mar 2004
</verbatim>