diff options
-rw-r--r-- | Changes.textile | 1 | ||||
-rw-r--r-- | lib/coderay/encoders/html.rb | 14 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Changes.textile b/Changes.textile index e54970d..cd4443a 100644 --- a/Changes.textile +++ b/Changes.textile @@ -33,6 +33,7 @@ h2. Changes in 1.1 * The @Debug@ scanner maps unknown token kinds to @:unknown@ (to avoid creating Symbols based on possibly unsafe input) * The @Raydebug@ scanner highlights unknown token kinds as @:plain@ * @Plugin@ does not warn about fallback when default is defined +* Fixed @HTML@ encoder when output is a StringIO (eg. when using @-HTML@) * @HTML@ encoder will not warn about unclosed token groups at the end of the stream * @Debug@ encoder refactored; use @DebugLint@ if you want strict checking now * @Debug@ encoder will not warn about errors in the token stream diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index ffde5d2..d2ebb5a 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -197,13 +197,15 @@ module Encoders @last_opened = nil end - @out.extend Output - @out.css = @css - if options[:line_numbers] - Numbering.number! @out, options[:line_numbers], options + if @out.respond_to? :to_str + @out.extend Output + @out.css = @css + if options[:line_numbers] + Numbering.number! @out, options[:line_numbers], options + end + @out.wrap! options[:wrap] + @out.apply_title! options[:title] end - @out.wrap! options[:wrap] - @out.apply_title! options[:title] if defined?(@real_out) && @real_out @real_out << @out |