Hello, sorry if this has been asked before but i didnt meet such a topic. My problem is that i am writing a tcl for online stats and i am logging whats going on in the channel in chat.txt. Next i write a html using that file, but the problem is in the .txt file where there are lines with bold, reverse, underline or color, such as:
1156356695 quit LaM3r43t0 admin@84.238.171.248 Quit: 4? 9Club Xtazy ? 11Script ? 4Download ? w15ww.15styni.HiT.9bG ?
on the .html file they dont appear colored, underlined, etc.
I hope you understand what my problem is and you can help me. I need a procedure that would fix that effect.
proc mirc2html str {
set re {([\002\017\026\037]|[\003]{1}[0-9]{0,2}[\,]{0,1}[0-9]{0,2})}
array set colors { 0 white 1 black 2 navy 3 green
4 red 5 maroon 6 purple 7 olive
8 yellow 9 lime 10 teal 11 aqua
12 blue 13 fuchsia 14 gray 15 silver}
set numtags 0; set bold 0
while {[regexp -indices $re $str -> idxs]} {
set b [lindex $idxs 0]
set e [lindex $idxs 1]
set sub [string range $str $b $e]
switch [string index $sub 0] {
"\002" {
if !$bold {
set tag "<span style=\"font-weight:bold\">"
set bold 1
} {
set tag "<span style=\"font-weight:normal\">"
set bold 0
}
incr numtags
}
"\017" {
set tag [string repeat "</span>" $numtags]
set numtags 0
}
"\026" {
set tag [string repeat "</span>" $numtags]
append tag "<span style=\"color:white;background-color:black\">"
set numtags 1
}
"\037" {
set tag "<span style=\"text-decoration:underline\">"
incr numtags
}
"\003" {
set fg [lindex [split [string range $sub 1 e] ,] 0]
set bg [lindex [split [string range $sub 1 e] ,] 1]
if {$fg != "" || $bg != ""} {
if {$fg > 15 || $bg > 15} {
set tag "<span>"
} elseif {$fg != "" && $bg != ""} {
set tag "<span style=\"color:$colors($fg);background-color:$colors($bg)\">"
} elseif {$fg != "" && $bg == ""} {
set tag "<span style=\"color:$colors($fg)\">"
} else {
set tag "<span style=\"background-color:$colors($bg)\">"
}
incr numtags
} {
set tag [string repeat "</span>" $numtags]
set numtags 0
}
}
}
set str [string replace $str $b $e $tag]
}
append str [string repeat "</span>" $numtags]
return $str
}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use