colorHtml.pl #2

  • //
  • guest/
  • fredric_fredricson/
  • P4DB/
  • main/
  • colorHtml.pl
  • View
  • Commits
  • Open Download .zip Download (887 B)
# -*- perl -*-
#
# This script is eval'ed by the fileViewer.cgi script.
#
# Input is a scalar, $FILE, that contains the file text
#
#
#################################################################
#
#  Add colour to html
#
#################################################################

my $bracketStyle="color: blue;" ;
my $firstWordStyle="color: blue;  font-weight: bold ;" ;
my $restWordsStyle="color: green;" ;

my $leftbr = "<span style=\"$bracketStyle\">&lt;</span>" ;
my $rightbr = "<span style=\"$bracketStyle\">&gt;</span>" ;

$FILE =~ s/&lt;(\/{0,1}\w+)(.*?)&gt;/$leftbr<span style=\"$firstWordStyle\">$1<\/span><span style=\"$restWordsStyle\">$2<\/span>$rightbr/sg ;
$FILE =~ s/&lt;(!.*?)&gt;/$leftbr<span style=\"font-weight: bold;\">$1<\/span>$rightbr/sg ;
$FILE =~ s/&amp;([^;]+);/<span style=\"color: blue ;\"><a title=\"&$1;\">&amp;$1;<\/a><\/span>/sg ;

#
# End
#
# Change User Description Committed
#2 4069 Fredric Fredricson P4DB: More changes on the way to 3.1
#1 1638 Fredric Fredricson P4DB: Added all (I think) files for P4DB