Module: Ansi2html

Defined in:
mod/script/lib/ansi2html.rb

Overview

Converts ansi formatting codes to html

Class Method Summary collapse

Class Method Details

.ansi2html(data) ⇒ Object



4
5
6
7
8
# File 'mod/script/lib/ansi2html.rb', line 4

def ansi2html data
  data.gsub(/\033\[(?<code>[\d\;]{2,})m(?<content>.*?)\033\[0m/) do
    to_span_tag Regexp.last_match(:code), Regexp.last_match(:content)
  end
end