rdoc 6.17.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +193 -0
  3. data/LEGAL.rdoc +6 -0
  4. data/LICENSE.rdoc +4 -0
  5. data/README.md +132 -8
  6. data/RI.md +75 -75
  7. data/doc/markup_reference/markdown.md +659 -0
  8. data/doc/markup_reference/rdoc.rdoc +1169 -0
  9. data/exe/rdoc +2 -2
  10. data/lib/rdoc/code_object/alias.rb +70 -74
  11. data/lib/rdoc/code_object/any_method.rb +308 -293
  12. data/lib/rdoc/code_object/attr.rb +150 -142
  13. data/lib/rdoc/code_object/class_module.rb +802 -715
  14. data/lib/rdoc/code_object/constant.rb +181 -144
  15. data/lib/rdoc/code_object/context/section.rb +140 -130
  16. data/lib/rdoc/code_object/context.rb +925 -941
  17. data/lib/rdoc/code_object/extend.rb +7 -5
  18. data/lib/rdoc/code_object/include.rb +7 -5
  19. data/lib/rdoc/code_object/method_attr.rb +328 -315
  20. data/lib/rdoc/code_object/mixin.rb +97 -92
  21. data/lib/rdoc/code_object/normal_class.rb +77 -78
  22. data/lib/rdoc/code_object/normal_module.rb +61 -59
  23. data/lib/rdoc/code_object/require.rb +23 -39
  24. data/lib/rdoc/code_object/single_class.rb +21 -19
  25. data/lib/rdoc/code_object/top_level.rb +215 -202
  26. data/lib/rdoc/code_object.rb +305 -305
  27. data/lib/rdoc/comment.rb +274 -337
  28. data/lib/rdoc/cross_reference.rb +195 -206
  29. data/lib/rdoc/encoding.rb +105 -103
  30. data/lib/rdoc/erb_partial.rb +13 -11
  31. data/lib/rdoc/erbio.rb +29 -27
  32. data/lib/rdoc/generator/aliki.rb +196 -30
  33. data/lib/rdoc/generator/darkfish.rb +647 -629
  34. data/lib/rdoc/generator/json_index.rb +233 -229
  35. data/lib/rdoc/generator/markup.rb +165 -122
  36. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  37. data/lib/rdoc/generator/pot/po.rb +52 -51
  38. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  39. data/lib/rdoc/generator/pot.rb +85 -81
  40. data/lib/rdoc/generator/ri.rb +23 -19
  41. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  42. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  43. data/lib/rdoc/generator/template/aliki/_footer.rhtml +2 -2
  44. data/lib/rdoc/generator/template/aliki/_head.rhtml +15 -10
  45. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  46. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  47. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  48. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  49. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +3 -3
  50. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
  51. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  52. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  53. data/lib/rdoc/generator/template/aliki/class.rhtml +71 -61
  54. data/lib/rdoc/generator/template/aliki/css/rdoc.css +796 -323
  55. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/js/aliki.js +119 -113
  57. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  58. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
  59. data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
  60. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  61. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  62. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  63. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  64. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  68. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  69. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +2 -2
  70. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  71. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  72. data/lib/rdoc/generator/template/darkfish/class.rhtml +29 -32
  73. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -1
  74. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  75. data/lib/rdoc/generator.rb +48 -46
  76. data/lib/rdoc/i18n/locale.rb +99 -95
  77. data/lib/rdoc/i18n/text.rb +109 -105
  78. data/lib/rdoc/i18n.rb +7 -5
  79. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  80. data/lib/rdoc/markdown.kpeg +52 -33
  81. data/lib/rdoc/markdown.rb +365 -177
  82. data/lib/rdoc/markup/blank_line.rb +25 -23
  83. data/lib/rdoc/markup/block_quote.rb +12 -8
  84. data/lib/rdoc/markup/document.rb +127 -123
  85. data/lib/rdoc/markup/element.rb +21 -0
  86. data/lib/rdoc/markup/formatter.rb +220 -203
  87. data/lib/rdoc/markup/hard_break.rb +30 -27
  88. data/lib/rdoc/markup/heading.rb +163 -77
  89. data/lib/rdoc/markup/include.rb +33 -29
  90. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  91. data/lib/rdoc/markup/inline_parser.rb +316 -0
  92. data/lib/rdoc/markup/list.rb +80 -88
  93. data/lib/rdoc/markup/list_item.rb +73 -85
  94. data/lib/rdoc/markup/paragraph.rb +23 -19
  95. data/lib/rdoc/markup/parser.rb +501 -497
  96. data/lib/rdoc/markup/pre_process.rb +284 -305
  97. data/lib/rdoc/markup/raw.rb +52 -55
  98. data/lib/rdoc/markup/rule.rb +16 -12
  99. data/lib/rdoc/markup/table.rb +48 -40
  100. data/lib/rdoc/markup/to_ansi.rb +143 -92
  101. data/lib/rdoc/markup/to_bs.rb +86 -102
  102. data/lib/rdoc/markup/to_html.rb +608 -506
  103. data/lib/rdoc/markup/to_html_crossref.rb +219 -210
  104. data/lib/rdoc/markup/to_html_snippet.rb +210 -205
  105. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  106. data/lib/rdoc/markup/to_label.rb +64 -51
  107. data/lib/rdoc/markup/to_markdown.rb +212 -184
  108. data/lib/rdoc/markup/to_rdoc.rb +341 -277
  109. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  110. data/lib/rdoc/markup/to_test.rb +62 -50
  111. data/lib/rdoc/markup/to_tt_only.rb +83 -92
  112. data/lib/rdoc/markup/verbatim.rb +62 -58
  113. data/lib/rdoc/markup.rb +196 -215
  114. data/lib/rdoc/options.rb +1063 -1076
  115. data/lib/rdoc/parser/c.rb +1039 -1036
  116. data/lib/rdoc/parser/changelog.rb +320 -287
  117. data/lib/rdoc/parser/markdown.rb +17 -13
  118. data/lib/rdoc/parser/rbs.rb +279 -0
  119. data/lib/rdoc/parser/rd.rb +17 -13
  120. data/lib/rdoc/parser/ruby.rb +1231 -2222
  121. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  122. data/lib/rdoc/parser/simple.rb +31 -27
  123. data/lib/rdoc/parser/text.rb +12 -8
  124. data/lib/rdoc/parser.rb +230 -221
  125. data/lib/rdoc/rbs_helper.rb +186 -0
  126. data/lib/rdoc/rd/inline.rb +57 -53
  127. data/lib/rdoc/rd.rb +90 -88
  128. data/lib/rdoc/rdoc.rb +547 -366
  129. data/lib/rdoc/ri/driver.rb +1141 -1130
  130. data/lib/rdoc/ri/formatter.rb +7 -3
  131. data/lib/rdoc/ri/paths.rb +140 -136
  132. data/lib/rdoc/ri/servlet.rb +456 -0
  133. data/lib/rdoc/ri/store.rb +4 -2
  134. data/lib/rdoc/ri/task.rb +55 -51
  135. data/lib/rdoc/ri.rb +14 -11
  136. data/lib/rdoc/rubygems_hook.rb +194 -192
  137. data/lib/rdoc/server.rb +462 -0
  138. data/lib/rdoc/stats/normal.rb +46 -42
  139. data/lib/rdoc/stats/quiet.rb +39 -35
  140. data/lib/rdoc/stats/verbose.rb +35 -31
  141. data/lib/rdoc/stats.rb +363 -338
  142. data/lib/rdoc/store.rb +919 -725
  143. data/lib/rdoc/task.rb +260 -255
  144. data/lib/rdoc/text.rb +164 -240
  145. data/lib/rdoc/token_stream.rb +88 -106
  146. data/lib/rdoc/tom_doc.rb +203 -201
  147. data/lib/rdoc/version.rb +1 -1
  148. data/lib/rdoc.rb +35 -7
  149. data/lib/rubygems_plugin.rb +2 -11
  150. data/rdoc-logo.svg +43 -0
  151. data/rdoc.gemspec +9 -7
  152. metadata +46 -32
  153. data/CONTRIBUTING.rdoc +0 -219
  154. data/ExampleMarkdown.md +0 -39
  155. data/ExampleRDoc.rdoc +0 -210
  156. data/lib/rdoc/code_object/anon_class.rb +0 -10
  157. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  158. data/lib/rdoc/code_object/meta_method.rb +0 -6
  159. data/lib/rdoc/markdown/literals.kpeg +0 -21
  160. data/lib/rdoc/markdown/literals.rb +0 -454
  161. data/lib/rdoc/markup/attr_changer.rb +0 -22
  162. data/lib/rdoc/markup/attr_span.rb +0 -35
  163. data/lib/rdoc/markup/attribute_manager.rb +0 -405
  164. data/lib/rdoc/markup/attributes.rb +0 -70
  165. data/lib/rdoc/markup/regexp_handling.rb +0 -40
  166. data/lib/rdoc/parser/prism_ruby.rb +0 -1100
  167. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  168. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  169. data/lib/rdoc/servlet.rb +0 -452
