diff options
author | Etienne Massip <etienne.massip@gmail.com> | 2012-01-26 21:14:59 +0100 |
---|---|---|
committer | Etienne Massip <etienne.massip@gmail.com> | 2012-01-26 21:14:59 +0100 |
commit | 0e8008ad88b4f56e35d71c3029d02ffb4e21120f (patch) | |
tree | 92da233c37df252a7e1ba0781528053c0583237f /lib/coderay/encoders/html | |
parent | 185c4222c4be23cec40b3a91bb8ae481aff398bc (diff) | |
download | coderay-0e8008ad88b4f56e35d71c3029d02ffb4e21120f.tar.gz |
Extracted code making HTML lines independent from numbering code to a specific option in encoder.
Diffstat (limited to 'lib/coderay/encoders/html')
-rw-r--r-- | lib/coderay/encoders/html/numbering.rb | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/coderay/encoders/html/numbering.rb b/lib/coderay/encoders/html/numbering.rb index 15ce11b..904a64f 100644 --- a/lib/coderay/encoders/html/numbering.rb +++ b/lib/coderay/encoders/html/numbering.rb @@ -68,23 +68,11 @@ module Encoders when :inline max_width = (start + line_count).to_s.size line_number = start - nesting = [] output.gsub!(/^.*$\n?/) do |line| - line.chomp! - open = nesting.join - line.scan(%r!<(/)?span[^>]*>?!) do |close,| - if close - nesting.pop - else - nesting << $& - end - end - close = '</span>' * nesting.size - line_number_text = bolding.call line_number indent = ' ' * (max_width - line_number.to_s.size) # TODO: Optimize (10^x) line_number += 1 - "<span class=\"line-numbers\">#{indent}#{line_number_text}</span>#{open}#{line}#{close}\n" + "<span class=\"line-numbers\">#{indent}#{line_number_text}</span>#{line}" end when :table @@ -112,4 +100,4 @@ module Encoders end end -end +end
\ No newline at end of file |