summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2005-10-16 10:50:34 +0000
committermurphy <murphy@rubychan.de>2005-10-16 10:50:34 +0000
commita4052158f89068317e5a374cc553ef95de1a842a (patch)
tree19727dcdbac840d562279e876ddfafa00a52dc95 /lib/coderay/encoders
parent48e144a20829faaeca9a7db8fbc6128f1f5d7297 (diff)
downloadcoderay-a4052158f89068317e5a374cc553ef95de1a842a.tar.gz
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!
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r--lib/coderay/encoders/helpers/html_css.rb1
-rw-r--r--lib/coderay/encoders/helpers/html_helper.rb1
-rw-r--r--lib/coderay/encoders/helpers/html_output.rb13
3 files changed, 8 insertions, 7 deletions
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 }