From c1b6c6339f602b8ecf69c8cb330319d99e039063 Mon Sep 17 00:00:00 2001 From: murphy Date: Sat, 10 Dec 2005 04:20:30 +0000 Subject: Plugin System extended: - helper method - path names are expanded encoders/html.rb, div.rb, span.rb, ruby.rb: - using new methods (fixes problems with rdoc and test tasks): renamed scanners/ruby/helper.rb to patterns.rb encoders/statistic.rb: sorting made deterministic (for unit testing) --- lib/coderay/encoders/div.rb | 3 ++- lib/coderay/encoders/html.rb | 4 +--- lib/coderay/encoders/span.rb | 3 ++- lib/coderay/encoders/statistic.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/coderay/encoders') diff --git a/lib/coderay/encoders/div.rb b/lib/coderay/encoders/div.rb index d3e595d..2379a4c 100644 --- a/lib/coderay/encoders/div.rb +++ b/lib/coderay/encoders/div.rb @@ -1,6 +1,7 @@ module CodeRay module Encoders - require 'coderay/encoders/html' + load :html + class Div < HTML FILE_EXTENSION = 'div.html' diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index e456356..a755b47 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -82,9 +82,7 @@ module Encoders :hint => false, } - require 'coderay/encoders/html/classes' - require 'coderay/encoders/html/output' - require 'coderay/encoders/html/css' + helper :classes, :output, :css attr_reader :css diff --git a/lib/coderay/encoders/span.rb b/lib/coderay/encoders/span.rb index abd8a39..e222889 100644 --- a/lib/coderay/encoders/span.rb +++ b/lib/coderay/encoders/span.rb @@ -1,6 +1,7 @@ module CodeRay module Encoders - require 'coderay/encoders/html' + load :html + class Span < HTML FILE_EXTENSION = 'span.html' diff --git a/lib/coderay/encoders/statistic.rb b/lib/coderay/encoders/statistic.rb index cd26272..b8905ff 100644 --- a/lib/coderay/encoders/statistic.rb +++ b/lib/coderay/encoders/statistic.rb @@ -64,7 +64,7 @@ Token Types (%d): @type_stats.each do |type, stat| stat.size /= stat.count.to_f end - types_stats = @type_stats.sort_by { |k, v| -v.count }.map do |k, v| + types_stats = @type_stats.sort_by { |k, v| [-v.count, k.to_s] }.map do |k, v| TOKEN_TYPES_ROW % [k, v.count, 100.0 * v.count / all_count, v.size] end.join STATS % [ -- cgit v1.2.1