@@ -1,266 +1,279 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A TopLevel context is a representation of the contents of a single file
2
+ module RDoc
3
+ ##
4
+ # A TopLevel context is a representation of the contents of a single file
4
5
 
5
- class RDoc::TopLevel < RDoc::Context
6
+ class TopLevel < Context
6
7
 
7
- MARSHAL_VERSION = 0 # :nodoc:
8
+ MARSHAL_VERSION = 0 # :nodoc:
8
9
 
9
- ##
10
- # Relative name of this file
10
+ ##
11
+ # Relative name of this file
11
12
 
12
- attr_accessor :relative_name
13
+ attr_accessor :relative_name
13
14
 
14
- ##
15
- # Absolute name of this file
15
+ ##
16
+ # Absolute name of this file
16
17
 
17
- attr_accessor :absolute_name
18
+ attr_accessor :absolute_name
18
19
 
19
- ##
20
- # Base name of this file
20
+ ##
21
+ # Base name of this file
21
22
 
22
- attr_reader :base_name
23
+ attr_reader :base_name
23
24
 
24
- ##
25
- # Base name of this file without the extension
25
+ ##
26
+ # Base name of this file without the extension
26
27
 
27
- attr_reader :page_name
28
+ attr_reader :page_name
28
29
 
29
- ##
30
- # All the classes or modules that were declared in
31
- # this file. These are assigned to either +#classes_hash+
32
- # or +#modules_hash+ once we know what they really are.
30
+ ##
31
+ # All the classes or modules that were declared in
32
+ # this file. These are assigned to either +#classes_hash+
33
+ # or +#modules_hash+ once we know what they really are.
33
34
 
