diff .svn/pristine/55/55c44f6ea2479c136aea73b874b97160faaae047.svn-base @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/pristine/55/55c44f6ea2479c136aea73b874b97160faaae047.svn-base	Fri Feb 24 19:09:32 2012 +0000
@@ -0,0 +1,46 @@
+module CodeRay
+module Encoders
+  
+  # Concats the tokens into a single string, resulting in the original
+  # code string if no tokens were removed.
+  # 
+  # Alias: +plain+, +plaintext+
+  # 
+  # == Options
+  # 
+  # === :separator
+  # A separator string to join the tokens.
+  # 
+  # Default: empty String
+  class Text < Encoder
+    
+    register_for :text
+    
+    FILE_EXTENSION = 'txt'
+    
+    DEFAULT_OPTIONS = {
+      :separator => nil
+    }
+    
+    def text_token text, kind
+      super
+      
+      if @first
+        @first = false
+      else
+        @out << @sep
+      end if @sep
+    end
+    
+  protected
+    def setup options
+      super
+      
+      @first = true
+      @sep = options[:separator]
+    end
+    
+  end
+  
+end
+end