    # File lib/facets/more/bbcode.rb, line 264
      def BBCode.bbcode_to_html(string)
          return "" if string.nil? || string.to_s.strip.empty?
          result = ""
          quote = 0

          ## Iterate over lines
          string.split("\n").each do |line|
              styles = { "b" => "strong", "i" => "em", "u" => "u" }

              ## preserve B, I, U
              styles.each do |code,html|
                  line.gsub!(/\[#{code}\]/i, "<#{html}>")
                  line.gsub!(/\[\/#{code}\]/i, "</#{html}>")
              end

              ## COLOR => font color=... (TODO: should be numeric!)
              line.gsub!(/\[COLOR=(.*?)\]/i, "<font color=\"\\1\">")
              line.gsub!(/\[\/COLOR\]/i,     "</font>")

              ## SIZE => font size=...
              line.gsub!(/\[SIZE=(.*?)\]/i, "<font size=\"\\1\">")
              line.gsub!(/\[\/SIZE\]/i,     "</font>")

              ## URL
              line.gsub!(/\[URL\]([^\[]+?)\[\/URL\]/i, "<a href=\"\\1\">\\1</a>")
              line.gsub!(/\[URL=(.*?)\](.+?)\[\/URL\]/i, "<a href=\"\\1\">\\2</a>")

              ## IMG
              line.gsub!(/\[IMG=(.*?)\]/i, "<img src=\"\\1\" />")

              ## ALIGN=center (TODO: right, left)
              line.gsub!(/\[ALIGN=center\]/i, "<center>")
              line.gsub!(/\[ALIGN=right\]/i,  "<center>")
              line.gsub!(/\[ALIGN=left\]/i,   "<center>")
              line.gsub!(/\[\/ALIGN\]/i,      "</center>")

              ## QUOTE
              quote+=1 if line =~ /\[QUOTE\]/i
              quote-=1 if (line =~ /\[\/QUOTE\]/i) && (quote > -1)
              line.gsub!(/\[QUOTE\]/i,   "<pre>\n")
              line.gsub!(/\[\/QUOTE\]/i, "</pre>\n")
              line.gsub!(/^/, "&#62;"*quote) if quote > 0

              ## EMAIL
              line.gsub!(/\[EMAIL\](.*?)\[\/EMAIL\]/i, "<a href=\"mailto:\\1\">\\1</a>")

              ## LIST (TODO: LIST=1, LIST=A)
              line.gsub!(/\[LIST(?:=(.*?))?\]/i, "\n<ul>\n")
              line.gsub!(/\[\/LIST\]/i,          "\n</ul>\n")
              line.gsub!(/\[\*\]/i,              "\n<li />")

              ## FONT => font ??????
              ## ?BLUR?, FADE?

              result << sprintf("%s<br />\n", line)
          end

          return result
      end