34
- attr_reader :classes_or_modules
35
+ attr_reader :classes_or_modules
35
36
 
36
- ##
37
- # The parser class that processed this file
37
+ ##
38
+ # The parser class that processed this file
38
39
 
39
- attr_reader :parser
40
+ attr_accessor :parser
40
41
 
41
- ##
42
- # Creates a new TopLevel for the file at +absolute_name+. If documentation
43
- # is being generated outside the source dir +relative_name+ is relative to
44
- # the source directory.
45
-
46
- def initialize(absolute_name, relative_name = absolute_name)
47
- super()
48
- @name = nil
49
- @absolute_name = absolute_name
50
- @relative_name = relative_name
51
- @parser = nil
52
-
53
- if relative_name
54
- @base_name = File.basename(relative_name)
55
- @page_name = @base_name.sub(/\.(rb|rdoc|txt|md)\z/i, '')
56
- else
57
- @base_name = nil
58
- @page_name = nil
42
+ ##
43
+ # Creates a new TopLevel for the file at +absolute_name+. If documentation
44
+ # is being generated outside the source dir +relative_name+ is relative to
45
+ # the source directory.
46
+
47
+ def initialize(absolute_name, relative_name = absolute_name)
48
+ super()
49
+ @name = nil
50
+ @absolute_name = absolute_name
51
+ @relative_name = relative_name
52
+ @parser = nil
53
+
54
+ if relative_name
55
+ @base_name = File.basename(relative_name)
56
+ @page_name = @base_name.sub(/\.(rb|rdoc|txt|md)\z/i, '')
57
+ else
58
+ @base_name = nil
59
+ @page_name = nil
60
+ end
61
+
62
+ @classes_or_modules = []
59
63
  end
