summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-08-30 16:22:19 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-08-30 16:22:19 +0200
commita31b36683834f39c1581add498cce0b016f20fb5 (patch)
treed1dc1299c2b4131d24500509b0e1ab4477c5c463
parentd9ee8379543c59e75e39a7a233df6639ee7d4160 (diff)
downloadcoderay-a31b36683834f39c1581add498cce0b016f20fb5.tar.gz
fix coderay -HTML optionv1.1.0.rc5
-rw-r--r--Changes.textile1
-rw-r--r--lib/coderay/encoders/html.rb14
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