rdoc 6.2.1 → 6.3.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdoc.rb +21 -0
  3. data/lib/rdoc/any_method.rb +52 -7
  4. data/lib/rdoc/context.rb +10 -2
  5. data/lib/rdoc/context/section.rb +0 -13
  6. data/lib/rdoc/cross_reference.rb +2 -2
  7. data/lib/rdoc/erb_partial.rb +1 -1
  8. data/lib/rdoc/erbio.rb +2 -2
  9. data/lib/rdoc/generator/darkfish.rb +3 -3
  10. data/lib/rdoc/generator/pot.rb +3 -3
  11. data/lib/rdoc/generator/template/darkfish/_head.rhtml +4 -5
  12. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
  13. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
  14. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
  15. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
  16. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
  17. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
  18. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  20. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
  21. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  22. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
  23. data/lib/rdoc/generator/template/darkfish/class.rhtml +44 -44
  24. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +1 -1
  25. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
  26. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
  27. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
  28. data/lib/rdoc/i18n.rb +1 -1
  29. data/lib/rdoc/markdown.kpeg +1 -1
  30. data/lib/rdoc/markdown.rb +1 -1
  31. data/lib/rdoc/markup/formatter.rb +1 -1
  32. data/lib/rdoc/markup/pre_process.rb +1 -1
  33. data/lib/rdoc/markup/to_html.rb +19 -6
  34. data/lib/rdoc/markup/to_html_crossref.rb +13 -5
  35. data/lib/rdoc/options.rb +1 -1
  36. data/lib/rdoc/parser.rb +7 -7
  37. data/lib/rdoc/parser/c.rb +24 -58
  38. data/lib/rdoc/rd/block_parser.rb +1 -1
  39. data/lib/rdoc/rd/inline_parser.rb +1 -1
  40. data/lib/rdoc/rdoc.rb +26 -20
  41. data/lib/rdoc/ri/driver.rb +9 -5
  42. data/lib/rdoc/ri/paths.rb +3 -17
  43. data/lib/rdoc/ri/task.rb +1 -1
  44. data/lib/rdoc/rubygems_hook.rb +2 -2
  45. data/lib/rdoc/servlet.rb +6 -1
  46. data/lib/rdoc/store.rb +2 -2
  47. data/lib/rdoc/version.rb +1 -1
  48. data/man/ri.1 +247 -0
  49. data/rdoc.gemspec +1 -1
  50. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ed13122ed21f8a23f92864685b11e29d15bded252571e52a16ca87318c84063
4
- data.tar.gz: 96904ccc1312e72b6418b55132b810f52a5ace7004ad9c12ac4d37be258cae14
3
+ metadata.gz: 18741ef6dd2db34af2ea15a9e8a154a760c1f01bb0d69d15dc3af3f70cc00d7c
4
+ data.tar.gz: e61ab91ee4b0e776dd36e934da0534e6d52aa259ddff18be057955e109db08b4
5
5
  SHA512:
6
- metadata.gz: ee977c75f90e1ec1b928fef68a78c737bface67434386ad6dda066e873d3da6b5c19bdfa8719614367be5a54fc0e9e89f342bd0766bbb067cf33eaf3fd06c7f9
7
- data.tar.gz: 1434f635ecd255f3ab22bd90d1397f9c90189810c5d251e7f0557728239ce0aa4f967d21c49623a67459244c041fa4b2c38cc4504ed509ad6522f244a8eeece8
6
+ metadata.gz: 9ea75c4b0339de23f73f84c890b23cb0b7bacb87ea191258f54160a28a4519c0e8edfbf6bc17ef67e631d923b17cb2030f79048d269b032eefe8b92f62fdb9df
7
+ data.tar.gz: bdbf42dea5706d0b13ce653a8591ff9fc0ece11b4d49c18e7d32bd725e901a3dd2e5feb3479b4185a874d12e024e7f77b6324592405a9b826efd00bb68589373
@@ -120,6 +120,27 @@ module RDoc
120
120
  end
