|
|
@ -30,12 +30,12 @@ module HighlightCode |
|
|
|
highlighted_code |
|
|
|
end |
|
|
|
def tableize_code (str, lang = '') |
|
|
|
table = '<div class="highlight"><table cellpadding="0" cellspacing="0"><tr><td class="gutter"><pre class="line-numbers">' |
|
|
|
table = '<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers">' |
|
|
|
code = '' |
|
|
|
str.lines.each_with_index do |line,index| |
|
|
|
table += "<span class='line'>#{index+1}</span>\n" |
|
|
|
code += "<div class='line'>#{line}</div>" |
|
|
|
table += "<span class='line-number'>#{index+1}</span>\n" |
|
|
|
code += "<span class='line'>#{line}</span>" |
|
|
|
end |
|
|
|
table += "</pre></td><td class='code' width='100%'><pre><code class='#{lang}'>#{code}</code></pre></td></tr></table></div>" |
|
|
|
table += "</pre></td><td class='code'><pre><code class='#{lang}'>#{code}</code></pre></td></tr></table></div>" |
|
|
|
end |
|
|
|
end |
|
|
|