From fea5260ce014ee521955c5afc929f3cae71a4c73 Mon Sep 17 00:00:00 2001 From: murphy Date: Wed, 15 Mar 2006 21:58:19 +0000 Subject: Ruby scanner errors fixed. demo_dump and demo_encoder updated for new YAML version. Fixes in output.rb and numerization.rb --- lib/coderay/encoders/html/numerization.rb | 4 ++-- lib/coderay/encoders/html/output.rb | 2 +- lib/coderay/scanners/ruby.rb | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/coderay/encoders/html/numerization.rb b/lib/coderay/encoders/html/numerization.rb index f51b5d3..edce9eb 100644 --- a/lib/coderay/encoders/html/numerization.rb +++ b/lib/coderay/encoders/html/numerization.rb @@ -12,9 +12,9 @@ module CodeRay NUMERIZABLE_WRAPPINGS = { :table => [:div, :page], :inline => :all, - :list => [:div, :page], - nil => :all + :list => [:div, :page] } + NUMERIZABLE_WRAPPINGS.default = :all def numerize! mode = :table, options = {} return self unless mode diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index 36018a7..8096dc8 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -25,7 +25,7 @@ module CodeRay # # a = Output.new 'Code' # a.wrap! :page - def new string, css, element = nil + def new string, css = CSS.new, element = nil output = string.clone.extend self output.wrapped_in = element output.css = css diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 6b4c8ea..8952422 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -134,7 +134,7 @@ module CodeRay module Scanners last_state = state # scan one token as normal code, then return here state = :initial else - raise 'else-case # reached; #%p not handled' % peek(1), tokens + raise_inspect 'else-case # reached; #%p not handled' % peek(1), tokens end when state.paren @@ -145,7 +145,7 @@ module CodeRay module Scanners tokens << [match, :function] else - raise 'else-case " reached; %p not handled, state = %p' % [match, state], tokens + raise_inspect 'else-case " reached; %p not handled, state = %p' % [match, state], tokens end next @@ -178,7 +178,7 @@ module CodeRay module Scanners type = :comment regexp_allowed = true else - raise 'else-case _ reached, because case %p was not handled' % [matched[0].chr], tokens + raise_inspect 'else-case _ reached, because case %p was not handled' % [matched[0].chr], tokens end tokens << [match, type] next @@ -274,7 +274,7 @@ module CodeRay module Scanners elsif fancy_allowed and match = scan(/#{FANCY_START}/o) type, interpreted = *FancyStringType.fetch(self[1]) do - raise 'Unknown fancy string: %%%p' % k, tokens + raise_inspect 'Unknown fancy string: %%%p' % k, tokens end tokens << [:open, type] state = StringState.new type, interpreted, self[2] -- cgit v1.2.1