(file) Return to code.pl CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / code

 1 rizwank 1.1 #!/usr/bin/perl
 2             
 3             use CGI qw(:standard);
 4             use CGI::Carp qw/fatalsToBrowser/;
 5             
 6             my($cgiObj)= new CGI;
 7             print $cgiObj->header();
 8             $ARGV[0] = $cgiObj->param('name');
 9             $fileroot = "/home/rizwank/";
10             $enscript_path = "/home/rizwank/bin/enscript ";
11             
12             print $cgiObj->h3("geekymedia.com code colorizer - $ARGV[0]");
13             print "<br>All code (C) Rizwan Kassim 1998-2005 unless otherwise noted.<br>"
14             print "Insert CCL here<p>"
15             print "<hr>"
16             
17             # ok I stole directly from SyntaxHighlightingPlugin.pm for Twiki
18             
19             my $highlighted = pipeThru("enscript --color --language=html --highlight=$langs{lc($lang)} -o - -q", $text);
20                 
21             if ($highlighted =~ s/.*\<PRE\>\n(.*?)\n?\<\/PRE\>.*/$1/os)
22 rizwank 1.1 {
23                 if ($nb_option eq " numbered")
24             	{
25             	    my $line = ($nb_start eq "") ? 1 : $nb_start;
26             	    $highlighted =~ s/(^.*)/sprintf("<b><font color=\"#000000\">%5d<\/font><\/b>\t%s", $line++, $1)/mgeo
27             	}
28             	print "<table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\"><tr><td bgcolor=\"#FFFFFF\"><pre>".$highlighted."</pre><\/td><\/tr><\/table>";
29             }	
30             else
31             {
32             	print "<font color=\"red\"> Syntax Highlighting: internal error  </font>";
33             }
34                 
35                 
36             system "/home/rizwank/bin/enscript /home/rizwank/                   '--color', '--language=html', '-E' + lang, '-o',
37                                            '-', '-'),
38                                           ('sed', '-n', '/^<PRE>$/,/<\\/PRE>$/p')])

Rizwan Kassim
Powered by
ViewCVS 0.9.2