Class: AnsiArt::HtmlConverter
Instance Method Summary
collapse
Methods inherited from Converter
#reset_color, #set_color, #set_color_for, #wait_half_char!
Constructor Details
Returns a new instance of HtmlConverter.
3
4
5
6
|
# File 'lib/ansi_art/html_converter.rb', line 3
def initialize
super
@output = '<div><span class="f7 b0">'
end
|
Instance Method Details
#commit_color ⇒ Object
27
28
29
|
# File 'lib/ansi_art/html_converter.rb', line 27
def commit_color
@output += '</span><span class="' + formatColor + '">'
end
|
#newLine ⇒ Object
24
25
26
|
# File 'lib/ansi_art/html_converter.rb', line 24
def newLine
@output += "</span></div><div><span class=\"#{formatColor}\">"
end
|
#output ⇒ Object
30
31
32
|
# File 'lib/ansi_art/html_converter.rb', line 30
def output
return @output + '</span></div>'
end
|
#put(str) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/ansi_art/html_converter.rb', line 7
def put str
putHalfChar str[/./] unless @leftColor.nil?
str.gsub!(/\u00B7/,"\u00B7 ")
str.gsub!(/\u00A7/,"\u00A7 ")
str.gsub!(/\uFF89/,"\uFF89 ")
str.gsub!(/\u2665/,"\u2665 ")
str.gsub!(/&/, '&')
str.gsub!(/</, '<')
str.gsub!(/>/, '>')
str.gsub!(/"/, '"')
@output += str.gsub(/ /,' ')
end
|