1##
2# A section of text that is added to the output document as-is
3
4class RDoc::Markup::Raw
5
6  ##
7  # The component parts of the list
8
9  attr_reader :parts
10
11  ##
12  # Creates a new Raw containing +parts+
13
14  def initialize *parts
15    @parts = []
16    @parts.concat parts
17  end
18
19  ##
20  # Appends +text+
21
22  def << text
23    @parts << text
24  end
25
26  def == other # :nodoc:
27    self.class == other.class and @parts == other.parts
28  end
29
30  ##
31  # Calls #accept_raw+ on +visitor+
32
33  def accept visitor
34    visitor.accept_raw self
35  end
36
37  ##
38  # Appends +other+'s parts
39
40  def merge other
41    @parts.concat other.parts
42  end
43
44  def pretty_print q # :nodoc:
45    self.class.name =~ /.*::(\w{1,4})/i
46
47    q.group 2, "[#{$1.downcase}: ", ']' do
48      q.seplist @parts do |part|
49        q.pp part
50      end
51    end
52  end
53
54  ##
55  # Appends +texts+ onto this Paragraph
56
57  def push *texts
58    self.parts.concat texts
59  end
60
61  ##
62  # The raw text
63
64  def text
65    @parts.join ' '
66  end
67
68end
69
70