diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-16 15:44:45 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-16 15:44:45 +0200 |
commit | 74a3c27cefca0d24ab66e41fbcfde6d2e4e48cb0 (patch) | |
tree | 331f31ed49a2fbb060000149d30f1e7dde85aaee /lib/coderay/encoders/html.rb | |
parent | 927cc5b5c56017ee93bee208307bfa67cf90c9d7 (diff) | |
download | coderay-74a3c27cefca0d24ab66e41fbcfde6d2e4e48cb0.tar.gz |
remove monkey patching, wrap, reduce complexity
Diffstat (limited to 'lib/coderay/encoders/html.rb')
-rw-r--r-- | lib/coderay/encoders/html.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index b897f5e..5a10721 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -198,13 +198,11 @@ module Encoders @last_opened = nil end - @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] + @out = Output.wrap_string_in @out, options[:wrap], @css if options[:wrap] + @out = @out.sub(/(<title>)(<\/title>)/) { $1 + options[:title] + $2 } if options[:title] if defined?(@real_out) && @real_out @real_out << @out @@ -272,6 +270,10 @@ module Encoders raise ArgumentError, 'Unknown value %p for :css.' % [options[:css]] end + unless [nil, false, :span, :div, :page].include? options[:wrap] + raise ArgumentError, 'Unknown value %p for :wrap.' % [options[:wrap]] + end + options[:break_lines] = true if options[:line_numbers] == :inline end |