7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/zarchitect/rouge_html.rb', line 7
def block_code(code, language)
line = code.lines.first
ar = line.split ':'
code = code.lines.to_a[1..-1].join
str = Rouge.highlight(code, ar[1].chomp, 'html')
code2 = ""
i = 1
str.each_line do |l|
j = "#{i}"
if j.length == 1
j.prepend("00")
elsif j.length == 2
j.prepend("0")
end
code2 << "<span class='codelinenumber'>#{j} </span>#{l}"
i += 1
end
code2.prepend("<pre><code class='highlight'>")
code2 << "</code></pre>"
end
|