Skip to content

Commit a31b366

Browse files
committed
fix coderay -HTML option
1 parent d9ee837 commit a31b366

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Changes.textile

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ h2. Changes in 1.1
3333
* The @Debug@ scanner maps unknown token kinds to @:unknown@ (to avoid creating Symbols based on possibly unsafe input)
3434
* The @Raydebug@ scanner highlights unknown token kinds as @:plain@
3535
* @Plugin@ does not warn about fallback when default is defined
36+
* Fixed @HTML@ encoder when output is a StringIO (eg. when using @-HTML@)
3637
* @HTML@ encoder will not warn about unclosed token groups at the end of the stream
3738
* @Debug@ encoder refactored; use @DebugLint@ if you want strict checking now
3839
* @Debug@ encoder will not warn about errors in the token stream

lib/coderay/encoders/html.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,15 @@ def finish options
197197
@last_opened = nil
198198
end
199199

200-
@out.extend Output
201-
@out.css = @css
202-
if options[:line_numbers]
203-
Numbering.number! @out, options[:line_numbers], options
200+
if @out.respond_to? :to_str
201+
@out.extend Output
202+
@out.css = @css
203+
if options[:line_numbers]
204+
Numbering.number! @out, options[:line_numbers], options
205+
end
206+
@out.wrap! options[:wrap]
207+
@out.apply_title! options[:title]
204208
end
205-
@out.wrap! options[:wrap]
206-
@out.apply_title! options[:title]
207209

208210
if defined?(@real_out) && @real_out
209211
@real_out << @out

0 commit comments

Comments
 (0)