summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2008-01-07 14:42:47 +0000
committermurphy <murphy@rubychan.de>2008-01-07 14:42:47 +0000
commite127b7d57b06554e708752bbbc2a85e833633c26 (patch)
treeccd44c344594ccacdcd95a1e1dfc35488cb2c58d /lib/coderay/encoders
parentbbbbc70a0b2efcd03bbcaf4e08ac139e7969e608 (diff)
downloadcoderay-e127b7d57b06554e708752bbbc2a85e833633c26.tar.gz
Lib:
- Encoder: removed a warning - Encoders::HTML: don't shadow outer variable - Plugin: move require_plugin into class namespace - Ruby Scanner: - "alias" keyword recognition - better regexp/division distinction - recognize ~, !, !=, and !~ as method names (partly Ruby 1.9 only) - reordered states for speed Tests: - updated coderay-suite to use gem instead of require_gem - general improvements (more colors!, new parameter: new, new syntax lang.test for only and new) - fixed ruby suite - adjusted a lot of Ruby tests (alias uses methods now) - new tests: ruby/operators, ruby/regexp Samples: - fixed/updated ('bout time) Rake tasks: - updated to use new rubygems API
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r--lib/coderay/encoders/html.rb2
-rw-r--r--lib/coderay/encoders/html/numerization.rb10
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index 4981585..2edcf1d 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -136,7 +136,7 @@ module Encoders
when :debug
classes.inspect
end
- " title=\"#{title}\""
+ title ? " title=\"#{title}\"" : ''
end
def setup options
diff --git a/lib/coderay/encoders/html/numerization.rb b/lib/coderay/encoders/html/numerization.rb
index 1e4a4ed..d784bbe 100644
--- a/lib/coderay/encoders/html/numerization.rb
+++ b/lib/coderay/encoders/html/numerization.rb
@@ -51,12 +51,12 @@ module Encoders
case mode
when :inline
max_width = (start + line_count).to_s.size
- line = start
+ line_number = start
gsub!(/^/) do
- line_number = bolding.call line
- indent = ' ' * (max_width - line.to_s.size)
- res = "<span class=\"no\">#{indent}#{line_number}</span> "
- line += 1
+ line_number_text = bolding.call line_number
+ indent = ' ' * (max_width - line_number.to_s.size) # TODO: Optimize (10^x)
+ res = "<span class=\"no\">#{indent}#{line_number_text}</span> "
+ line_number += 1
res
end