) {
chomp $_;
++$i;
next if $i < 3;
# i wanted to use image but they say i can't use img tag inside pre :/
$_ =~ s/(.{$max}.)/$1\n+/g;
$_ =~ s/([&><\"])/&$html{$1};/g;
if ( $_ =~ m/^\@\@\s\-(\d+)\,(\d+)\s\+(\d+)\,(\d+)\s\@\@/ ) {
( $close_pre ) ? ( $html .= "\n" ) : ( $close_pre = 1 );
$html .= qq~
@ < code class = "red">$1,$2< /code > < code class = "blue">$3,$4< /code > @~;
$_ =~ s/^\@\@(?:.+)\@\@/\n/g;
}
##
# removed lines in blue color.
if ( $_ =~ m/^\-/ && !$blue ) {
$html .= "";
$blue = 1;
}
elsif ( $_ =~ m/^[^\-]/ && $blue ) {
$html .= "<\/span>";
$blue = 0;
}
##
# added lines in red color.
if ( $_ =~ m/^\+/ && !$red ) {
$html .= "";
$red = 1;
}
elsif ( $_ =~ m/^[^\+]/ && $red ) {
$html .= "<\/span>";
$red = 0;
}
$_ =~ s/^[\+\-]$//g;
$_ =~ s/^([\+\-])/ /g;
$html .= $_ . "\n";
}
close (FILE);
$html .= "\n";
# finally print the whole generated html.
print $html;
exit;