From 74a3c27cefca0d24ab66e41fbcfde6d2e4e48cb0 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 16 Jun 2013 15:44:45 +0200 Subject: remove monkey patching, wrap, reduce complexity --- lib/coderay/encoders/html.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/coderay/encoders/html.rb') 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>)/) { $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 -- cgit v1.2.1