121
121
  end
122
122
 
123
+ def self.home
124
+ rdoc_dir = begin
125
+ File.expand_path('~/.rdoc')
126
+ rescue ArgumentError
127
+ end
128
+
129
+ if File.directory?(rdoc_dir)
130
+ rdoc_dir
131
+ else
132
+ begin
133
+ # XDG
134
+ xdg_data_home = ENV["XDG_DATA_HOME"] || File.join(File.expand_path("~"), '.local', 'share')
135
+ unless File.exist?(xdg_data_home)
136
+ FileUtils.mkdir_p xdg_data_home
137
+ end
138
+ File.join xdg_data_home, "rdoc"
139
+ rescue Errno::EACCES
140
+ end
141
+ end
142
+ end
143
+
123
144
  autoload :RDoc, 'rdoc/rdoc'
124
145
 
125
146
  autoload :CrossReference, 'rdoc/cross_reference'
@@ -26,12 +26,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
26
26
 
27
27
  attr_accessor :c_function
28
28
 
29
- ##
30
- # Different ways to call this method
31
-
32
- attr_reader :call_seq
33
-
34
- ##
35
29
  # Parameters for this method
36
30
 
37
31
  attr_accessor :params
@@ -93,6 +87,19 @@ class RDoc::AnyMethod < RDoc::MethodAttr
93
87
  end
94
88
  end
95
89
 
90
+ ##
91
+ # Different ways to call this method
92
+
93
+ def call_seq
94
+ unless call_seq = _call_seq
95
+ call_seq = is_alias_for._call_seq if is_alias_for
96
+ end
97
+
98
+ return unless call_seq
99
+
100
+ deduplicate_call_seq(call_seq)
101
+ end
102
+
96
103
  ##
97
104
  # Sets the different ways you can call this method. If an empty +call_seq+
98
105
  # is given nil is assumed.
@@ -312,5 +319,43 @@ class RDoc::AnyMethod < RDoc::MethodAttr
312
319
  @superclass_method
313
320
  end
314
321
 
