From 75bc5455af8c3c3381066aac3d5fff42264cac6f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 19 Aug 2011 03:09:35 +0200 Subject: Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests --- lib/coderay/encoders/html.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/coderay/encoders/html.rb') 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 << '' 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 -- cgit v1.2.1