diff options
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r-- | lib/coderay/encoders/debug.rb | 2 | ||||
-rw-r--r-- | lib/coderay/encoders/html.rb | 6 | ||||
-rw-r--r-- | lib/coderay/encoders/text.rb | 6 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb index 21d4710..8e1c0f0 100644 --- a/lib/coderay/encoders/debug.rb +++ b/lib/coderay/encoders/debug.rb @@ -22,7 +22,7 @@ module Encoders if kind == :space text else - text = text.gsub(/[)\\]/, '\\\\\0') + text = text.gsub(/[)\\]/, '\\\\\0') # escape ) and \ "#{kind}(#{text})" end end diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index 32e35f8..0c66f68 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -167,7 +167,11 @@ module Encoders else '' end - h[k.dup] = '<span%s class="%s">' % [title, c] + if c == :NO_HIGHLIGHT + h[k.dup] = '<span%s>' % [title] + else + h[k.dup] = '<span%s class="%s">' % [title, c] + end end end diff --git a/lib/coderay/encoders/text.rb b/lib/coderay/encoders/text.rb index 7493280..14282ac 100644 --- a/lib/coderay/encoders/text.rb +++ b/lib/coderay/encoders/text.rb @@ -14,12 +14,12 @@ module Encoders protected def setup options - super + @out = '' @sep = options[:separator] end - def text_token text, kind - text + @sep + def token text, kind + @out << text + @sep if text.is_a? ::String end def finish options |