18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/jam_script_highlighter/html.rb', line 18
def render_line line_details
line = Line.new(line_details[:line], line_details[:type])
@html += case line_details[:type]
when :control
ret = ''
ret += "</div>\n\n" and @processing_section = false if @processing_section
ret += line.to_html
@section_type = line.text.downcase
ret += "<div class=\"#{@section_type}\">"
@processing_section = true
ret
when :section
ret = ''
ret += "</div>\n\n" and @processing_section = false if @processing_section
ret += line.to_html
ret += "<div class=\"#{@section_type}\">"
@processing_section = true
ret
when :structure
@section_type = 'structure'
ret = ''
ret += "</div>\n\n" and @processing_section = false if @processing_section
ret += "<div class=\"group\">"
ret += line.to_html
@processing_section = true
ret
when :other
case @section_type
when 'chords'
"<p class=\"#{@section_type}\">#{line.to_html.strip}</p>"
else
line.to_html
end
else
line.to_html
end + "\n"
end
|