60
64
 
61
- @classes_or_modules = []
62
- end
65
+ ##
66
+ # An RDoc::TopLevel is equal to another with the same relative_name
63
67
 
64
- ##
65
- # Sets the parser for this toplevel context, also the store.
68
+ def ==(other)
69
+ self.class === other and @relative_name == other.relative_name
70
+ end
66
71
 
67
- def parser=(val)
68
- @parser = val
69
- @store.update_parser_of_file(absolute_name, val) if @store
70
- @parser
71
- end
72
+ alias eql? ==
72
73
 
73
- ##
74
- # An RDoc::TopLevel is equal to another with the same relative_name
74
+ ##
75
+ # Adds +an_alias+ to +Object+ instead of +self+.
75
76
 
76
- def ==(other)
77
- self.class === other and @relative_name == other.relative_name
78
- end
77
+ def add_alias(an_alias)
78
+ object_class.record_location self
79
+ return an_alias unless @document_self
80
+ object_class.add_alias an_alias
81
+ end
79
82
 
80
- alias eql? ==
83
+ ##
84
+ # Adds +constant+ to +Object+ instead of +self+.
81
85
 
82
- ##
83
- # Adds +an_alias+ to +Object+ instead of +self+.
86
+ def add_constant(constant)
87
+ object_class.record_location self
88
+ return constant unless @document_self
89
+ object_class.add_constant constant
90
+ end
84
91
 
85
- def add_alias(an_alias)
86
- object_class.record_location self
87
- return an_alias unless @document_self
88
- object_class.add_alias an_alias
89
- end
92
+ ##
93
+ # Adds +include+ to +Object+ instead of +self+.
90
94
 
91
- ##
92
- # Adds +constant+ to +Object+ instead of +self+.
95
+ def add_include(include)
96
+ object_class.record_location self
97
+ return include unless @document_self
98
+ object_class.add_include include
99
+ end
93
100
 
94
- def add_constant(constant)
95
- object_class.record_location self
96
- return constant unless @document_self
97
- object_class.add_constant constant
98
- end
101
+ ##
102
+ # Adds +method+ to +Object+ instead of +self+.
99
103
 
100
- ##
101
- # Adds +include+ to +Object+ instead of +self+.
104
+ def add_method(method)
105
+ object_class.record_location self
106
+ return method unless @document_self
107
+ object_class.add_method method
108
+ end
102
109
 
103
- def add_include(include)
104
- object_class.record_location self
105
- return include unless @document_self
106
- object_class.add_include include
107
- end
110
+ ##
111
+ # Adds class or module +mod+. Used in the building phase
112
+ # by the Ruby parser.
108
113
 
109
- ##
110
- # Adds +method+ to +Object+ instead of +self+.
114
+ def add_to_classes_or_modules(mod)
115
+ @classes_or_modules << mod
116
+ end
111
117
 
112
- def add_method(method)
113
- object_class.record_location self
114
- return method unless @document_self
115
- object_class.add_method method
116
- end
118
+ alias name base_name
117
119
 
118
- ##
119
- # Adds class or module +mod+. Used in the building phase
120
- # by the Ruby parser.
120
+ ##
121
+ # See RDoc::TopLevel::find_class_or_module
122
+ #--
123
+ # TODO Why do we search through all classes/modules found, not just the
124
+ # ones of this instance?
121
125
 