315
- end
322
+ protected
323
+
324
+ ##
325
+ # call_seq without deduplication and alias lookup.
326
+
327
+ def _call_seq
328
+ @call_seq if defined?(@call_seq) && @call_seq
329
+ end
330
+
331
+ private
332
+
333
+ ##
334
+ # call_seq with alias examples information removed, if this
335
+ # method is an alias method.
336
+
337
+ def deduplicate_call_seq(call_seq)
338
+ return call_seq unless is_alias_for || !aliases.empty?
339
+
340
+ method_name = self.name
341
+ method_name = method_name[0, 1] if method_name =~ /\A\[/
316
342
 
343
+ entries = call_seq.split "\n"
344
+
345
+ ignore = aliases.map(&:name)
346
+ if is_alias_for
347
+ ignore << is_alias_for.name
348
+ ignore.concat is_alias_for.aliases.map(&:name)
349
+ end
350
+ ignore.map! { |n| n =~ /\A\[/ ? n[0, 1] : n}
351
+ ignore.delete(method_name)
352
+ ignore = Regexp.union(ignore)
353
+
354
+ matching = entries.reject do |entry|
355
+ entry =~ /^\w*\.?#{ignore}/ or
356
+ entry =~ /\s#{ignore}\s/
357
+ end
358
+
359
+ matching.join "\n"
360
+ end
361
+ end
@@ -990,13 +990,21 @@ class RDoc::Context < RDoc::CodeObject
990
990
  @instance_attributes ||= attributes.reject { |a| a.singleton }
991
991
  end
992
992
 
993
+ ##
994
+ # Instance methods
995
+
996
+ def instance_methods
997
+ @instance_methods ||= method_list.reject { |a| a.singleton }
998
+ end
999
+
993
1000
  ##
994
1001
  # Instance methods
995
1002
  #--
996
- # TODO rename to instance_methods
1003
+ # TODO remove this later
997
1004
 
998
1005
  def instance_method_list
999
- @instance_method_list ||= method_list.reject { |a| a.singleton }
1006
+ warn '#instance_method_list is obsoleted, please use #instance_methods'
1007
+ @instance_methods ||= method_list.reject { |a| a.singleton }
1000
1008
  end
1001
1009
 
1002
1010
  ##
@@ -34,8 +34,6 @@ class RDoc::Context::Section
34
34
 
35
35
  attr_reader :title
36
36
 
37
- @@sequence = "SEC00000"
38
-
39
37
  ##
40
38
  # Creates a new section with +title+ and +comment+
41
39
 
@@ -43,9 +41,6 @@ class RDoc::Context::Section
43
41
  @parent = parent
44
42
  @title = title ? title.strip : title
45
43
 
46
- @@sequence = @@sequence.succ
47
- @sequence = @@sequence.dup
48
-
49
44
  @comments = []
50
45
 
51
46
  add_comment comment
@@ -233,13 +228,5 @@ class RDoc::Context::Section
233
228
  end
234
229
  end
235
230
 
236
- ##
237
- # Section sequence number (deprecated)
238
-
239
- def sequence
240
- warn "RDoc::Context::Section#sequence is deprecated, use #aref"
241
- @sequence
242
- end
243
-
244
231
  end
245
232
 
@@ -19,7 +19,7 @@ class RDoc::CrossReference
19
19
  #
20
20
  # See CLASS_REGEXP_STR
21
21
 
22
- METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
22
+ METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
23
23
 
24
24
  ##
25
25
  # Regular expressions matching text that should potentially have
@@ -173,7 +173,7 @@ class RDoc::CrossReference
173
173
  end unless ref
174
174
 
175
175
  # Try a page name
176
- ref = @store.page name if not ref and name =~ /^\w+$/
176
+ ref = @store.page name if not ref and name =~ /^[\w.]+$/
177
177
 
178
178
  ref = nil if RDoc::Alias === ref # external alias, can't link to it
179
179
 
@@ -12,7 +12,7 @@ class RDoc::ERBPartial < ERB
12
12
  def set_eoutvar compiler, eoutvar = '_erbout'
13
13
  super
14
14
 
15
- compiler.pre_cmd = ["#{eoutvar} ||= ''"]
15
+ compiler.pre_cmd = ["#{eoutvar} ||= +''"]
16
16
  end
17
17
 
18
18
  end
@@ -20,11 +20,11 @@ class RDoc::ERBIO < ERB
20
20
  ##
21
21
  # Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize
22
22
 
23
- def initialize str, safe_level = nil, trim_mode = nil, eoutvar = 'io'
23
+ def initialize str, safe_level = nil, legacy_trim_mode = nil, legacy_eoutvar = 'io', trim_mode: nil, eoutvar: 'io'
24
24
  if RUBY_VERSION >= '2.6'
25
25
  super(str, trim_mode: trim_mode, eoutvar: eoutvar)
26
26
  else
27
- super
27
+ super(str, safe_level, legacy_trim_mode, legacy_eoutvar)
28
28
  end
29
29
  end
30
30
 
@@ -4,7 +4,7 @@
4
4
  require 'erb'
5
5
  require 'fileutils'
6
6
  require 'pathname'
7
- require 'rdoc/generator/markup'
7
+ require_relative 'markup'
8
8
 
9
9
  ##
10
10
  # Darkfish RDoc HTML Generator
@@ -779,9 +779,9 @@ class RDoc::Generator::Darkfish
779
779
  end
780
780
 
781
781
  if RUBY_VERSION >= '2.6'
782
- template = klass.new template, trim_mode: '<>', eoutvar: erbout
782
+ template = klass.new template, trim_mode: '-', eoutvar: erbout
783
783
  else
784
- template = klass.new template, nil, '<>', erbout
784
+ template = klass.new template, nil, '-', erbout
785
785
  end
786
786
  @template_cache[file] = template
787
787
  template
@@ -91,8 +91,8 @@ class RDoc::Generator::POT
91
91
  extractor.extract
92
92
  end
93
93
 
94
- require 'rdoc/generator/pot/message_extractor'
95
- require 'rdoc/generator/pot/po'
96
- require 'rdoc/generator/pot/po_entry'
94
+ require_relative 'pot/message_extractor'
95
+ require_relative 'pot/po'
96
+ require_relative 'pot/po_entry'
97
97
 
98
98
  end
@@ -15,9 +15,8 @@
15
15
 
16
16
  <link href="<%= asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
17
17
  <link href="<%= asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
18
- <% if @options.template_stylesheets.flatten.any? then %>
19
- <% @options.template_stylesheets.flatten.each do |stylesheet| %>
18
+ <%- if @options.template_stylesheets.flatten.any? then -%>
19
+ <%- @options.template_stylesheets.flatten.each do |stylesheet| -%>
20
20
  <link href="<%= asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
21
- <% end %>
22
- <% end %>
23
-
21
+ <%- end -%>
22
+ <%- end -%>
@@ -1,4 +1,4 @@
1
- <% if !svninfo.empty? then %>
1
+ <%- if !svninfo.empty? then %>
2
2
  <div id="file-svninfo-section" class="nav-section">
3
3
  <h3>VCS Info</h3>
4
4
 
@@ -16,4 +16,4 @@
16
16
  </dl>
17
17
  </div>
18
18
  </div>
19
- <% end %>
19
+ <%- end -%>
@@ -2,8 +2,8 @@
2
2
  <h3>Class and Module Index</h3>
3
3
 
4
4
  <ul class="link-list">
5
- <% @modsort.each do |index_klass| %>
5
+ <%- @modsort.each do |index_klass| -%>
6
6
  <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a>
7
- <% end %>
7
+ <%- end -%>
8
8
  </ul>
9
9
  </div>
@@ -1,15 +1,15 @@
1
- <% unless klass.extends.empty? then %>
1
+ <%- unless klass.extends.empty? then %>
2
2
  <div id="extends-section" class="nav-section">
3
3
  <h3>Extended With Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <% klass.each_extend do |ext| %>
7
- <% unless String === ext.module then %>
6
+ <%- klass.each_extend do |ext| -%>
7
+ <%- unless String === ext.module then -%>
8
8
  <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
9
- <% else %>
9
+ <%- else -%>
10
10
  <li><span class="extend"><%= ext.name %></span>
11
- <% end %>
12
- <% end %>
11
+ <%- end -%>
12
+ <%- end -%>
13
13
  </ul>
14
14
  </div>
15
- <% end %>
15
+ <%- end -%>
@@ -2,8 +2,8 @@
2
2
  <h3>Defined In</h3>
3
3
 
4
4
  <ul>
5
- <% klass.in_files.each do |tl| %>
5
+ <%- klass.in_files.each do |tl| -%>
6
6
  <li><%= h tl.relative_name %>
7
- <% end %>
7
+ <%- end -%>
8
8
  </ul>
9
9
  </div>
@@ -1,15 +1,15 @@
1
- <% unless klass.includes.empty? then %>
1
+ <%- unless klass.includes.empty? then %>
2
2
  <div id="includes-section" class="nav-section">
3
3
  <h3>Included Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <% klass.each_include do |inc| %>
7
- <% unless String === inc.module then %>
6
+ <%- klass.each_include do |inc| -%>
7
+ <%- unless String === inc.module then -%>
8
8
  <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
9
- <% else %>
9
+ <%- else -%>
10
10
  <li><span class="include"><%= inc.name %></span>
11
- <% end %>
12
- <% end %>
11
+ <%- end -%>
12
+ <%- end -%>
13
13
  </ul>
14
14
  </div>
15
- <% end %>
15
+ <%- end -%>
@@ -2,14 +2,14 @@
2
2
  <h3>Documentation</h3>
3
3
 
4
4
  <ul>
5
- <% installed.each do |name, href, exists, type, _| %>
6
- <% next if type == :extra %>
5
+ <%- installed.each do |name, href, exists, type, _| -%>
6
+ <%- next if type == :extra -%>
7
7
  <li class="folder">
8
- <% if exists then %>
8
+ <%- if exists then -%>
9
9
  <a href="<%= href %>"><%= h name %></a>
10
- <% else %>
10
+ <%- else -%>
11
11
  <%= h name %>
12
- <% end %>
13
- <% end %>
12
+ <%- end -%>
13
+ <%- end -%>
14
14
  </ul>
15
15
  </div>
@@ -1,12 +1,12 @@
1
- <% unless klass.method_list.empty? then %>
1
+ <%- unless klass.method_list.empty? then %>
2
2
  <!-- Method Quickref -->
3
3
  <div id="method-list-section" class="nav-section">
4
4
  <h3>Methods</h3>
5
5
 
6
6
  <ul class="link-list" role="directory">
7
- <% klass.each_method do |meth| %>
8
- <li <% if meth.calls_super %>class="calls-super" <% end %>><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= h meth.name %></a>
9
- <% end %>
7
+ <%- klass.each_method do |meth| -%>
8
+ <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= h meth.name -%></a>
9
+ <%- end -%>
10
10
  </ul>
11
11
  </div>
12
- <% end %>
12
+ <%- end -%>
@@ -1,12 +1,12 @@
1
- <% simple_files = @files.select { |f| f.text? } %>
2
- <% unless simple_files.empty? then %>
1
+ <%- simple_files = @files.select { |f| f.text? } %>
2
+ <%- unless simple_files.empty? then -%>
3
3
  <div id="fileindex-section" class="nav-section">
4
4
  <h3>Pages</h3>
5
5
 
6
6
  <ul class="link-list">
7
- <% simple_files.each do |f| %>
7
+ <%- simple_files.each do |f| -%>
8
8
  <li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
9
- <% end %>
9
+ <%- end -%>
10
10
  </ul>
11
11
  </div>
12
- <% end %>
12
+ <%- end -%>
@@ -1,11 +1,11 @@
1
- <% if klass.type == 'class' then %>
1
+ <%- if klass.type == 'class' then %>
2
2
  <div id="parent-class-section" class="nav-section">
3
3
  <h3>Parent</h3>
4
4
 
5
- <% if klass.superclass and not String === klass.superclass then %>
5
+ <%- if klass.superclass and not String === klass.superclass then -%>
6
6
  <p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a>
7
- <% else %>
7
+ <%- else -%>
8
8
  <p class="link"><%= klass.superclass %>
9
- <% end %>
9
+ <%- end -%>
10
10
  </div>
11
- <% end %>
11
+ <%- end -%>
@@ -1,11 +1,11 @@
1
- <% unless klass.sections.length == 1 then %>
1
+ <%- unless klass.sections.length == 1 then %>
2
2
  <div id="sections-section" class="nav-section">
3
3
  <h3>Sections</h3>
4
4
 
5
5
  <ul class="link-list" role="directory">
6
- <% klass.sort_sections.each do |section| %>
6
+ <%- klass.sort_sections.each do |section| -%>
7
7
  <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
8
- <% end %>
8
+ <%- end -%>
9
9
  </ul>
10
10
  </div>
11
- <% end %>
11
+ <%- end -%>
@@ -1,4 +1,4 @@
1
- <% comment = if current.respond_to? :comment_location then
1
+ <%- comment = if current.respond_to? :comment_location then
2
2
  current.comment_location
3
3
  else
4
4
  current.comment
@@ -10,9 +10,9 @@
10
10
  <h3>Table of Contents</h3>
11
11
 
12
12
  <ul class="link-list" role="directory">
13
- <% table.each do |heading| %>
13
+ <%- table.each do |heading| -%>
14
14
  <li><a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
15
- <% end %>
15
+ <%- end -%>
16
16
  </ul>
17
17
  </div>
18
- <% end %>
18
+ <%- end -%>