From 5efcf487985e7348ed3d39f33b7185028a6e3716 Mon Sep 17 00:00:00 2001 From: murphy Date: Sat, 21 May 2011 03:03:31 +0000 Subject: various fixes and cleanups in CodeRay's helpers --- lib/coderay/encoders/_map.rb | 4 +++- lib/coderay/encoders/statistic.rb | 2 +- lib/coderay/encoders/text.rb | 18 +++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'lib/coderay/encoders') diff --git a/lib/coderay/encoders/_map.rb b/lib/coderay/encoders/_map.rb index 7c6712f..b4b766a 100644 --- a/lib/coderay/encoders/_map.rb +++ b/lib/coderay/encoders/_map.rb @@ -2,9 +2,11 @@ module CodeRay module Encoders map \ - :loc => :lines_of_code, + :loc => :lines_of_code, :term => :terminal, + :tty => :terminal, :plain => :text, + :plaintext => :text, :remove_comments => :comment_filter, :stats => :statistic, :tex => :latex diff --git a/lib/coderay/encoders/statistic.rb b/lib/coderay/encoders/statistic.rb index 4a6a845..e52f28f 100644 --- a/lib/coderay/encoders/statistic.rb +++ b/lib/coderay/encoders/statistic.rb @@ -6,7 +6,7 @@ module Encoders # Alias: +stats+ class Statistic < Encoder - register_for :stats, :statistic + register_for :statistic attr_reader :type_stats, :real_token_count # :nodoc: diff --git a/lib/coderay/encoders/text.rb b/lib/coderay/encoders/text.rb index 54a00dc..84e2215 100644 --- a/lib/coderay/encoders/text.rb +++ b/lib/coderay/encoders/text.rb @@ -4,7 +4,7 @@ module Encoders # Concats the tokens into a single string, resulting in the original # code string if no tokens were removed. # - # Alias: +plain+ + # Alias: +plain+, +plaintext+ # # == Options # @@ -13,31 +13,31 @@ module Encoders # # Default: empty String class Text < Encoder - + register_for :text - + FILE_EXTENSION = 'txt' - + DEFAULT_OPTIONS = { :separator => nil } - + def text_token text, kind super @out << @sep if @sep end - + protected def setup options super @sep = options[:separator] end - + def finish options super.chomp @sep end - + end - + end end -- cgit v1.2.1