From a4052158f89068317e5a374cc553ef95de1a842a Mon Sep 17 00:00:00 2001 From: murphy Date: Sun, 16 Oct 2005 10:50:34 +0000 Subject: scanners/ruby.rb: fixed string inline code encoders/helpers/html_css.rb and html_helper.rb: added :inline token encoders/helpers/html_output.rb: made wrapped_in an attr_accessor; fixed option handling in numerize! --- lib/coderay/encoders/helpers/html_css.rb | 1 + lib/coderay/encoders/helpers/html_helper.rb | 1 + lib/coderay/encoders/helpers/html_output.rb | 13 ++++++------- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/coderay/encoders/helpers') diff --git a/lib/coderay/encoders/helpers/html_css.rb b/lib/coderay/encoders/helpers/html_css.rb index a3c50eb..6629bbf 100644 --- a/lib/coderay/encoders/helpers/html_css.rb +++ b/lib/coderay/encoders/helpers/html_css.rb @@ -102,6 +102,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } .hx { color:#058; font-weight:bold; } .i { color:#00D; font-weight:bold; } .ic { color:#B44; font-weight:bold; } +.il { } .in { color:#B2B; font-weight:bold; } .iv { color:#33B; } .la { color:#970; font-weight:bold; } diff --git a/lib/coderay/encoders/helpers/html_helper.rb b/lib/coderay/encoders/helpers/html_helper.rb index 03ea0a2..6a2938e 100644 --- a/lib/coderay/encoders/helpers/html_helper.rb +++ b/lib/coderay/encoders/helpers/html_helper.rb @@ -28,6 +28,7 @@ module CodeRay module Encoders :global_variable => 'gv', :hex => 'hx', :include => 'ic', + :inline => 'il', :instance_variable => 'iv', :integer => 'i', :interpreted => 'in', diff --git a/lib/coderay/encoders/helpers/html_output.rb b/lib/coderay/encoders/helpers/html_output.rb index f6a2b11..849fe1a 100644 --- a/lib/coderay/encoders/helpers/html_output.rb +++ b/lib/coderay/encoders/helpers/html_output.rb @@ -13,6 +13,8 @@ module CodeRay # TODO: more doc. module Output + attr_accessor :wrapped_in + class << self # This makes Output look like a class. @@ -53,11 +55,6 @@ module CodeRay wrapper :div, :span, :page - def wrapped_in - @wrapped_in ||= nil - end - attr_writer :wrapped_in - def wrapped_in? element wrapped_in == element end @@ -100,7 +97,9 @@ module CodeRay def numerize! mode = :table, options = {} return self unless mode - start = options.fetch :line_number_start, DEFAULT_OPTIONS[:line_number_start] + options = DEFAULT_OPTIONS.merge options + + start = options[:line_number_start] unless start.is_a? Integer raise ArgumentError, "Invalid value %p for :line_number_start; Integer expected." % start end @@ -109,7 +108,7 @@ module CodeRay raise ArgumentError, "Can't numerize, :wrap must be in %p, but is %p" % [NUMERIZABLE_WRAPPINGS, options[:wrap]] end - bold_every = options.fetch :bold_every, DEFAULT_OPTIONS[:bold_every] + bold_every = options[:bold_every] bolding = if bold_every == :no_bolding or bold_every == 0 proc { |line| line.to_s } -- cgit v1.2.1