122
- def add_to_classes_or_modules(mod)
123
- @classes_or_modules << mod
124
- end
126
+ def find_class_or_module(name)
127
+ @store.find_class_or_module name
128
+ end
125
129
 
126
- alias name base_name
130
+ ##
131
+ # Finds a class or module named +symbol+
127
132
 
128
- ##
129
- # See RDoc::TopLevel::find_class_or_module
130
- #--
131
- # TODO Why do we search through all classes/modules found, not just the
132
- # ones of this instance?
133
+ def find_local_symbol(symbol)
134
+ find_class_or_module(symbol) || super
135
+ end
133
136
 
134
- def find_class_or_module(name)
135
- @store.find_class_or_module name
136
- end
137
+ ##
138
+ # Finds a module or class with +name+
137
139
 
138
- ##
139
- # Finds a class or module named +symbol+
140
+ def find_module_named(name)
141
+ find_class_or_module(name)
142
+ end
140
143
 
141
- def find_local_symbol(symbol)
142
- find_class_or_module(symbol) || super
143
- end
144
+ alias get_module_named find_module_named
144
145
 
145
- ##
146
- # Finds a module or class with +name+
146
+ ##
147
+ # Returns the relative name of this file
147
148
 
148
- def find_module_named(name)
149
- find_class_or_module(name)
150
- end
149
+ def full_name
150
+ @relative_name
151
+ end
151
152
 
152
- ##
153
- # Returns the relative name of this file
153
+ ##
154
+ # An RDoc::TopLevel has the same hash as another with the same
155
+ # relative_name
154
156
 
155
- def full_name
156
- @relative_name
157
- end
157
+ def hash
158
+ @relative_name.hash
159
+ end
158
160
 
159
- ##
160
- # An RDoc::TopLevel has the same hash as another with the same
161
- # relative_name
161
+ ##
162
+ # URL for this with a +prefix+
162
163
 
163
- def hash
164
- @relative_name.hash
165
- end
164
+ def http_url
165
+ @relative_name.tr('.', '_') + '.html'
166
+ end
166
167
 
167
- ##
168
- # URL for this with a +prefix+
168
+ def inspect # :nodoc:
169
+ "#<%s:0x%x %p modules: %p classes: %p>" % [
170
+ self.class, object_id,
171
+ base_name,
172
+ @modules.map { |n, m| m },
173
+ @classes.map { |n, c| c }
174
+ ]
175
+ end
169
176
 
170
- def http_url
171
- @relative_name.tr('.', '_') + '.html'
172
- end
177
+ ##
178
+ # Dumps this TopLevel for use by ri. See also #marshal_load
173
179
 
174
- def inspect # :nodoc:
175
- "#<%s:0x%x %p modules: %p classes: %p>" % [
176
- self.class, object_id,
177
- base_name,
178
- @modules.map { |n, m| m },
179
- @classes.map { |n, c| c }
180
- ]
181
- end
180
+ def marshal_dump
181
+ [
182
+ MARSHAL_VERSION,
183
+ @relative_name,
184
+ @parser,
185
+ parse(@comment),
186
+ ]
187
+ end
182
188
 
183
- ##
184
- # Dumps this TopLevel for use by ri. See also #marshal_load
185
-
186
- def marshal_dump
187
- [
188
- MARSHAL_VERSION,
189
- @relative_name,
190
- @parser,
191
- parse(@comment),
192
- ]
193
- end
189
+ ##
190
+ # Loads this TopLevel from +array+.
194
191
 
195
- ##
196
- # Loads this TopLevel from +array+.
192
+ def marshal_load(array) # :nodoc:
193
+ initialize array[1]
197
194
 
198
- def marshal_load(array) # :nodoc:
199
- initialize array[1]
195
+ @parser = array[2]
196
+ @comment = Comment.from_document array[3]
197
+ end
200
198
 
