4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/rghost/parse_text.rb', line 4
def text_to_ps
unless @tag_parse
case @options[:text_align]
when :center, :right then
@text.split(/\n/).map{|l| "#{to_string(l)} :text_proc_cr :nbw " }.to_s
jump_with=':nbw'
when :left,nil then
if self.class == RGhost::Text
return @text.split(/\n/).map{|l| " :text #{to_string(l)} :text_proc nrdp " }.to_s
else
@text.split(/\n/).map{|l| " :text_area #{to_string(l)} :text_proc_cr :nbw " }.to_s
jump_with='nrdp'
end
end
end
jump_with=':nbw' if self.class == RGhost::TextArea
ret=@text.split(/<br\/?>|\n/).map do |piece|
text_ok=""
piece.scan(/<([^>]+)>([^<]*.)<\/\1>|([^<>]+)/).each do |t|
t.compact!
if t && t.size == 1
text_ok << ta_entry(t.first.to_s)
else
text_ok << ta_entry(t[1],t.first)
end
end
text_ok
end
ret.join(" #{jump_with || 'nrdp' } ").gsub(/</,'<').gsub(/>/,'>')
end
|