summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/html.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-08-19 03:09:35 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-08-19 03:09:35 +0200
commit75bc5455af8c3c3381066aac3d5fff42264cac6f (patch)
tree589d2c912ddd94c517eb794bcdf3257f8348f3c0 /lib/coderay/encoders/html.rb
parentfdd17b6a09efb275238a3baef275465d31452f2a (diff)
downloadcoderay-75bc5455af8c3c3381066aac3d5fff42264cac6f.tar.gz
Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests
Diffstat (limited to 'lib/coderay/encoders/html.rb')
-rw-r--r--lib/coderay/encoders/html.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb
index ec73d2c..abbafad 100644
--- a/lib/coderay/encoders/html.rb
+++ b/lib/coderay/encoders/html.rb
@@ -164,6 +164,11 @@ module Encoders
def setup options
super
+ if options[:wrap] || options[:line_numbers]
+ @real_out = @out
+ @out = ''
+ end
+
@HTML_ESCAPE = HTML_ESCAPE.dup
@HTML_ESCAPE["\t"] = ' ' * options[:tab_width]
@@ -214,7 +219,7 @@ module Encoders
def finish options
unless @opened.empty?
- warn '%d tokens still open: %p' % [@opened.size, @opened]
+ warn '%d tokens still open: %p' % [@opened.size, @opened] if $CODERAY_DEBUG
@out << '</span>' while @opened.pop
@last_opened = nil
end
@@ -227,6 +232,11 @@ module Encoders
@out.wrap! options[:wrap]
@out.apply_title! options[:title]
+ if defined?(@real_out) && @real_out
+ @real_out << @out
+ @out = @real_out
+ end
+
super
end