Tags:
create new tag
view all tags

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/\&/&amp;/go;
                  s/\</&lt;/go;
                  s/\>/&gt;/go;
!                 s/\&lt;pre\&gt;/<pre>/go;  # fix escaped <pre>
              }

  # Wiki Plugin Hook
--- 1957,1963 ----
                  s/\&/&amp;/go;
                  s/\</&lt;/go;
                  s/\>/&gt;/go;
!                 s/\&lt;pre class=verbatim\&gt;/<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>
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2004-03-30 - PeterKlausner
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.