summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/html/numbering.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2012-04-01 00:18:02 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2012-04-01 00:18:02 +0200
commitd68749d4473e3bafb88365cb27728cb61d28ca1d (patch)
tree41e36442a22422f61a1852a2586a8d3982a8bfa3 /lib/coderay/encoders/html/numbering.rb
parent36b1799efc9b74b556ca698c3e3808a363d3fabc (diff)
parentce3a6c7bcc0b7efac4844de859d8c8364476ab0d (diff)
downloadcoderay-d68749d4473e3bafb88365cb27728cb61d28ca1d.tar.gz
Merge remote-tracking branch 'emassip/master' into independent-lines
Diffstat (limited to 'lib/coderay/encoders/html/numbering.rb')
-rw-r--r--lib/coderay/encoders/html/numbering.rb16
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