Warning : This website is not updated anymore. Its content surely is outdated.


erc2html is a small Ruby script which converts the content of an ERC chat window into an HTML version.

It is really quick and dirty. You have been warned.

require "cgi"

str = IO.read("erc_chat_file.log.txt")

titre = "Titre de la page"
charset = "UTF-8"

head = <<EOL
<meta http-equiv="Content-Type" content="text/html; charset=#{charset}" />
<style type="text/css">
 * {font-family: monospace;}
 .nick {font-weight: bold; color: #A00;}
 .ref {font-style: italic; color: #090;}
 .timestamp {color: #AAA;}
 .me {color: #00B;}

foot = <<EOL

str.gsub!(/^ERC>.*$/n, "")
str.gsub!(/\n\s+/n, " ")
str.gsub!(/\[\d\d:\d\d\]/) { |s| "\n"+s+"\n"}
str.gsub!(/\s+$/n, "")
str.gsub!(/^\*\*\* .*$/n, "")
5.times {str.gsub!(/\n\s*\n/n, "\n")}

str = CGI::escapeHTML(str)
str.gsub!(/^&lt;.*?&gt;/n) {|s| '<span class="nick">'+s+'</span>'}
str.gsub!(/(<\/span>) (\w+\s?:)/n) {|s| $1+' <span class="ref">'+$2+'</span>'}
str.gsub!(/\[\d\d:\d\d\]/) { |s| '<span class="timestamp">'+s+'</span>'}
str.gsub!(/^\* .*$/n) {|s| '<span class="me">'+s+'</span>'}
str.gsub!(/\n/, "<br />\n")

str = head + str
str = str + foot

puts str