Mercurial > hg > soundsoftware-site
comparison vendor/gems/coderay-1.0.0/lib/coderay/encoders/text.rb @ 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 |
comparison
equal
deleted
inserted
replaced
908:c6c2cbd0afee | 909:cbb26bc654de |
---|---|
1 module CodeRay | |
2 module Encoders | |
3 | |
4 # Concats the tokens into a single string, resulting in the original | |
5 # code string if no tokens were removed. | |
6 # | |
7 # Alias: +plain+, +plaintext+ | |
8 # | |
9 # == Options | |
10 # | |
11 # === :separator | |
12 # A separator string to join the tokens. | |
13 # | |
14 # Default: empty String | |
15 class Text < Encoder | |
16 | |
17 register_for :text | |
18 | |
19 FILE_EXTENSION = 'txt' | |
20 | |
21 DEFAULT_OPTIONS = { | |
22 :separator => nil | |
23 } | |
24 | |
25 def text_token text, kind | |
26 super | |
27 | |
28 if @first | |
29 @first = false | |
30 else | |
31 @out << @sep | |
32 end if @sep | |
33 end | |
34 | |
35 protected | |
36 def setup options | |
37 super | |
38 | |
39 @first = true | |
40 @sep = options[:separator] | |
41 end | |
42 | |
43 end | |
44 | |
45 end | |
46 end |