201
- @parser = array[2]
202
- @comment = RDoc::Comment.from_document array[3]
203
- end
199
+ ##
200
+ # Returns the NormalClass "Object", creating it if not found.
201
+ #
202
+ # Records +self+ as a location in "Object".
203
+
204
+ def object_class
205
+ @object_class ||= begin
206
+ oc = @store.find_class_named('Object') || add_class(NormalClass, 'Object')
207
+ oc.record_location self
208
+ oc
209
+ end
210
+ end
204
211
 
205
- ##
206
- # Returns the NormalClass "Object", creating it if not found.
207
- #
208
- # Records +self+ as a location in "Object".
209
-
210
- def object_class
211
- @object_class ||= begin
212
- oc = @store.find_class_named('Object') || add_class(RDoc::NormalClass, 'Object')
213
- oc.record_location self
214
- oc
212
+ ##
213
+ # Path to this file for use with HTML generator output.
214
+
215
+ def path
216
+ base = if options.main_page == full_name
217
+ 'index.html'
218
+ else
219
+ http_url
220
+ end
221
+
222
+ prefix = options.file_path_prefix
223
+ return base unless prefix
224
+ File.join(prefix, base)
215
225
  end
216
- end
217
226
 
218
- ##
219
- # Path to this file for use with HTML generator output.
227
+ def pretty_print(q) # :nodoc:
228
+ q.group 2, "[#{self.class}: ", "]" do
229
+ q.text "base name: #{base_name.inspect}"
230
+ q.breakable
220
231
 
221
- def path
222
- prefix = options.file_path_prefix
223
- return http_url unless prefix
224
- File.join(prefix, http_url)
225
- end
232
+ items = @modules.map { |n, m| m }
233
+ items.concat @modules.map { |n, c| c }
234
+ q.seplist items do |mod| q.pp mod end
235
+ end
236
+ end
237
+
238
+ ##
239
+ # Search record used by RDoc::Generator::JsonIndex
240
+ #
241
+ # TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
242
+ # Use #search_snippet instead for getting documentation snippets.
243
+
244
+ def search_record
245
+ return unless @parser < Parser::Text
246
+
247
+ [
248
+ page_name,
249
+ '',
250
+ page_name,
251
+ '',
252
+ path,
253
+ '',
254
+ search_snippet,
255
+ ]
256
+ end
226
257
 
227
- def pretty_print(q) # :nodoc:
228
- q.group 2, "[#{self.class}: ", "]" do
229
- q.text "base name: #{base_name.inspect}"
230
- q.breakable
258
+ ##
259
+ # Returns an HTML snippet of the comment for search results.
231
260
 
232
- items = @modules.map { |n, m| m }
233
- items.concat @modules.map { |n, c| c }
234
- q.seplist items do |mod| q.pp mod end
261
+ def search_snippet
262
+ return '' if @comment.empty?
263
+
264
+ snippet(@comment)
235
265
  end
236
- end
237
266
 
238
- ##
239
- # Search record used by RDoc::Generator::JsonIndex
240
-
241
- def search_record
242
- return unless @parser < RDoc::Parser::Text
243
-
244
- [
245
- page_name,
246
- '',
247
- page_name,
248
- '',
249
- path,
250
- '',
251
- snippet(@comment),
252
- ]
253
- end
267
+ ##
268
+ # Is this TopLevel from a text file instead of a source code file?
254
269
 
255
- ##
256
- # Is this TopLevel from a text file instead of a source code file?
270
+ def text?
271
+ @parser and @parser.include? Parser::Text
272
+ end
257
273
 
258
- def text?
259
- @parser and @parser.include? RDoc::Parser::Text
260
- end
274
+ def to_s # :nodoc:
275
+ "file #{full_name}"
276
+ end
261
277
 
262
- def to_s # :nodoc:
263
- "file #{full_name}"
264
278
  end
265
-
266
279
  end