rdoc 6.12.0 → 6.14.1
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.
- checksums.yaml +4 -4
- data/README.rdoc +3 -1
- data/lib/rdoc/code_object/alias.rb +2 -9
- data/lib/rdoc/code_object/any_method.rb +9 -14
- data/lib/rdoc/code_object/attr.rb +6 -9
- data/lib/rdoc/code_object/class_module.rb +40 -23
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +8 -7
- data/lib/rdoc/code_object/context.rb +23 -65
- data/lib/rdoc/code_object/method_attr.rb +9 -28
- data/lib/rdoc/code_object/mixin.rb +3 -3
- data/lib/rdoc/code_object/normal_class.rb +1 -1
- data/lib/rdoc/code_object/normal_module.rb +1 -1
- data/lib/rdoc/code_object/require.rb +1 -1
- data/lib/rdoc/code_object/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +12 -30
- data/lib/rdoc/code_object.rb +6 -37
- data/lib/rdoc/comment.rb +7 -10
- data/lib/rdoc/cross_reference.rb +3 -3
- data/lib/rdoc/encoding.rb +4 -4
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/darkfish.rb +97 -109
- data/lib/rdoc/generator/json_index.rb +4 -20
- data/lib/rdoc/generator/markup.rb +14 -2
- data/lib/rdoc/generator/pot/message_extractor.rb +6 -6
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +7 -7
- data/lib/rdoc/generator/pot.rb +1 -6
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +15 -0
- data/lib/rdoc/markdown.kpeg +7 -5
- data/lib/rdoc/markdown.rb +34 -21
- data/lib/rdoc/markup/attribute_manager.rb +5 -5
- data/lib/rdoc/markup/attributes.rb +3 -3
- data/lib/rdoc/markup/blank_line.rb +2 -2
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +8 -8
- data/lib/rdoc/markup/formatter.rb +12 -12
- data/lib/rdoc/markup/hard_break.rb +3 -3
- data/lib/rdoc/markup/heading.rb +11 -5
- data/lib/rdoc/markup/include.rb +3 -3
- data/lib/rdoc/markup/indented_paragraph.rb +3 -3
- data/lib/rdoc/markup/list.rb +4 -4
- data/lib/rdoc/markup/list_item.rb +4 -4
- data/lib/rdoc/markup/paragraph.rb +2 -2
- data/lib/rdoc/markup/parser.rb +11 -11
- data/lib/rdoc/markup/pre_process.rb +6 -6
- data/lib/rdoc/markup/raw.rb +5 -5
- data/lib/rdoc/markup/rule.rb +2 -2
- data/lib/rdoc/markup/table.rb +4 -4
- data/lib/rdoc/markup/to_ansi.rb +3 -3
- data/lib/rdoc/markup/to_bs.rb +6 -6
- data/lib/rdoc/markup/to_html.rb +25 -16
- data/lib/rdoc/markup/to_html_crossref.rb +5 -5
- data/lib/rdoc/markup/to_html_snippet.rb +17 -17
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_label.rb +6 -5
- data/lib/rdoc/markup/to_markdown.rb +12 -12
- data/lib/rdoc/markup/to_rdoc.rb +29 -28
- data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +8 -8
- data/lib/rdoc/markup/verbatim.rb +3 -3
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/options.rb +31 -12
- data/lib/rdoc/parser/c.rb +20 -23
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +9 -16
- data/lib/rdoc/parser/ruby.rb +50 -53
- data/lib/rdoc/parser/simple.rb +2 -2
- data/lib/rdoc/parser.rb +8 -8
- data/lib/rdoc/rd/inline.rb +4 -4
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +11 -26
- data/lib/rdoc/ri/driver.rb +60 -52
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +14 -17
- data/lib/rdoc/servlet.rb +23 -22
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +3 -3
- data/lib/rdoc/stats.rb +14 -14
- data/lib/rdoc/store.rb +39 -43
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +13 -13
- data/lib/rdoc/token_stream.rb +1 -1
- data/lib/rdoc/tom_doc.rb +7 -7
- data/lib/rdoc/version.rb +1 -1
- data/man/ri.1 +2 -0
- data/rdoc.gemspec +69 -0
- metadata +18 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a7e93ac9c35220aeef63714f07b7ad32fc23de76e17e92e32a49012e32f304e
|
4
|
+
data.tar.gz: f273ce6acb9a2caf5e663ddfaae80d676a07e2b0e2d7de818218da742ed795d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5deecbe6a6a8562324936b2c458c45be5565832ec9ff2ac2fb79f6c2dd8d72add9e08c24485eaa7365d5d0628abed02d0d6a198067d64f0217a6789633c7e57e
|
7
|
+
data.tar.gz: 1ca6dad24e4f748fa8863e301c5f87a89b174523eaf62f2ab505845b2f15aaa4e6a7b215c7ff325c198052358ebfd9c206f0b743c2f97da0eff7444c0edacf96
|
data/README.rdoc
CHANGED
@@ -54,6 +54,8 @@ To generate documentation programmatically:
|
|
54
54
|
require 'rdoc/rdoc'
|
55
55
|
|
56
56
|
options = RDoc::Options.new
|
57
|
+
options.files = ['a.rb', 'b.rb']
|
58
|
+
options.setup_generator 'darkfish'
|
57
59
|
# see RDoc::Options
|
58
60
|
|
59
61
|
rdoc = RDoc::RDoc.new
|
@@ -121,7 +123,7 @@ Please follow the theme's README for usage instructions.
|
|
121
123
|
|
122
124
|
== Bugs
|
123
125
|
|
124
|
-
See CONTRIBUTING
|
126
|
+
See CONTRIBUTING.rdoc for information on filing a bug report. It's OK to file
|
125
127
|
a bug report for anything you're having a problem with. If you can't figure
|
126
128
|
out how to make RDoc produce the output you like that is probably a
|
127
129
|
documentation bug.
|
@@ -23,7 +23,7 @@ class RDoc::Alias < RDoc::CodeObject
|
|
23
23
|
##
|
24
24
|
# Is this an alias declared in a singleton context?
|
25
25
|
|
26
|
-
|
26
|
+
attr_reader :singleton
|
27
27
|
|
28
28
|
##
|
29
29
|
# Source file token stream
|
@@ -34,7 +34,7 @@ class RDoc::Alias < RDoc::CodeObject
|
|
34
34
|
# Creates a new Alias with a token stream of +text+ that aliases +old_name+
|
35
35
|
# to +new_name+, has +comment+ and is a +singleton+ context.
|
36
36
|
|
37
|
-
def initialize(text, old_name, new_name, comment, singleton
|
37
|
+
def initialize(text, old_name, new_name, comment, singleton: false)
|
38
38
|
super()
|
39
39
|
|
40
40
|
@text = text
|
@@ -59,13 +59,6 @@ class RDoc::Alias < RDoc::CodeObject
|
|
59
59
|
"#alias-#{type}-#{html_name}"
|
60
60
|
end
|
61
61
|
|
62
|
-
##
|
63
|
-
# Full old name including namespace
|
64
|
-
|
65
|
-
def full_old_name
|
66
|
-
@full_name || "#{parent.name}#{pretty_old_name}"
|
67
|
-
end
|
68
|
-
|
69
62
|
##
|
70
63
|
# HTML id-friendly version of +#new_name+.
|
71
64
|
|
@@ -29,10 +29,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
29
29
|
# The section title of the method (if defined in a C file via +:category:+)
|
30
30
|
attr_accessor :section_title
|
31
31
|
|
32
|
-
# Parameters for this method
|
33
|
-
|
34
|
-
attr_accessor :params
|
35
|
-
|
36
32
|
##
|
37
33
|
# If true this method uses +super+ to call a superclass version
|
38
34
|
|
@@ -43,8 +39,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
43
39
|
##
|
44
40
|
# Creates a new AnyMethod with a token stream +text+ and +name+
|
45
41
|
|
46
|
-
def initialize
|
47
|
-
super
|
42
|
+
def initialize(text, name, singleton: false)
|
43
|
+
super(text, name, singleton: singleton)
|
48
44
|
|
49
45
|
@c_function = nil
|
50
46
|
@dont_rename_initialize = false
|
@@ -56,11 +52,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
56
52
|
##
|
57
53
|
# Adds +an_alias+ as an alias for this method in +context+.
|
58
54
|
|
59
|
-
def add_alias
|
60
|
-
method = self.class.new an_alias.text, an_alias.new_name
|
55
|
+
def add_alias(an_alias, context = nil)
|
56
|
+
method = self.class.new an_alias.text, an_alias.new_name, singleton: singleton
|
61
57
|
|
62
58
|
method.record_location an_alias.file
|
63
|
-
method.singleton = self.singleton
|
64
59
|
method.params = self.params
|
65
60
|
method.visibility = self.visibility
|
66
61
|
method.comment = an_alias.comment
|
@@ -109,8 +104,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
109
104
|
#
|
110
105
|
# See also #param_seq
|
111
106
|
|
112
|
-
def call_seq=
|
113
|
-
return if call_seq.empty?
|
107
|
+
def call_seq=(call_seq)
|
108
|
+
return if call_seq.nil? || call_seq.empty?
|
114
109
|
|
115
110
|
@call_seq = call_seq
|
116
111
|
end
|
@@ -181,7 +176,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
181
176
|
# * #full_name
|
182
177
|
# * #parent_name
|
183
178
|
|
184
|
-
def marshal_load
|
179
|
+
def marshal_load(array)
|
185
180
|
initialize_visibility
|
186
181
|
|
187
182
|
@dont_rename_initialize = nil
|
@@ -211,7 +206,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
211
206
|
@is_alias_for = array[15]
|
212
207
|
|
213
208
|
array[8].each do |new_name, document|
|
214
|
-
add_alias RDoc::Alias.new(nil, @name, new_name, RDoc::Comment.from_document(document), @singleton)
|
209
|
+
add_alias RDoc::Alias.new(nil, @name, new_name, RDoc::Comment.from_document(document), singleton: @singleton)
|
215
210
|
end
|
216
211
|
|
217
212
|
@parent_name ||= if @full_name =~ /#/ then
|
@@ -314,7 +309,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
314
309
|
##
|
315
310
|
# Sets the store for this method and its referenced code objects.
|
316
311
|
|
317
|
-
def store=
|
312
|
+
def store=(store)
|
318
313
|
super
|
319
314
|
|
320
315
|
@file = @store.add_file @file.full_name if @file
|
@@ -22,18 +22,17 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
22
22
|
# Creates a new Attr with body +text+, +name+, read/write status +rw+ and
|
23
23
|
# +comment+. +singleton+ marks this as a class attribute.
|
24
24
|
|
25
|
-
def initialize(text, name, rw, comment, singleton
|
26
|
-
super
|
25
|
+
def initialize(text, name, rw, comment, singleton: false)
|
26
|
+
super(text, name, singleton: singleton)
|
27
27
|
|
28
28
|
@rw = rw
|
29
|
-
@singleton = singleton
|
30
29
|
self.comment = comment
|
31
30
|
end
|
32
31
|
|
33
32
|
##
|
34
33
|
# Attributes are equal when their names, singleton and rw are identical
|
35
34
|
|
36
|
-
def ==
|
35
|
+
def ==(other)
|
37
36
|
self.class == other.class and
|
38
37
|
self.name == other.name and
|
39
38
|
self.rw == other.rw and
|
@@ -44,9 +43,7 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
44
43
|
# Add +an_alias+ as an attribute in +context+.
|
45
44
|
|
46
45
|
def add_alias(an_alias, context)
|
47
|
-
new_attr = self.class.new(
|
48
|
-
self.comment, self.singleton)
|
49
|
-
|
46
|
+
new_attr = self.class.new(text, an_alias.new_name, rw, comment, singleton: singleton)
|
50
47
|
new_attr.record_location an_alias.file
|
51
48
|
new_attr.visibility = self.visibility
|
52
49
|
new_attr.is_alias_for = self
|
@@ -121,7 +118,7 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
121
118
|
# * #full_name
|
122
119
|
# * #parent_name
|
123
120
|
|
124
|
-
def marshal_load
|
121
|
+
def marshal_load(array)
|
125
122
|
initialize_visibility
|
126
123
|
|
127
124
|
@aliases = []
|
@@ -148,7 +145,7 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
148
145
|
@parent_name ||= @full_name.split('#', 2).first
|
149
146
|
end
|
150
147
|
|
151
|
-
def pretty_print
|
148
|
+
def pretty_print(q) # :nodoc:
|
152
149
|
q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
|
153
150
|
unless comment.empty? then
|
154
151
|
q.breakable
|
@@ -34,8 +34,6 @@ class RDoc::ClassModule < RDoc::Context
|
|
34
34
|
|
35
35
|
attr_accessor :comment_location
|
36
36
|
|
37
|
-
attr_accessor :diagram # :nodoc:
|
38
|
-
|
39
37
|
##
|
40
38
|
# Class or module this constant is an alias for
|
41
39
|
|
@@ -47,7 +45,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
47
45
|
#--
|
48
46
|
# TODO move to RDoc::NormalClass (I think)
|
49
47
|
|
50
|
-
def self.from_module
|
48
|
+
def self.from_module(class_type, mod)
|
51
49
|
klass = class_type.new mod.name
|
52
50
|
|
53
51
|
mod.comment_location.each do |comment, location|
|
@@ -56,7 +54,6 @@ class RDoc::ClassModule < RDoc::Context
|
|
56
54
|
|
57
55
|
klass.parent = mod.parent
|
58
56
|
klass.section = mod.section
|
59
|
-
klass.viewer = mod.viewer
|
60
57
|
|
61
58
|
klass.attributes.concat mod.attributes
|
62
59
|
klass.method_list.concat mod.method_list
|
@@ -110,7 +107,6 @@ class RDoc::ClassModule < RDoc::Context
|
|
110
107
|
|
111
108
|
def initialize(name, superclass = nil)
|
112
109
|
@constant_aliases = []
|
113
|
-
@diagram = nil
|
114
110
|
@is_alias_for = nil
|
115
111
|
@name = name
|
116
112
|
@superclass = superclass
|
@@ -124,7 +120,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
124
120
|
# method is preferred over #comment= since it allows ri data to be updated
|
125
121
|
# across multiple runs.
|
126
122
|
|
127
|
-
def add_comment
|
123
|
+
def add_comment(comment, location)
|
128
124
|
return unless document_self
|
129
125
|
|
130
126
|
original = comment
|
@@ -145,7 +141,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
145
141
|
self.comment = original
|
146
142
|
end
|
147
143
|
|
148
|
-
def add_things
|
144
|
+
def add_things(my_things, other_things) # :nodoc:
|
149
145
|
other_things.each do |group, things|
|
150
146
|
my_things[group].each { |thing| yield false, thing } if
|
151
147
|
my_things.include? group
|
@@ -202,7 +198,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
202
198
|
# Appends +comment+ to the current comment, but separated by a rule. Works
|
203
199
|
# more like <tt>+=</tt>.
|
204
200
|
|
205
|
-
def comment=
|
201
|
+
def comment=(comment) # :nodoc:
|
206
202
|
comment = case comment
|
207
203
|
when RDoc::Comment then
|
208
204
|
comment.normalize
|
@@ -220,11 +216,12 @@ class RDoc::ClassModule < RDoc::Context
|
|
220
216
|
#
|
221
217
|
# See RDoc::Store#complete
|
222
218
|
|
223
|
-
def complete
|
219
|
+
def complete(min_visibility)
|
224
220
|
update_aliases
|
225
221
|
remove_nodoc_children
|
226
222
|
embed_mixins
|
227
223
|
update_includes
|
224
|
+
update_extends
|
228
225
|
remove_invisible min_visibility
|
229
226
|
end
|
230
227
|
|
@@ -262,7 +259,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
262
259
|
##
|
263
260
|
# Looks for a symbol in the #ancestors. See Context#find_local_symbol.
|
264
261
|
|
265
|
-
def find_ancestor_local_symbol
|
262
|
+
def find_ancestor_local_symbol(symbol)
|
266
263
|
each_ancestor do |m|
|
267
264
|
res = m.find_local_symbol(symbol)
|
268
265
|
return res if res
|
@@ -274,7 +271,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
274
271
|
##
|
275
272
|
# Finds a class or module with +name+ in this namespace or its descendants
|
276
273
|
|
277
|
-
def find_class_named
|
274
|
+
def find_class_named(name)
|
278
275
|
return self if full_name == name
|
279
276
|
return self if @name == name
|
280
277
|
|
@@ -295,6 +292,25 @@ class RDoc::ClassModule < RDoc::Context
|
|
295
292
|
end
|
296
293
|
end
|
297
294
|
|
295
|
+
##
|
296
|
+
# Return array of full_name splitted by +::+.
|
297
|
+
|
298
|
+
def nesting_namespaces
|
299
|
+
@namespaces ||= full_name.split("::").reject(&:empty?)
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# Return array of fully qualified nesting namespaces.
|
304
|
+
#
|
305
|
+
# For example, if full_name is +A::B::C+, this method returns <code>["A", "A::B", "A::B::C"]</code>
|
306
|
+
|
307
|
+
def fully_qualified_nesting_namespaces
|
308
|
+
return nesting_namespaces if nesting_namespaces.length < 2
|
309
|
+
@fqns ||= nesting_namespaces.inject([]) do |list, n|
|
310
|
+
list << (list.empty? ? n : "#{list.last}::#{n}")
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
298
314
|
##
|
299
315
|
# TODO: filter included items by #display?
|
300
316
|
|
@@ -344,7 +360,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
344
360
|
]
|
345
361
|
end
|
346
362
|
|
347
|
-
def marshal_load
|
363
|
+
def marshal_load(array) # :nodoc:
|
348
364
|
initialize_visibility
|
349
365
|
initialize_methods_etc
|
350
366
|
@current_section = nil
|
@@ -373,7 +389,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
373
389
|
singleton ||= false
|
374
390
|
visibility ||= :public
|
375
391
|
|
376
|
-
attr = RDoc::Attr.new nil, name, rw, nil, singleton
|
392
|
+
attr = RDoc::Attr.new nil, name, rw, nil, singleton: singleton
|
377
393
|
|
378
394
|
add_attribute attr
|
379
395
|
attr.visibility = visibility
|
@@ -400,8 +416,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
400
416
|
@visibility = visibility
|
401
417
|
|
402
418
|
methods.each do |name, file|
|
403
|
-
method = RDoc::AnyMethod.new nil, name
|
404
|
-
method.singleton = true if type == 'class'
|
419
|
+
method = RDoc::AnyMethod.new nil, name, singleton: type == 'class'
|
405
420
|
method.record_location RDoc::TopLevel.new file
|
406
421
|
add_method method
|
407
422
|
end
|
@@ -435,7 +450,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
435
450
|
#
|
436
451
|
# The data in +class_module+ is preferred over the receiver.
|
437
452
|
|
438
|
-
def merge
|
453
|
+
def merge(class_module)
|
439
454
|
@parent = class_module.parent
|
440
455
|
@parent_name = class_module.parent_name
|
441
456
|
|
@@ -520,7 +535,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
520
535
|
# end
|
521
536
|
# end
|
522
537
|
|
523
|
-
def merge_collections
|
538
|
+
def merge_collections(mine, other, other_files, &block) # :nodoc:
|
524
539
|
my_things = mine. group_by { |thing| thing.file }
|
525
540
|
other_things = other.group_by { |thing| thing.file }
|
526
541
|
|
@@ -532,7 +547,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
532
547
|
# Merges the comments in this ClassModule with the comments in the other
|
533
548
|
# ClassModule +cm+.
|
534
549
|
|
535
|
-
def merge_sections
|
550
|
+
def merge_sections(cm) # :nodoc:
|
536
551
|
my_sections = sections.group_by { |section| section.title }
|
537
552
|
other_sections = cm.sections.group_by { |section| section.title }
|
538
553
|
|
@@ -580,7 +595,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
580
595
|
#
|
581
596
|
# Used for modules and classes that are constant aliases.
|
582
597
|
|
583
|
-
def name=
|
598
|
+
def name=(new_name)
|
584
599
|
@name = new_name
|
585
600
|
end
|
586
601
|
|
@@ -588,7 +603,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
588
603
|
# Parses +comment_location+ into an RDoc::Markup::Document composed of
|
589
604
|
# multiple RDoc::Markup::Documents with their file set.
|
590
605
|
|
591
|
-
def parse
|
606
|
+
def parse(comment_location)
|
592
607
|
case comment_location
|
593
608
|
when String then
|
594
609
|
super
|
@@ -615,7 +630,9 @@ class RDoc::ClassModule < RDoc::Context
|
|
615
630
|
# Path to this class or module for use with HTML generator output.
|
616
631
|
|
617
632
|
def path
|
618
|
-
|
633
|
+
prefix = options.class_module_path_prefix
|
634
|
+
return http_url unless prefix
|
635
|
+
File.join(prefix, http_url)
|
619
636
|
end
|
620
637
|
|
621
638
|
##
|
@@ -658,7 +675,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
658
675
|
end
|
659
676
|
end
|
660
677
|
|
661
|
-
def remove_things
|
678
|
+
def remove_things(my_things, other_files) # :nodoc:
|
662
679
|
my_things.delete_if do |file, things|
|
663
680
|
next false unless other_files.include? file
|
664
681
|
|
@@ -688,7 +705,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
688
705
|
##
|
689
706
|
# Sets the store for this class or module and its contained code objects.
|
690
707
|
|
691
|
-
def store=
|
708
|
+
def store=(store)
|
692
709
|
super
|
693
710
|
|
694
711
|
@attributes .each do |attr| attr.store = store end
|
@@ -44,7 +44,7 @@ class RDoc::Constant < RDoc::CodeObject
|
|
44
44
|
##
|
45
45
|
# Constants are ordered by name
|
46
46
|
|
47
|
-
def <=>
|
47
|
+
def <=>(other)
|
48
48
|
return unless self.class === other
|
49
49
|
|
50
50
|
[parent_name, name] <=> [other.parent_name, other.name]
|
@@ -53,7 +53,7 @@ class RDoc::Constant < RDoc::CodeObject
|
|
53
53
|
##
|
54
54
|
# Constants are equal when their #parent and #name is the same
|
55
55
|
|
56
|
-
def ==
|
56
|
+
def ==(other)
|
57
57
|
self.class == other.class and
|
58
58
|
@parent == other.parent and
|
59
59
|
@name == other.name
|
@@ -132,7 +132,7 @@ class RDoc::Constant < RDoc::CodeObject
|
|
132
132
|
# * #full_name
|
133
133
|
# * #parent_name
|
134
134
|
|
135
|
-
def marshal_load
|
135
|
+
def marshal_load(array)
|
136
136
|
initialize array[1], nil, RDoc::Comment.from_document(array[5])
|
137
137
|
|
138
138
|
@full_name = array[2]
|
@@ -154,7 +154,7 @@ class RDoc::Constant < RDoc::CodeObject
|
|
154
154
|
"#{@parent.path}##{@name}"
|
155
155
|
end
|
156
156
|
|
157
|
-
def pretty_print
|
157
|
+
def pretty_print(q) # :nodoc:
|
158
158
|
q.group 2, "[#{self.class.name} #{full_name}", "]" do
|
159
159
|
unless comment.empty? then
|
160
160
|
q.breakable
|
@@ -168,7 +168,7 @@ class RDoc::Constant < RDoc::CodeObject
|
|
168
168
|
##
|
169
169
|
# Sets the store for this class or module and its contained code objects.
|
170
170
|
|
171
|
-
def store=
|
171
|
+
def store=(store)
|
172
172
|
super
|
173
173
|
|
174
174
|
@file = @store.add_file @file.full_name if @file
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'cgi/
|
2
|
+
require 'cgi/escape'
|
3
|
+
require 'cgi/util' unless defined?(CGI::EscapeExt)
|
3
4
|
|
4
5
|
##
|
5
6
|
# A section of documentation like:
|
@@ -39,7 +40,7 @@ class RDoc::Context::Section
|
|
39
40
|
##
|
40
41
|
# Creates a new section with +title+ and +comment+
|
41
42
|
|
42
|
-
def initialize
|
43
|
+
def initialize(parent, title, comment)
|
43
44
|
@parent = parent
|
44
45
|
@title = title ? title.strip : title
|
45
46
|
|
@@ -51,7 +52,7 @@ class RDoc::Context::Section
|
|
51
52
|
##
|
52
53
|
# Sections are equal when they have the same #title
|
53
54
|
|
54
|
-
def ==
|
55
|
+
def ==(other)
|
55
56
|
self.class === other and @title == other.title
|
56
57
|
end
|
57
58
|
|
@@ -60,7 +61,7 @@ class RDoc::Context::Section
|
|
60
61
|
##
|
61
62
|
# Adds +comment+ to this section
|
62
63
|
|
63
|
-
def add_comment
|
64
|
+
def add_comment(comment)
|
64
65
|
comments = Array(comment)
|
65
66
|
comments.each do |c|
|
66
67
|
extracted_comment = extract_comment(c)
|
@@ -86,7 +87,7 @@ class RDoc::Context::Section
|
|
86
87
|
# # :section: The title
|
87
88
|
# # The body
|
88
89
|
|
89
|
-
def extract_comment
|
90
|
+
def extract_comment(comment)
|
90
91
|
case comment
|
91
92
|
when nil
|
92
93
|
RDoc::Comment.new ''
|
@@ -138,7 +139,7 @@ class RDoc::Context::Section
|
|
138
139
|
##
|
139
140
|
# De-serializes this Section. The section parent must be restored manually.
|
140
141
|
|
141
|
-
def marshal_load
|
142
|
+
def marshal_load(array)
|
142
143
|
@parent = nil
|
143
144
|
|
144
145
|
@title = array[1]
|
@@ -166,7 +167,7 @@ class RDoc::Context::Section
|
|
166
167
|
# Removes a comment from this section if it is from the same file as
|
167
168
|
# +comment+
|
168
169
|
|
169
|
-
def remove_comment
|
170
|
+
def remove_comment(target_comment)
|
170
171
|
@comments.delete_if do |stored_comment|
|
171
172
|
stored_comment.file == target_comment.file
|
172
173
|
end
|