HTML Source Code Text Source Code
Copy and paste log here:

Output format: Wikispaces Wikidot Mediawiki Tumblr Plain Text
Input format: IRC (ignore color/bold) IRC (parse color/bold) Skype Roll20 "var messages = ..."
(Note: IRC color/bold tags must be completely inside, or completely outside, color tags)
Note: if you are using a logging tool that has never been tested with this convertor before, check the converted logs for possible bugs. It is not this tool's provider's fault if you delete your logs after a bad conversion, losing the record of what you wished to post.
#!/usr/bin/perl

use CGI;

sub parse_quoted_line {
  my ($line,$start_italic,$end_italic) = @_;
  my $new_line = "";
  my $count = 0;
  my $italic_previous = 0;
  foreach my $char (split(//,$line)) {
    if ($char eq "\"") {
      if ($count % 2 == 1) {
        $new_line .= "\" " . $start_italic;
        $italic_previous = 1;
      } else {
        $new_line =~ s/\s+$//;
        $new_line .= $end_italic . " \"";
      }
      $count++;
    } elsif ($char =~ /\s/) {
      if (!$italic_previous) {
        $new_line .= " ";
      }
    } else {
      $italic_previous = 0;
      $new_line .= $char;
    }
  }
  if ($count % 2 != 1) {
    if ($new_line =~ /$start_italic$/) {
      $new_line =~ s/$start_italic$//;
      $new_line =~ s/\s+$//;
    } else {
      $new_line =~ s/\s+$//;
      $new_line .= $end_italic;
    }
  }
  if ($new_line =~ /^$end_italic/) {
    $new_line =~ s/^$end_italic//;
  } else {
    $new_line =~ s/\s+$//;
    $new_line = $start_italic . $new_line;
  }
  return $new_line;
}

sub normalize_name {
  my ($name) = @_;
  $name =~ s/^[\+\@ ]//;
  $name =~ s/_/ /gs;
  $name =~ s/^\s+//;
  $name =~ s/\s+$//;
  return $name;
}

my $query = new CGI;
my $text = $query->param("text");

if ($query->param("getsourcetext") == 1) {
  print "Content-Type: text/plain\r\n\r\n";
} else {
  print "Content-Type: text/html\r\n\r\n" .
    "<html><head><title>Log Convertor</title></head>\n" .
    "<body><a href=ffirclogconvert.cgi?getsource=1>HTML Source Code</a>\n" .
    "<a href=ffirclogconvert.cgi?getsourcetext=1>Text Source Code</a><br>\n" .
    "Copy and paste log here:\n" .
    "<form action=ffirclogconvert.cgi method=post>" .
    "<textarea rows=10 cols=80 name=text></textarea><br>\n" .
    "Output format: <input type=radio name=output value=wikispaces checked=1>" .
    " Wikispaces <input type=radio name=output value=wikidot> Wikidot " .
    "<input type=radio name=output value=mediawiki> Mediawiki <input " .
    "type=radio name=output value=tumblr> Tumblr <input type=radio " .
    "name=output value=text> Plain Text<br>\nInput format: <input type=radio " .
    "name=input value=irc checked=1> IRC (ignore color/bold) <input " .
    "type=radio name=input value=irc_tags> IRC (parse color/bold) <input " .
    "type=radio name=input value=skype> Skype <input type=radio name=input " .
    "value=roll20> Roll20 &quot;var messages = ...&quot;\n<br>" .
    "(Note: IRC color/bold tags must be completely inside, or completely " .
    "outside,\ncolor tags)<br>\n<input type=submit value='Convert Logs'>" .
    "</form>\n<b>Note: if you are using a logging tool that has never been " .
    "tested with\nthis convertor before, check the converted logs for " .
    "possible bugs.  It\nis not this tool's provider's fault if you delete " .
    "your logs after a bad\nconversion, losing the record of what you wished " .
    "to post.</b>\n";
}
if ($query->param("getsource") == 1 || $query->param("getsourcetext") == 1) {
  if ($query->param("getsource") == 1) {
    print "<hr><pre>\n";
  }
  open(RD,"<",$ENV{"SCRIPT_FILENAME"});
  while (my $line = readline(RD)) {
    if ($query->param("getsource") == 1) {
      $line =~ s/&/&amp;/gs;
      $line =~ s/</&lt;/gs;
      $line =~ s/>/&gt;/gs;
    }
    print $line;
  }
  close(RD);
  if ($query->param("getsource") == 1) {
    print "</pre>";
  }
} elsif ($text ne "") {
  print "<hr><pre>\n";
  my $prev_line = "";
  my $prev_head = "";
  my $out = "";
  $text =~ s/(\r|\n)+  //gs;
  $eol = "\n"; # End Of Line
  $star = "\\\*";
  $start_bold = "**";
  $end_bold = $start_bold;
  $start_italic = "//";
  $end_italic = $start_italic;
  if ($query->param("output") eq "mediawiki") {
    $eol = "\n\n";
    $start_bold = "'''";
    $end_bold = $start_bold;
    $start_italic = "''";
    $end_italic = $start_italic;
  } elsif ($query->param("output") eq "tumblr") {
    $eol = "&lt;/p&gt;\n";
    $start_bold = "&lt;b&gt;";
    $end_bold = "&lt;/b&gt;";
    $start_italic = "&lt;i&gt;";
    $end_italic = "&lt;/i&gt;";
  } elsif ($query->param("output") eq "text") {
    $eol = "\n\n";
    $start_bold = "";
    $end_bold = "";
    $start_italic = "";
    $end_italic = "";
  }
  if ($query->param("input") eq "roll20") {
    my $new_text = "";
    while ($text =~
/^(.*?)\{\"type\":\"(.*?)\",\"playerid\":\"(.*?)\",\"who\":\"(.*?)\",\"content\":\"(.*?)\"\}(.*)/
    ) {
      my $line_type = $2;
      my $line_who = $4;
      my $line = $5;
      $text = $6;
      $line_who =~ s/\\"/"/gs;
      $line =~ s/\\"/"/gs;
      if ($line_type eq "general") {
        $line =~ s/\\"/"/gs;
        $new_text .= "<" . $line_who . "> " . $line . "\n";
      } elsif ($line_type eq "emote") {
        $new_text .= "* " . $line_who . " " . $line . "\n";
      } elsif ($line_type eq "rollresult" && $line =~ /(.*?)\|(.*?)\|(.*)/) {
        my $dice = $1;
        my $roll = $2;
        my $result = $3;
        $roll =~ s/[{}@#]//gs;
        $new_text .= "* " . $line_who . " rolled " . $dice . " and got " .
          $roll . "=" . $result . "\n";
      }
    }
    $text = $new_text;
  }
  foreach my $line (split(/\n/,$text)) {
    $out = "";
    if ($query->param("input") eq "irc_tags") {
      $line =~ s/^(\x03)([0-9,]+)//; # get rid of superfluous start-of-line tags
      $line =~
    s/(\x03)(00,00)/<span style="color: #FFFFFF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(00,01)/<span style="color: #FFFFFF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(00,02)/<span style="color: #FFFFFF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(00,03)/<span style="color: #FFFFFF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(00,04)/<span style="color: #FFFFFF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(00,05)/<span style="color: #FFFFFF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(00,06)/<span style="color: #FFFFFF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(00,07)/<span style="color: #FFFFFF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(00,08)/<span style="color: #FFFFFF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(00,09)/<span style="color: #FFFFFF; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(00,10)/<span style="color: #FFFFFF; background-color: #008080">/gs;
      $line =~
    s/(\x03)(00,11)/<span style="color: #FFFFFF; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(00,12)/<span style="color: #FFFFFF; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(00,13)/<span style="color: #FFFFFF; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(00,14)/<span style="color: #FFFFFF; background-color: #808080">/gs;
      $line =~
    s/(\x03)(00,15)/<span style="color: #FFFFFF; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(00,0)/<span style="color: #FFFFFF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(00,1)/<span style="color: #FFFFFF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(00,2)/<span style="color: #FFFFFF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(00,3)/<span style="color: #FFFFFF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(00,4)/<span style="color: #FFFFFF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(00,5)/<span style="color: #FFFFFF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(00,6)/<span style="color: #FFFFFF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(00,7)/<span style="color: #FFFFFF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(00,8)/<span style="color: #FFFFFF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(00,9)/<span style="color: #FFFFFF; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(00)/<span style="color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(01,00)/<span style="color: #000000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(01,01)/<span style="color: #000000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(01,02)/<span style="color: #000000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(01,03)/<span style="color: #000000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(01,04)/<span style="color: #000000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(01,05)/<span style="color: #000000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(01,06)/<span style="color: #000000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(01,07)/<span style="color: #000000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(01,08)/<span style="color: #000000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(01,09)/<span style="color: #000000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(01,10)/<span style="color: #000000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(01,11)/<span style="color: #000000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(01,12)/<span style="color: #000000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(01,13)/<span style="color: #000000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(01,14)/<span style="color: #000000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(01,15)/<span style="color: #000000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(01,0)/<span style="color: #000000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(01,1)/<span style="color: #000000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(01,2)/<span style="color: #000000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(01,3)/<span style="color: #000000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(01,4)/<span style="color: #000000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(01,5)/<span style="color: #000000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(01,6)/<span style="color: #000000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(01,7)/<span style="color: #000000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(01,8)/<span style="color: #000000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(01,9)/<span style="color: #000000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(01)/<span style="color: #000000">/gs;
      $line =~
    s/(\x03)(02,00)/<span style="color: #000080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(02,01)/<span style="color: #000080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(02,02)/<span style="color: #000080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(02,03)/<span style="color: #000080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(02,04)/<span style="color: #000080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(02,05)/<span style="color: #000080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(02,06)/<span style="color: #000080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(02,07)/<span style="color: #000080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(02,08)/<span style="color: #000080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(02,09)/<span style="color: #000080; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(02,10)/<span style="color: #000080; background-color: #008080">/gs;
      $line =~
    s/(\x03)(02,11)/<span style="color: #000080; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(02,12)/<span style="color: #000080; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(02,13)/<span style="color: #000080; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(02,14)/<span style="color: #000080; background-color: #808080">/gs;
      $line =~
    s/(\x03)(02,15)/<span style="color: #000080; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(02,0)/<span style="color: #000080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(02,1)/<span style="color: #000080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(02,2)/<span style="color: #000080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(02,3)/<span style="color: #000080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(02,4)/<span style="color: #000080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(02,5)/<span style="color: #000080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(02,6)/<span style="color: #000080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(02,7)/<span style="color: #000080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(02,8)/<span style="color: #000080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(02,9)/<span style="color: #000080; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(02)/<span style="color: #000080">/gs;
      $line =~
    s/(\x03)(03,00)/<span style="color: #008000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(03,01)/<span style="color: #008000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(03,02)/<span style="color: #008000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(03,03)/<span style="color: #008000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(03,04)/<span style="color: #008000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(03,05)/<span style="color: #008000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(03,06)/<span style="color: #008000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(03,07)/<span style="color: #008000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(03,08)/<span style="color: #008000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(03,09)/<span style="color: #008000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(03,10)/<span style="color: #008000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(03,11)/<span style="color: #008000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(03,12)/<span style="color: #008000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(03,13)/<span style="color: #008000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(03,14)/<span style="color: #008000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(03,15)/<span style="color: #008000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(03,0)/<span style="color: #008000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(03,1)/<span style="color: #008000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(03,2)/<span style="color: #008000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(03,3)/<span style="color: #008000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(03,4)/<span style="color: #008000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(03,5)/<span style="color: #008000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(03,6)/<span style="color: #008000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(03,7)/<span style="color: #008000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(03,8)/<span style="color: #008000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(03,9)/<span style="color: #008000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(03)/<span style="color: #008000">/gs;
      $line =~
    s/(\x03)(04,00)/<span style="color: #FF0000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(04,01)/<span style="color: #FF0000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(04,02)/<span style="color: #FF0000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(04,03)/<span style="color: #FF0000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(04,04)/<span style="color: #FF0000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(04,05)/<span style="color: #FF0000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(04,06)/<span style="color: #FF0000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(04,07)/<span style="color: #FF0000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(04,08)/<span style="color: #FF0000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(04,09)/<span style="color: #FF0000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(04,10)/<span style="color: #FF0000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(04,11)/<span style="color: #FF0000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(04,12)/<span style="color: #FF0000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(04,13)/<span style="color: #FF0000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(04,14)/<span style="color: #FF0000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(04,15)/<span style="color: #FF0000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(04,0)/<span style="color: #FF0000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(04,1)/<span style="color: #FF0000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(04,2)/<span style="color: #FF0000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(04,3)/<span style="color: #FF0000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(04,4)/<span style="color: #FF0000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(04,5)/<span style="color: #FF0000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(04,6)/<span style="color: #FF0000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(04,7)/<span style="color: #FF0000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(04,8)/<span style="color: #FF0000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(04,9)/<span style="color: #FF0000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(04)/<span style="color: #FF0000">/gs;
      $line =~
    s/(\x03)(05,00)/<span style="color: #800000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(05,01)/<span style="color: #800000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(05,02)/<span style="color: #800000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(05,03)/<span style="color: #800000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(05,04)/<span style="color: #800000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(05,05)/<span style="color: #800000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(05,06)/<span style="color: #800000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(05,07)/<span style="color: #800000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(05,08)/<span style="color: #800000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(05,09)/<span style="color: #800000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(05,10)/<span style="color: #800000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(05,11)/<span style="color: #800000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(05,12)/<span style="color: #800000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(05,13)/<span style="color: #800000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(05,14)/<span style="color: #800000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(05,15)/<span style="color: #800000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(05,0)/<span style="color: #800000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(05,1)/<span style="color: #800000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(05,2)/<span style="color: #800000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(05,3)/<span style="color: #800000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(05,4)/<span style="color: #800000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(05,5)/<span style="color: #800000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(05,6)/<span style="color: #800000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(05,7)/<span style="color: #800000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(05,8)/<span style="color: #800000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(05,9)/<span style="color: #800000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(05)/<span style="color: #800000">/gs;
      $line =~
    s/(\x03)(06,00)/<span style="color: #800080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(06,01)/<span style="color: #800080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(06,02)/<span style="color: #800080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(06,03)/<span style="color: #800080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(06,04)/<span style="color: #800080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(06,05)/<span style="color: #800080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(06,06)/<span style="color: #800080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(06,07)/<span style="color: #800080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(06,08)/<span style="color: #800080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(06,09)/<span style="color: #800080; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(06,10)/<span style="color: #800080; background-color: #008080">/gs;
      $line =~
    s/(\x03)(06,11)/<span style="color: #800080; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(06,12)/<span style="color: #800080; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(06,13)/<span style="color: #800080; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(06,14)/<span style="color: #800080; background-color: #808080">/gs;
      $line =~
    s/(\x03)(06,15)/<span style="color: #800080; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(06,0)/<span style="color: #800080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(06,1)/<span style="color: #800080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(06,2)/<span style="color: #800080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(06,3)/<span style="color: #800080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(06,4)/<span style="color: #800080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(06,5)/<span style="color: #800080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(06,6)/<span style="color: #800080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(06,7)/<span style="color: #800080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(06,8)/<span style="color: #800080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(06,9)/<span style="color: #800080; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(06)/<span style="color: #800080">/gs;
      $line =~
    s/(\x03)(07,00)/<span style="color: #FF8000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(07,01)/<span style="color: #FF8000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(07,02)/<span style="color: #FF8000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(07,03)/<span style="color: #FF8000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(07,04)/<span style="color: #FF8000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(07,05)/<span style="color: #FF8000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(07,06)/<span style="color: #FF8000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(07,07)/<span style="color: #FF8000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(07,08)/<span style="color: #FF8000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(07,09)/<span style="color: #FF8000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(07,10)/<span style="color: #FF8000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(07,11)/<span style="color: #FF8000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(07,12)/<span style="color: #FF8000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(07,13)/<span style="color: #FF8000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(07,14)/<span style="color: #FF8000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(07,15)/<span style="color: #FF8000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(07,0)/<span style="color: #FF8000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(07,1)/<span style="color: #FF8000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(07,2)/<span style="color: #FF8000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(07,3)/<span style="color: #FF8000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(07,4)/<span style="color: #FF8000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(07,5)/<span style="color: #FF8000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(07,6)/<span style="color: #FF8000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(07,7)/<span style="color: #FF8000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(07,8)/<span style="color: #FF8000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(07,9)/<span style="color: #FF8000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(07)/<span style="color: #FF8000">/gs;
      $line =~
    s/(\x03)(08,00)/<span style="color: #FFFF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(08,01)/<span style="color: #FFFF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(08,02)/<span style="color: #FFFF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(08,03)/<span style="color: #FFFF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(08,04)/<span style="color: #FFFF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(08,05)/<span style="color: #FFFF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(08,06)/<span style="color: #FFFF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(08,07)/<span style="color: #FFFF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(08,08)/<span style="color: #FFFF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(08,09)/<span style="color: #FFFF00; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(08,10)/<span style="color: #FFFF00; background-color: #008080">/gs;
      $line =~
    s/(\x03)(08,11)/<span style="color: #FFFF00; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(08,12)/<span style="color: #FFFF00; background-color: #0000FF">/gs;
       $line =~
    s/(\x03)(08,13)/<span style="color: #FFFF00; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(08,14)/<span style="color: #FFFF00; background-color: #808080">/gs;
      $line =~
    s/(\x03)(08,15)/<span style="color: #FFFF00; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(08,0)/<span style="color: #FFFF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(08,1)/<span style="color: #FFFF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(08,2)/<span style="color: #FFFF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(08,3)/<span style="color: #FFFF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(08,4)/<span style="color: #FFFF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(08,5)/<span style="color: #FFFF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(08,6)/<span style="color: #FFFF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(08,7)/<span style="color: #FFFF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(08,8)/<span style="color: #FFFF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(08,9)/<span style="color: #FFFF00; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(08)/<span style="color: #FFFF00">/gs;
      $line =~
    s/(\x03)(09,00)/<span style="color: #00FF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(09,01)/<span style="color: #00FF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(09,02)/<span style="color: #00FF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(09,03)/<span style="color: #00FF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(09,04)/<span style="color: #00FF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(09,05)/<span style="color: #00FF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(09,06)/<span style="color: #00FF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(09,07)/<span style="color: #00FF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(09,08)/<span style="color: #00FF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(09,09)/<span style="color: #00FF00; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(09,10)/<span style="color: #00FF00; background-color: #008080">/gs;
      $line =~
    s/(\x03)(09,11)/<span style="color: #00FF00; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(09,12)/<span style="color: #00FF00; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(09,13)/<span style="color: #00FF00; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(09,14)/<span style="color: #00FF00; background-color: #808080">/gs;
      $line =~
    s/(\x03)(09,15)/<span style="color: #00FF00; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(09,0)/<span style="color: #00FF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(09,1)/<span style="color: #00FF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(09,2)/<span style="color: #00FF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(09,3)/<span style="color: #00FF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(09,4)/<span style="color: #00FF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(09,5)/<span style="color: #00FF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(09,6)/<span style="color: #00FF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(09,7)/<span style="color: #00FF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(09,8)/<span style="color: #00FF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(09,9)/<span style="color: #00FF00; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(09)/<span style="color: #00FF00">/gs;
      $line =~
    s/(\x03)(10,00)/<span style="color: #008080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(10,01)/<span style="color: #008080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(10,02)/<span style="color: #008080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(10,03)/<span style="color: #008080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(10,04)/<span style="color: #008080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(10,05)/<span style="color: #008080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(10,06)/<span style="color: #008080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(10,07)/<span style="color: #008080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(10,08)/<span style="color: #008080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(10,09)/<span style="color: #008080; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(10,10)/<span style="color: #008080; background-color: #008080">/gs;
      $line =~
    s/(\x03)(10,11)/<span style="color: #008080; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(10,12)/<span style="color: #008080; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(10,13)/<span style="color: #008080; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(10,14)/<span style="color: #008080; background-color: #808080">/gs;
      $line =~
    s/(\x03)(10,15)/<span style="color: #008080; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(10,0)/<span style="color: #008080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(10,1)/<span style="color: #008080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(10,2)/<span style="color: #008080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(10,3)/<span style="color: #008080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(10,4)/<span style="color: #008080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(10,5)/<span style="color: #008080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(10,6)/<span style="color: #008080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(10,7)/<span style="color: #008080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(10,8)/<span style="color: #008080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(10,9)/<span style="color: #008080; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(10)/<span style="color: #008080">/gs;
      $line =~
    s/(\x03)(11,00)/<span style="color: #00FFFF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(11,01)/<span style="color: #00FFFF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(11,02)/<span style="color: #00FFFF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(11,03)/<span style="color: #00FFFF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(11,04)/<span style="color: #00FFFF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(11,05)/<span style="color: #00FFFF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(11,06)/<span style="color: #00FFFF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(11,07)/<span style="color: #00FFFF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(11,08)/<span style="color: #00FFFF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(11,09)/<span style="color: #00FFFF; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(11,10)/<span style="color: #00FFFF; background-color: #008080">/gs;
      $line =~
    s/(\x03)(11,11)/<span style="color: #00FFFF; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(11,12)/<span style="color: #00FFFF; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(11,13)/<span style="color: #00FFFF; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(11,14)/<span style="color: #00FFFF; background-color: #808080">/gs;
      $line =~
    s/(\x03)(11,15)/<span style="color: #00FFFF; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(11,0)/<span style="color: #00FFFF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(11,1)/<span style="color: #00FFFF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(11,2)/<span style="color: #00FFFF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(11,3)/<span style="color: #00FFFF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(11,4)/<span style="color: #00FFFF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(11,5)/<span style="color: #00FFFF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(11,6)/<span style="color: #00FFFF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(11,7)/<span style="color: #00FFFF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(11,8)/<span style="color: #00FFFF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(11,9)/<span style="color: #00FFFF; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(11)/<span style="color: #00FFFF">/gs;
      $line =~
    s/(\x03)(12,00)/<span style="color: #0000FF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(12,01)/<span style="color: #0000FF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(12,02)/<span style="color: #0000FF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(12,03)/<span style="color: #0000FF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(12,04)/<span style="color: #0000FF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(12,05)/<span style="color: #0000FF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(12,06)/<span style="color: #0000FF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(12,07)/<span style="color: #0000FF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(12,08)/<span style="color: #0000FF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(12,09)/<span style="color: #0000FF; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(12,10)/<span style="color: #0000FF; background-color: #008080">/gs;
      $line =~
    s/(\x03)(12,11)/<span style="color: #0000FF; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(12,12)/<span style="color: #0000FF; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(12,13)/<span style="color: #0000FF; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(12,14)/<span style="color: #0000FF; background-color: #808080">/gs;
      $line =~
    s/(\x03)(12,15)/<span style="color: #0000FF; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(12,0)/<span style="color: #0000FF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(12,1)/<span style="color: #0000FF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(12,2)/<span style="color: #0000FF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(12,3)/<span style="color: #0000FF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(12,4)/<span style="color: #0000FF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(12,5)/<span style="color: #0000FF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(12,6)/<span style="color: #0000FF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(12,7)/<span style="color: #0000FF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(12,8)/<span style="color: #0000FF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(12,9)/<span style="color: #0000FF; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(12)/<span style="color: #0000FF">/gs;
      $line =~
    s/(\x03)(13,00)/<span style="color: #FF00FF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(13,01)/<span style="color: #FF00FF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(13,02)/<span style="color: #FF00FF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(13,03)/<span style="color: #FF00FF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(13,04)/<span style="color: #FF00FF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(13,05)/<span style="color: #FF00FF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(13,06)/<span style="color: #FF00FF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(13,07)/<span style="color: #FF00FF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(13,08)/<span style="color: #FF00FF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(13,09)/<span style="color: #FF00FF; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(13,10)/<span style="color: #FF00FF; background-color: #008080">/gs;
      $line =~
    s/(\x03)(13,11)/<span style="color: #FF00FF; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(13,12)/<span style="color: #FF00FF; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(13,13)/<span style="color: #FF00FF; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(13,14)/<span style="color: #FF00FF; background-color: #808080">/gs;
      $line =~
    s/(\x03)(13,15)/<span style="color: #FF00FF; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(13,0)/<span style="color: #FF00FF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(13,1)/<span style="color: #FF00FF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(13,2)/<span style="color: #FF00FF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(13,3)/<span style="color: #FF00FF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(13,4)/<span style="color: #FF00FF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(13,5)/<span style="color: #FF00FF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(13,6)/<span style="color: #FF00FF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(13,7)/<span style="color: #FF00FF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(13,8)/<span style="color: #FF00FF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(13,9)/<span style="color: #FF00FF; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(13)/<span style="color: #FF00FF">/gs;
      $line =~
    s/(\x03)(14,00)/<span style="color: #808080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(14,01)/<span style="color: #808080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(14,02)/<span style="color: #808080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(14,03)/<span style="color: #808080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(14,04)/<span style="color: #808080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(14,05)/<span style="color: #808080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(14,06)/<span style="color: #808080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(14,07)/<span style="color: #808080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(14,08)/<span style="color: #808080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(14,09)/<span style="color: #808080; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(14,10)/<span style="color: #808080; background-color: #008080">/gs;
      $line =~
    s/(\x03)(14,11)/<span style="color: #808080; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(14,12)/<span style="color: #808080; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(14,13)/<span style="color: #808080; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(14,14)/<span style="color: #808080; background-color: #808080">/gs;
      $line =~
    s/(\x03)(14,15)/<span style="color: #808080; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(14,0)/<span style="color: #808080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(14,1)/<span style="color: #808080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(14,2)/<span style="color: #808080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(14,3)/<span style="color: #808080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(14,4)/<span style="color: #808080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(14,5)/<span style="color: #808080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(14,6)/<span style="color: #808080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(14,7)/<span style="color: #808080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(14,8)/<span style="color: #808080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(14,9)/<span style="color: #808080; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(14)/<span style="color: #808080">/gs;
      $line =~
    s/(\x03)(15,00)/<span style="color: #B0B0B0; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(15,01)/<span style="color: #B0B0B0; background-color: #000000">/gs;
      $line =~
    s/(\x03)(15,02)/<span style="color: #B0B0B0; background-color: #000080">/gs;
      $line =~
    s/(\x03)(15,03)/<span style="color: #B0B0B0; background-color: #008000">/gs;
      $line =~
    s/(\x03)(15,04)/<span style="color: #B0B0B0; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(15,05)/<span style="color: #B0B0B0; background-color: #800000">/gs;
      $line =~
    s/(\x03)(15,06)/<span style="color: #B0B0B0; background-color: #800080">/gs;
      $line =~
    s/(\x03)(15,07)/<span style="color: #B0B0B0; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(15,08)/<span style="color: #B0B0B0; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(15,09)/<span style="color: #B0B0B0; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(15,10)/<span style="color: #B0B0B0; background-color: #008080">/gs;
      $line =~
    s/(\x03)(15,11)/<span style="color: #B0B0B0; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(15,12)/<span style="color: #B0B0B0; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(15,13)/<span style="color: #B0B0B0; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(15,14)/<span style="color: #B0B0B0; background-color: #808080">/gs;
      $line =~
    s/(\x03)(15,15)/<span style="color: #B0B0B0; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(15,0)/<span style="color: #B0B0B0; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(15,1)/<span style="color: #B0B0B0; background-color: #000000">/gs;
      $line =~
    s/(\x03)(15,2)/<span style="color: #B0B0B0; background-color: #000080">/gs;
      $line =~
    s/(\x03)(15,3)/<span style="color: #B0B0B0; background-color: #008000">/gs;
      $line =~
    s/(\x03)(15,4)/<span style="color: #B0B0B0; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(15,5)/<span style="color: #B0B0B0; background-color: #800000">/gs;
      $line =~
    s/(\x03)(15,6)/<span style="color: #B0B0B0; background-color: #800080">/gs;
      $line =~
    s/(\x03)(15,7)/<span style="color: #B0B0B0; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(15,8)/<span style="color: #B0B0B0; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(15,9)/<span style="color: #B0B0B0; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(15)/<span style="color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(0,00)/<span style="color: #FFFFFF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(0,01)/<span style="color: #FFFFFF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(0,02)/<span style="color: #FFFFFF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(0,03)/<span style="color: #FFFFFF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(0,04)/<span style="color: #FFFFFF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(0,05)/<span style="color: #FFFFFF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(0,06)/<span style="color: #FFFFFF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(0,07)/<span style="color: #FFFFFF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(0,08)/<span style="color: #FFFFFF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(0,09)/<span style="color: #FFFFFF; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(0,10)/<span style="color: #FFFFFF; background-color: #008080">/gs;
      $line =~
    s/(\x03)(0,11)/<span style="color: #FFFFFF; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(0,12)/<span style="color: #FFFFFF; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(0,13)/<span style="color: #FFFFFF; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(0,14)/<span style="color: #FFFFFF; background-color: #808080">/gs;
      $line =~
    s/(\x03)(0,15)/<span style="color: #FFFFFF; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(0,0)/<span style="color: #FFFFFF; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(0,1)/<span style="color: #FFFFFF; background-color: #000000">/gs;
      $line =~
    s/(\x03)(0,2)/<span style="color: #FFFFFF; background-color: #000080">/gs;
      $line =~
    s/(\x03)(0,3)/<span style="color: #FFFFFF; background-color: #008000">/gs;
      $line =~
    s/(\x03)(0,4)/<span style="color: #FFFFFF; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(0,5)/<span style="color: #FFFFFF; background-color: #800000">/gs;
      $line =~
    s/(\x03)(0,6)/<span style="color: #FFFFFF; background-color: #800080">/gs;
      $line =~
    s/(\x03)(0,7)/<span style="color: #FFFFFF; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(0,8)/<span style="color: #FFFFFF; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(0,9)/<span style="color: #FFFFFF; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(0)/<span style="color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(1,00)/<span style="color: #000000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(1,01)/<span style="color: #000000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(1,02)/<span style="color: #000000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(1,03)/<span style="color: #000000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(1,04)/<span style="color: #000000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(1,05)/<span style="color: #000000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(1,06)/<span style="color: #000000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(1,07)/<span style="color: #000000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(1,08)/<span style="color: #000000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(1,09)/<span style="color: #000000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(1,10)/<span style="color: #000000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(1,11)/<span style="color: #000000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(1,12)/<span style="color: #000000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(1,13)/<span style="color: #000000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(1,14)/<span style="color: #000000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(1,15)/<span style="color: #000000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(1,0)/<span style="color: #000000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(1,1)/<span style="color: #000000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(1,2)/<span style="color: #000000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(1,3)/<span style="color: #000000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(1,4)/<span style="color: #000000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(1,5)/<span style="color: #000000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(1,6)/<span style="color: #000000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(1,7)/<span style="color: #000000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(1,8)/<span style="color: #000000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(1,9)/<span style="color: #000000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(1)/<span style="color: #000000">/gs;
      $line =~
    s/(\x03)(2,00)/<span style="color: #000080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(2,01)/<span style="color: #000080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(2,02)/<span style="color: #000080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(2,03)/<span style="color: #000080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(2,04)/<span style="color: #000080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(2,05)/<span style="color: #000080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(2,06)/<span style="color: #000080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(2,07)/<span style="color: #000080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(2,08)/<span style="color: #000080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(2,09)/<span style="color: #000080; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(2,10)/<span style="color: #000080; background-color: #008080">/gs;
      $line =~
    s/(\x03)(2,11)/<span style="color: #000080; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(2,12)/<span style="color: #000080; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(2,13)/<span style="color: #000080; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(2,14)/<span style="color: #000080; background-color: #808080">/gs;
      $line =~
    s/(\x03)(2,15)/<span style="color: #000080; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(2,0)/<span style="color: #000080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(2,1)/<span style="color: #000080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(2,2)/<span style="color: #000080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(2,3)/<span style="color: #000080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(2,4)/<span style="color: #000080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(2,5)/<span style="color: #000080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(2,6)/<span style="color: #000080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(2,7)/<span style="color: #000080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(2,8)/<span style="color: #000080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(2,9)/<span style="color: #000080; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(2)/<span style="color: #000080">/gs;
      $line =~
    s/(\x03)(3,00)/<span style="color: #008000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(3,01)/<span style="color: #008000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(3,02)/<span style="color: #008000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(3,03)/<span style="color: #008000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(3,04)/<span style="color: #008000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(3,05)/<span style="color: #008000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(3,06)/<span style="color: #008000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(3,07)/<span style="color: #008000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(3,08)/<span style="color: #008000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(3,09)/<span style="color: #008000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(3,10)/<span style="color: #008000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(3,11)/<span style="color: #008000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(3,12)/<span style="color: #008000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(3,13)/<span style="color: #008000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(3,14)/<span style="color: #008000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(3,15)/<span style="color: #008000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(3,0)/<span style="color: #008000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(3,1)/<span style="color: #008000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(3,2)/<span style="color: #008000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(3,3)/<span style="color: #008000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(3,4)/<span style="color: #008000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(3,5)/<span style="color: #008000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(3,6)/<span style="color: #008000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(3,7)/<span style="color: #008000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(3,8)/<span style="color: #008000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(3,9)/<span style="color: #008000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(3)/<span style="color: #008000">/gs;
      $line =~
    s/(\x03)(4,00)/<span style="color: #FF0000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(4,01)/<span style="color: #FF0000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(4,02)/<span style="color: #FF0000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(4,03)/<span style="color: #FF0000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(4,04)/<span style="color: #FF0000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(4,05)/<span style="color: #FF0000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(4,06)/<span style="color: #FF0000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(4,07)/<span style="color: #FF0000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(4,08)/<span style="color: #FF0000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(4,09)/<span style="color: #FF0000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(4,10)/<span style="color: #FF0000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(4,11)/<span style="color: #FF0000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(4,12)/<span style="color: #FF0000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(4,13)/<span style="color: #FF0000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(4,14)/<span style="color: #FF0000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(4,15)/<span style="color: #FF0000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(4,0)/<span style="color: #FF0000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(4,1)/<span style="color: #FF0000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(4,2)/<span style="color: #FF0000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(4,3)/<span style="color: #FF0000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(4,4)/<span style="color: #FF0000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(4,5)/<span style="color: #FF0000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(4,6)/<span style="color: #FF0000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(4,7)/<span style="color: #FF0000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(4,8)/<span style="color: #FF0000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(4,9)/<span style="color: #FF0000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(4)/<span style="color: #FF0000">/gs;
      $line =~
    s/(\x03)(5,00)/<span style="color: #800000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(5,01)/<span style="color: #800000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(5,02)/<span style="color: #800000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(5,03)/<span style="color: #800000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(5,04)/<span style="color: #800000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(5,05)/<span style="color: #800000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(5,06)/<span style="color: #800000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(5,07)/<span style="color: #800000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(5,08)/<span style="color: #800000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(5,09)/<span style="color: #800000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(5,10)/<span style="color: #800000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(5,11)/<span style="color: #800000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(5,12)/<span style="color: #800000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(5,13)/<span style="color: #800000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(5,14)/<span style="color: #800000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(5,15)/<span style="color: #800000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(5,0)/<span style="color: #800000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(5,1)/<span style="color: #800000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(5,2)/<span style="color: #800000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(5,3)/<span style="color: #800000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(5,4)/<span style="color: #800000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(5,5)/<span style="color: #800000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(5,6)/<span style="color: #800000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(5,7)/<span style="color: #800000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(5,8)/<span style="color: #800000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(5,9)/<span style="color: #800000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(5)/<span style="color: #800000">/gs;
      $line =~
    s/(\x03)(6,00)/<span style="color: #800080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(6,01)/<span style="color: #800080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(6,02)/<span style="color: #800080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(6,03)/<span style="color: #800080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(6,04)/<span style="color: #800080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(6,05)/<span style="color: #800080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(6,06)/<span style="color: #800080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(6,07)/<span style="color: #800080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(6,08)/<span style="color: #800080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(6,09)/<span style="color: #800080; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(6,10)/<span style="color: #800080; background-color: #008080">/gs;
      $line =~
    s/(\x03)(6,11)/<span style="color: #800080; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(6,12)/<span style="color: #800080; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(6,13)/<span style="color: #800080; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(6,14)/<span style="color: #800080; background-color: #808080">/gs;
      $line =~
    s/(\x03)(6,15)/<span style="color: #800080; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(6,0)/<span style="color: #800080; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(6,1)/<span style="color: #800080; background-color: #000000">/gs;
      $line =~
    s/(\x03)(6,2)/<span style="color: #800080; background-color: #000080">/gs;
      $line =~
    s/(\x03)(6,3)/<span style="color: #800080; background-color: #008000">/gs;
      $line =~
    s/(\x03)(6,4)/<span style="color: #800080; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(6,5)/<span style="color: #800080; background-color: #800000">/gs;
      $line =~
    s/(\x03)(6,6)/<span style="color: #800080; background-color: #800080">/gs;
      $line =~
    s/(\x03)(6,7)/<span style="color: #800080; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(6,8)/<span style="color: #800080; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(6,9)/<span style="color: #800080; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(6)/<span style="color: #800080">/gs;
      $line =~
    s/(\x03)(7,00)/<span style="color: #FF8000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(7,01)/<span style="color: #FF8000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(7,02)/<span style="color: #FF8000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(7,03)/<span style="color: #FF8000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(7,04)/<span style="color: #FF8000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(7,05)/<span style="color: #FF8000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(7,06)/<span style="color: #FF8000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(7,07)/<span style="color: #FF8000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(7,08)/<span style="color: #FF8000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(7,09)/<span style="color: #FF8000; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(7,10)/<span style="color: #FF8000; background-color: #008080">/gs;
      $line =~
    s/(\x03)(7,11)/<span style="color: #FF8000; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(7,12)/<span style="color: #FF8000; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(7,13)/<span style="color: #FF8000; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(7,14)/<span style="color: #FF8000; background-color: #808080">/gs;
      $line =~
    s/(\x03)(7,15)/<span style="color: #FF8000; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(7,0)/<span style="color: #FF8000; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(7,1)/<span style="color: #FF8000; background-color: #000000">/gs;
      $line =~
    s/(\x03)(7,2)/<span style="color: #FF8000; background-color: #000080">/gs;
      $line =~
    s/(\x03)(7,3)/<span style="color: #FF8000; background-color: #008000">/gs;
      $line =~
    s/(\x03)(7,4)/<span style="color: #FF8000; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(7,5)/<span style="color: #FF8000; background-color: #800000">/gs;
      $line =~
    s/(\x03)(7,6)/<span style="color: #FF8000; background-color: #800080">/gs;
      $line =~
    s/(\x03)(7,7)/<span style="color: #FF8000; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(7,8)/<span style="color: #FF8000; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(7,9)/<span style="color: #FF8000; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(7)/<span style="color: #FF8000">/gs;
      $line =~
    s/(\x03)(8,00)/<span style="color: #FFFF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(8,01)/<span style="color: #FFFF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(8,02)/<span style="color: #FFFF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(8,03)/<span style="color: #FFFF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(8,04)/<span style="color: #FFFF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(8,05)/<span style="color: #FFFF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(8,06)/<span style="color: #FFFF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(8,07)/<span style="color: #FFFF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(8,08)/<span style="color: #FFFF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(8,09)/<span style="color: #FFFF00; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(8,10)/<span style="color: #FFFF00; background-color: #008080">/gs;
      $line =~
    s/(\x03)(8,11)/<span style="color: #FFFF00; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(8,12)/<span style="color: #FFFF00; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(8,13)/<span style="color: #FFFF00; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(8,14)/<span style="color: #FFFF00; background-color: #808080">/gs;
      $line =~
    s/(\x03)(8,15)/<span style="color: #FFFF00; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(8,0)/<span style="color: #FFFF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(8,1)/<span style="color: #FFFF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(8,2)/<span style="color: #FFFF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(8,3)/<span style="color: #FFFF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(8,4)/<span style="color: #FFFF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(8,5)/<span style="color: #FFFF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(8,6)/<span style="color: #FFFF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(8,7)/<span style="color: #FFFF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(8,8)/<span style="color: #FFFF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(8,9)/<span style="color: #FFFF00; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(8)/<span style="color: #FFFF00">/gs;
      $line =~
    s/(\x03)(9,00)/<span style="color: #00FF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(9,01)/<span style="color: #00FF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(9,02)/<span style="color: #00FF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(9,03)/<span style="color: #00FF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(9,04)/<span style="color: #00FF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(9,05)/<span style="color: #00FF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(9,06)/<span style="color: #00FF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(9,07)/<span style="color: #00FF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(9,08)/<span style="color: #00FF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(9,09)/<span style="color: #00FF00; background-color: #00FF00">/gs;
      $line =~
    s/(\x03)(9,10)/<span style="color: #00FF00; background-color: #008080">/gs;
      $line =~
    s/(\x03)(9,11)/<span style="color: #00FF00; background-color: #00FFFF">/gs;
      $line =~
    s/(\x03)(9,12)/<span style="color: #00FF00; background-color: #0000FF">/gs;
      $line =~
    s/(\x03)(9,13)/<span style="color: #00FF00; background-color: #FF00FF">/gs;
      $line =~
    s/(\x03)(9,14)/<span style="color: #00FF00; background-color: #808080">/gs;
      $line =~
    s/(\x03)(9,15)/<span style="color: #00FF00; background-color: #B0B0B0">/gs;
      $line =~
    s/(\x03)(9,0)/<span style="color: #00FF00; background-color: #FFFFFF">/gs;
      $line =~
    s/(\x03)(9,1)/<span style="color: #00FF00; background-color: #000000">/gs;
      $line =~
    s/(\x03)(9,2)/<span style="color: #00FF00; background-color: #000080">/gs;
      $line =~
    s/(\x03)(9,3)/<span style="color: #00FF00; background-color: #008000">/gs;
      $line =~
    s/(\x03)(9,4)/<span style="color: #00FF00; background-color: #FF0000">/gs;
      $line =~
    s/(\x03)(9,5)/<span style="color: #00FF00; background-color: #800000">/gs;
      $line =~
    s/(\x03)(9,6)/<span style="color: #00FF00; background-color: #800080">/gs;
      $line =~
    s/(\x03)(9,7)/<span style="color: #00FF00; background-color: #FF8000">/gs;
      $line =~
    s/(\x03)(9,8)/<span style="color: #00FF00; background-color: #FFFF00">/gs;
      $line =~
    s/(\x03)(9,9)/<span style="color: #00FF00; background-color: #00FF00">/gs;
      $line =~ s/(\x03)(9)/<span style="color: #00FF00">/gs;
      $line =~ s/(\x0f)/<\/span>/gs;
      $tagnum = 0;
      while ($line =~ /^(.*?)(\x02)(.*)$/s) {
        if ($tagnum == 0) {
          $out .= $1 . "<span style=\"font-weight: bold\">";
          $tagnum = 1;
        } else {
          $out .= $1 . "</span>";
          $tagnum = 0;
        }
        $line = $3;
      }
      $line = $out . $line;
      $out = "";
      $line =~ s/(\x03)(\d{1,2})(,\d{1,2})?//gs; # strip out extra color tags
      $line =~ s/(\x03)/<\/span>/gs;
      if ($line =~ /<\/span>/) {
        my @lineparts = split(/<\/span>/,$line);
        for (my $i = 0;$i < $#lineparts;$i++) {
          while ($lineparts[$i] !~ /<span / && $i < $#lineparts) {
            $lineparts[$i] .= $lineparts[$i+1];
            for (my $j = $i + 1;$j < $#lineparts;$j++) {
              $lineparts[$j] = $lineparts[$j+1];
            }
            pop(@lineparts);
          }
        }
        $line = join("</span>",@lineparts);
      }
    } else {
      $line =~ s/(\x03)(\d{1,2})?(,\d{1,2})?//gs; # strip out color tags
      $line =~ s/(\x03)//gs; # strip out color tags
      $line =~ s/(\x0f)//gs; # strip out color tags
      $line =~ s/(\x02)//gs; # strip out bold tags
    }
    if ($query->param("input") eq "skype") {
      if ($line =~ /^(\s*\[[0-9:\/\| A-Za-z]+\] .*?\:\s*)/) {
        $prev_head = $1;
      } elsif ($line =~ /\S/) {
        $line = $prev_head . $line;
      }
      $line =~ s/^\s*\[[0-9:\/ APM]+\] (.*?)\:/\<$1\>/;
    }
    $line =~ s/\x{2026}/.../gs; # translate UTF-16 ellipsis to ASCII ellipsis
    $line =~ s/\x{e2}\x{80}\x{a6}/.../gs; # same translation in UTF-8
    $line =~ s/(-)+/-/gs; # get rid of log-breaking multiple -s
    $line =~ s/(_)+/_/gs; # get rid of log-breaking multiple _s
    $line =~ s/^(\s*)((\(|\[)?)(\d+):(\d+)(:(\d+))?( AM)?( PM)?((\)|\])?)//gs;
    # remove time stamps
    $line =~ s/^(\s*)[A-Z][a-z][a-z] (\d+) (\d+):(\d+)(:(\d+))?( AM)?( PM)?//gs;
    # remove time stamps
    $line =~ s/^ \*\*\*(\S*?) /$1 /; # convert GAIM actions and...
    $line =~ s/^ (\S*?):/<$1>/; # ...GAIM who-says to MIRC format for processing
    if ($query->param("output") eq "wikispaces" ||
        $query->param("output") eq "wikidot") {
      $line =~ s/\//``\/``/gs; # get rid of log-breaking /s
      $line =~ s/\*/``*``/gs; # get rid of log-breaking *s
      $star = "``\\\*``";
    }
    $line =~ s/\~/``~``/gs; # get rid of log-breaking ~s
    $line =~ s/=/``=``/gs; # get rid of log-breaking =s
    $line =~ s/&/&amp;/gs;
    $line =~ s/</&lt;/gs;
    $line =~ s/>/&gt;/gs;
    $line =~ s/\x02//gs;
    $line =~ s/\x03//gs;
    if ($query->param("output") ne "mediawiki") {
      $line =~ s/&lt;``\/``span&gt;/\x02\/span\x03/gs;
    } else {
      $line =~ s/&lt;``\/``span&gt;/\x02``\/``span\x03/gs;
    }
    $line =~
s/&lt;span style``=``"(.+?)"&gt;/\x02span style=&quot;$1&quot; \x03/gs;
    $line =~ s/\&lt;(.*?)\`\&gt;/\&lt;$1\&gt;/gs;
    $line =~ s/\&lt;([\+\@ ])(.*?)\&gt;/\&lt;$2\&gt;/gs;
    $line =~ s/\&lt;Kagami\&gt;/\&lt;Sugarlips\&gt;/gs; # Kagami = another Slips
    $line =~ s/\&lt;\^Kagami\&gt;/\&lt;Sugarlips\&gt;/gs; # ditto ^Kagami
    $line =~ s/\&lt;RoboYamo\&gt;/\&lt;Sugarlips\&gt;/gs; # ditto RoboYamo
    $line =~ s/\&lt;RoboYamo\d\&gt;/\&lt;Sugarlips\&gt;/gs; # ditto RoboYamoN
    $line =~ s/\&lt;Sugarlips`\&gt;/\&lt;Sugarlips\&gt;/gs; # ditto Sugarlips`
    $line =~ s/\&lt;Chessa(_+)\&gt;/\&lt;Chessa\&gt;/gs; # Chessa aliases
    $line =~ s/\&lt;WinterFortune\&gt;/\&lt;Chessa\&gt;/gs; # Chessa aliases
    $line =~ s/\&lt;RichterBelmont\&gt;/\&lt;DiceMaid-9001\&gt;/gs; # and so on
    $line =~ s/\&lt;HigginsvonHiggins\&gt;/\&lt;DiceMaid-9001\&gt;/gs; # etc.
    if (($prev_line ne "") && ($line =~ /\&lt;(.*?)\&gt; cut-\&gt;(.*)/)) {
      $line = $prev_line . $2;
      $prev_line = "";
    }
    $line =~ s/````//gs;
    $line =~ s/^(\s+)//gs;
    $line =~ s/(\s+)$//gs;
    $line =~ s/(\s+)/ /gs;
    if ($line =~ /^(.*) \&lt;-cut$/) {
      $prev_line = $1;
    } elsif ($line =~ /^(\s*)$/) {
      # nothing, so ignore
    } elsif ($line =~ /^\&lt;\#(\S+)\&gt; /) {
      # system command (GAIM): ignore
    } elsif ($line =~ /^\-\!\-\s/) {
      # system command (Chessa): ignore
    } elsif ($line =~ /^(.*?)\&lt;(.*?)\&gt;(\s+)\(\((.*)\)\)(\s*)$/) {
      my $name = $2;
      $line = $4;
      $name = normalize_name($name);
      $out = "[OOC] " . $name . ": " . $line;
    } elsif ($line =~ /^(.*?)\&lt;(.*?)\&gt;(\s+)\(\((.*)$/) {
      my $name = $2;
      $line = $4;
      $name = normalize_name($name);
      $out = "[OOC] " . $name . ": " . $line;
    } elsif ($line =~ /^(.*?)\&lt;(.*?)\&gt;(\s+)\[(.*)\](\s*)$/) {
      my $name = $2;
      $line = $4;
      $name = normalize_name($name);
      $out = "[OOC] " . $name . ": " . $line;
    } elsif ($line =~ /^(.*?)\&lt;(.*?)\&gt;(\s+)\[(.*)$/) {
      my $name = $2;
      $line = $4;
      $name = normalize_name($name);
      $out = "[OOC] " . $name . ": " . $line;
    } elsif ($line =~ /^(.*)\&lt;(.*?)\&gt;(\s+)\.([a-z])/) {
      # .roll or similar command: ignore
    } elsif ($line =~ /^(.*)\&lt;(.*?)\&gt;(\s+)\!([a-z])/) {
      # !roll or similar command: ignore
    } elsif ($line =~ /^(.*)\&lt;(.*?)\&gt;(\s+)\@([a-z])/) {
      # @roll or similar command: ignore
    } elsif ($line =~ /\&lt;Shurelia\&gt; (.*) malformed expression/) {
      # Shurelia error: ignore
    } elsif ($line =~
        /\&lt;Shurelia\&gt; (\S+) rolled (.*?) --&gt; \[ (.*?) \]\{(.*?)\}/) {
      my $name = $1;
      my $dice = $2;
      my $rolls = $3;
      my $total = $4;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled " . $dice . " and got " . $total .
        " (rolls: " . $rolls . ")" . $end_bold;
    } elsif ($line =~
        /\&lt;Shurelia\&gt; (\S+) rolled (.*?) --&gt; {(.*?)\}/) {
      my $name = $1;
      my $equation = $2;
      my $total = $3;
      $name = normalize_name($name);
      $out = $start_bold . $name . " checked " . $equation . " and got " .
        $total . $end_bold;
    } elsif ($line =~ /\&lt;Highwind\&gt; Error/) {
      # Highwind error: ignore
    } elsif ($line =~ /\&lt;Highwind\&gt; (\S+) - Total: ([-.0-9]+)/) {
      my $name = $1;
      $line = $2;
      $name = normalize_name($name);
      $out = $start_bold . $name . " got a total of " . $line . $end_bold;
    } elsif ($line =~
    /\&lt;Highwind\&gt; (\S+) - (\S+): ([- ,.0-9]+) \( Total: ([-.0-9]+) \)/) {
      my $name = $1;
      $line = $2;
      my $result = $3;
      my $total = $4;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled " . $line . " and got " . $result .
        " for a total of " . $total . $end_bold;
    } elsif ($line =~ /\&lt;Highwind\&gt; (\S+) - (\S+): ([- ,().0-9]+)/) {
      my $name = $1;
      $line = $2;
      my $result = $3;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled " . $line . " and got " . $result .
        $end_bold;
    } elsif ($line =~ /\&lt;Sugarlips\&gt; Error/) {
      # Sugarlips error: ignore
    } elsif ($line =~
/\&lt;Sugarlips\&gt; (\S+), (.+):([- ,.0-9]+)\[Total: ([-.0-9]+)(.*?)\] -(.*)/
) {
      my $name = $1;
      $line = $2;
      my $result = $3;
      my $total = $4;
      my $comment = $6;
      $name = normalize_name($name);
      $comment =~ s/^(\s*)(.*?)(\s*)$/$2/s;
      $out = $start_bold . $name . " rolled " . $line . " and got" . $result .
        "( Total: " . $total . " ) for " . $comment . $end_bold;
    } elsif ($line =~
        /\&lt;Sugarlips\&gt; (\S+), (.+):([- ,.0-9]+)\[Total: ([-.0-9]+)/) {
      my $name = $1;
      $line = $2;
      my $result = $3;
      my $total = $4;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled " . $line . " and got" . $result .
        "( Total: " . $total . " )" . $end_bold;
    } elsif ($line =~ /\&lt;Sugarlips\&gt; (\S+), (.+):([- ,.0-9]+)/) {
      my $name = $1;
      $line = $2;
      my $result = $3;
      $result =~ s/\s+$//;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled " . $line . " and got" . $result .
        $end_bold;
    } elsif ($line =~ /\&lt;Sugarlips\&gt;(\s+)(\d)(\S+): (.*)$/) {
      $out = $start_bold . "Also rolled " . $2 . $3 . " and got " . $4 .
        $end_bold;
    } elsif ($line =~ /\&lt;Sugarlips\&gt;(\s+)(\S+): (.*)$/) {
      $out = $start_bold . $2 . ": " . $3 . $end_bold;
    } elsif ($line =~
        /\&lt;Sugarlips\&gt;(\s+)Total: ([-.0-9]+), Avg: ([-.0-9]+)/) {
      $out = $start_bold . "For a total of " . $2 . " (average " . $3 . ")" .
        $end_bold;
    } elsif ($line =~ /\&lt;Sugarlips\&gt;(\s+)(.*?)(\s*)$/) {
      $out = "Dicebot:" . $start_italic . " " . $2 . $end_italic;
    } elsif ($line =~ /\&lt;Chessa\&gt; (.*?): (.*)$/) {
      $line = $2;
      my $name = $1;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled up " . $line . $end_bold;
    } elsif ($line =~ /\&lt;DiceMaid-9001\&gt; (.*?), (.*): (.*)$/) {
      $line = $2;
      my $name = $1;
      my $result = $3;
      $result =~ s/\s+$//;
      $name = normalize_name($name);
      $out = $start_bold . $name . " rolled " . $line . " and got " . $result .
        $end_bold;
    } elsif ($line =~ /\&lt;DiceMaid-9001\&gt;(\s+)(.*)/) {
      # ignore all of DiceMaid-9001's non-roll-result lines
    } elsif ($line =~ /^(\s*)$star(\s+)DiceMaid-9001(\s+)/) {
      # ignore all of DiceMaid-9001's non-roll-result lines
    } elsif ($line =~ /^(.*?)\&lt;(.*?)\&gt;(\s+)$star(\s*)(.*)$/) {
      $line = $5;
      $out = parse_quoted_line($line,$start_italic,$end_italic);
    } elsif ($line =~ /^(.*)\&lt;(.*?)\&gt;(\s+)(.*)$/) {
      my $name = $2;
      $line = $4;
      $name = normalize_name($name);
      $out = $name . ": " . parse_quoted_line($line,$start_italic,$end_italic);
      $out =~ s/\/\/(\s*)\/\///gs;
    } elsif ($line =~ /^(.*) has joined \#(\S+)(\s*)$/) {
      # join channel (MIRC): ignore
    } elsif ($line =~
      /^(\s*)(\d*)\[([:0-9]+)\](\s+)$star (\S+) \((.*)\@(.*)\) has joined \#/) {
      # join channel (MIRC): ignore
    } elsif ($line =~ /^(\s*)$star(\s+)(\S+) \((.*)\@(.*)\) has joined \#/) {
      # join channel (MIRC): ignore
    } elsif ($line =~ /^ (\S+) entered the room.$/) {
      # join channel (GAIM): ignore
    } elsif ($line =~
      /^ (\S+) \[([-_`~a-zA-Z0-9.]+)\@([-_a-zA-Z0-9.]+)\] entered the room.$/) {
      # join channel (GAIM): ignore
    } elsif ($line =~ /^(.*) has left \#(\S+)(\s*)$/) {
      # leave channel (MIRC): ignore
    } elsif ($line =~ /^(.*) has left \#(\S+) \((.*)\)(\s*)$/) {
      # leave channel (MIRC): ignore
    } elsif ($line =~
        /^(\s*)(\d*)\[([:0-9]+)\](\s+)$star (\S+) \((.*)\@(.*)\) has left \#/) {
      # leave channel (MIRC): ignore
    } elsif ($line =~ /^(\s*)$star(\s+)(\S+) \((.*)\@(.*)\) has left \#/) {
      # leave channel (MIRC): ignore
    } elsif ($line =~ /^ (\S+) left the room \(quit:(.*)\)\.$/i) {
      # leave channel (GAIM): ignore
    } elsif ($line =~ /^ (\S+) left the room\.$/i) {
      # leave channel (GAIM): ignore
    } elsif ($line =~
        /(\s*)$star (\S+) \(([-_`~a-zA-Z0-9.]+)\@([-_a-zA-Z0-9.]+)\) Quit/) {
      # quit (MIRC): ignore
    } elsif ($line =~ /$star Retrieving \#(\S+) modes\.\.\./) {
      # metadata prelude to +m or ban: ignore
    } elsif ($line =~ /$star (\S+) has quit \((\S+)/) {
      # quit (XChat): ignore
    } elsif ($line =~ / has quit IRC \(/) {
      # quit (MIRC): ignore
    } elsif ($line =~
    /^(\s*)(\d*)\[([:0-9]+)\](\s+)$star (\S+) \((.*)\@(.*)\) Joins: (\s+) \(/) {
      # join (mIRC?): ignore
    } elsif ($line =~ /^(\s*)$star(\s+)(\S+) \((.*)\@(.*)\) Joins: (\s+) \(/) {
      # join (mIRC?): ignore
    } elsif ($line =~
    /^(\s*)(\d*)\[([:0-9]+)\](\s+)$star (\S+) \((.*)\@(.*)\) Quits: (\s+) \(/) {
      # quit (mIRC?): ignore
    } elsif ($line =~ /^(\s*)$star(\s+)(\S+) \((.*)\@(.*)\) Quits: (\s+) \(/) {
      # quit (mIRC?): ignore
    } elsif ($line =~
        /^(\s*)(\d*)\[([:0-9]+)\](\s+)$star (\S+) \((.*)\@(.*)\) Quit \(/) {
      # quit mIRC: ignore
    } elsif ($line =~ /^(\s*)$star(\s+)(\S+) \((.*)\@(.*)\) Quit \(/) {
      # quit mIRC: ignore
    } elsif ($line =~ /$star (\S+) is now known as (\S+)(\s*)$/) {
      # nick change (mIRC): ignore
    } elsif ($line =~ /^ (\S+) is now known as (\S+)(\s*)$/) {
      # nick change (GAIM): ignore
    } elsif ($line =~ /^ You are now known as (\S+)(\s*)$/) {
      # nick change (GAIM): ignore
    } elsif ($line =~ /$star (\S+) sets mode: (\+|\-)/) {
      # mode change (MIRC): ignore
    } elsif ($line =~ /$star (\S+) changes topic to '/) {
      # mode change (MIRC): ignore
    } elsif ($line =~ /$star (\S+)\.(\S+) gives channel operator status to /) {
      # op (XChat): ignore
    } elsif ($line =~ /$star Disconnected$/) {
      # disconnected: ignore
    } elsif ($line =~ /$star Attempting to rejoin channel \#/) {
      # reconnecting: ignore
    } elsif ($line =~ /$star Rejoined channel \#/) {
      # reconnecting: ignore
    } elsif ($line =~ /$star Topic is '/) {
      # reconnecting: ignore
    } elsif ($line =~ /$star Set by /) {
      # reconnecting: ignore
    } elsif ($line =~ /ChanServ /) {
      # ChanServ does something: ignore
    } elsif ($line =~ /^(\d*)([\[\]:0-9]+)$/) {
      # bare timestamp: ignore
    } elsif ($line =~ /^(-|$star)(\S+):\@\#/) {
      # onotice/omsg: ignore
    } elsif ($line =~
        /^(\s*)(\d*)\[([ :0-9a-zA-Z]+)\](\s*)(-|$star)(\S+):\@\#/) {
      # onotice/omsg: ignore
    } elsif ($line =~ /^-/) {
      # private message, onotice/omsg, or reconnecting: ignore
    } elsif ($line =~ /^(\s*)(\d*)\[([ :0-9a-zA-Z]+)\](\s*)-/) {
      # private message, onotice/omsg, or reconnecting: ignore
    } elsif ($line =~ /^Session /) {
      # meta-info, so ignore
    } elsif ($line =~ /^$star Logging #/) {
      # meta-info, so ignore
    } elsif ($line =~ /^(\s*)$star(\s*)(\S+)(\s+)(.*)$/) {
      $name = $3;
      $line = $5;
      $name = normalize_name($name);
      $out = parse_quoted_line($name . " " . $line,$start_italic,$end_italic);
    } elsif ($line =~
        /^(\s*)(\d*)(\[?)([ :0-9a-zA-Z]+)(\]?)(\s*)$star(\s*)(\S+)(\s+)(.*)$/) {
      $name = $8;
      $line = $10;
      $name = normalize_name($name);
      $line = $name . " " . $line;
      $out = parse_quoted_line($name . " " . $line,$start_italic,$end_italic);
    } elsif ($line =~
        /^(\s*)(\d*)(\[?)([ :0-9a-zA-Z]+)(\]?)(\s*)(\S+)(\s+)(.*)$/) {
      $name = $7;
      $line = $9;
      $name = normalize_name($name);
      $out = parse_quoted_line($name . " " . $line,$start_italic,$end_italic);
    } else {
      # echo or otherwise none of the above: ignore
    }
    if ($query->param("output") eq "tumblr") {
      $out =~ s/$start_italic(.*?)$end_italic/\/$1\//g;
      $out =~ s/\/(.*?)\//$start_italic$1$end_italic/g;
      $out =~ s/\*(.*?)\*/$start_bold$1$end_bold/g;
    }
    if ($out ne "") {
      if ($query->param("output") eq "tumblr") {
        $out =~ s/(&lt;\/p&gt;)(\s*)(\S)/$1$2&gt;p&lt;$3/gs;
        $out = "&lt;p&gt;" . $out;
      }
      $out =~ s/\x02/&lt;/gs;
      $out =~ s/\x03/&gt;/gs;
      $tagnum = 0;
      $line = $out;
      while ($line =~ /^(.*?)&lt;span (.*)$/s) {
        $tagnum++;
        $line = $2;
      }
      $line = $out;
      while ($line =~ /^(.*?)&lt;\/span(.*)$/s) {
        $tagnum--;
        $line = $2;
      }
      while ($tagnum > 0) {
        if ($query->param("output") ne "mediawiki") {
          $out .= "&lt;\/span&gt;";
        } else {
          $out .= "&lt;``\/``span&gt;";
        }
        $tagnum--;
      }
      if ($query->param("output") eq "wikidot") {
        $out =~ s/&lt;span(.*?)&gt;/\[\[span$1\]\]/gs;
        $out =~ s/&lt;\/span&gt;/\[\[\/span\]\]/gs;
      }
      print $out . $eol;
    }
  }
  print "</pre>";
}
if ($query->param("getsourcetext") != 1) {
  print "</body></html>\n";
}