summaryrefslogtreecommitdiff
path: root/lib/coderay
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay')
-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
-rw-r--r--lib/coderay/scanners/ruby.rb7
4 files changed, 11 insertions, 11 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 }
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb
index a50893a..1ceb3d5 100644
--- a/lib/coderay/scanners/ruby.rb
+++ b/lib/coderay/scanners/ruby.rb
@@ -43,7 +43,6 @@ module CodeRay module Scanners
if state.instance_of? StringState
# {{{
-
match = scan_until(state.pattern) || scan_until(/\z/)
tokens << [match, :content] unless match.empty?
break if eos?
@@ -128,7 +127,7 @@ module CodeRay module Scanners
fancy_allowed = regexp_allowed = true
state = :initial
depth = 1
- tokens << [:open, :escape]
+ tokens << [:open, :inline]
tokens << [match + getch, :delimiter]
when ?$, ?@
tokens << [match, :escape]
@@ -196,8 +195,8 @@ module CodeRay module Scanners
depth -= 1
if depth == 0
state, depth, heredocs = states.pop
- tokens << [match + getch, :delimiter]
- type = :escape
+ tokens << [match, :delimiter]
+ type = :inline
match = :close
end
end