rdoc 6.8.1 → 6.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.8.0
4
+ # This file is automatically generated by Racc 1.8.1
5
5
  # from Racc grammar file "block_parser.ry".
6
6
  #
7
7
 
@@ -23,7 +23,7 @@ unless $".find {|p| p.end_with?('/racc/info.rb')}
23
23
  $".push "#{__dir__}/racc/info.rb"
24
24
 
25
25
  module Racc
26
- VERSION = '1.8.0'
26
+ VERSION = '1.8.1'
27
27
  Version = VERSION
28
28
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
29
29
  end
@@ -38,7 +38,7 @@ unless defined?(::ParseError)
38
38
  ParseError = Racc::ParseError # :nodoc:
39
39
  end
40
40
 
41
- # Racc is a LALR(1) parser generator.
41
+ # Racc is an LALR(1) parser generator.
42
42
  # It is written in Ruby itself, and generates Ruby programs.
43
43
  #
44
44
  # == Command-line Reference
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.8.0
4
+ # This file is automatically generated by Racc 1.8.1
5
5
  # from Racc grammar file "inline_parser.ry".
6
6
  #
7
7
 
@@ -23,7 +23,7 @@ unless $".find {|p| p.end_with?('/racc/info.rb')}
23
23
  $".push "#{__dir__}/racc/info.rb"
24
24
 
25
25
  module Racc
26
- VERSION = '1.8.0'
26
+ VERSION = '1.8.1'
27
27
  Version = VERSION
28
28
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
29
29
  end
@@ -38,7 +38,7 @@ unless defined?(::ParseError)
38
38
  ParseError = Racc::ParseError # :nodoc:
39
39
  end
40
40
 
41
- # Racc is a LALR(1) parser generator.
41
+ # Racc is an LALR(1) parser generator.
42
42
  # It is written in Ruby itself, and generates Ruby programs.
43
43
  #
44
44
  # == Command-line Reference
data/lib/rdoc/rdoc.rb CHANGED
@@ -395,7 +395,6 @@ The internal error was:
395
395
  $stderr.puts e.backtrace.join("\n\t") if $DEBUG_RDOC
396
396
 
397
397
  raise e
398
- nil
399
398
  end
400
399
 
401
400
  ##
@@ -407,6 +406,7 @@ The internal error was:
407
406
 
408
407
  return [] if file_list.empty?
409
408
 
409
+ # This workaround can be removed after the :main: directive is removed
410
410
  original_options = @options.dup
411
411
  @stats.begin_adding
412
412
 
@@ -415,6 +415,8 @@ The internal error was:
415
415
  parse_file filename
416
416
  end.compact
417
417
 
418
+ @store.resolve_c_superclasses
419
+
418
420
  @stats.done_adding
419
421
  @options = original_options
420
422
 
@@ -79,6 +79,7 @@ class RDoc::RI::Driver
79
79
  options[:interactive] = false
80
80
  options[:profile] = false
81
81
  options[:show_all] = false
82
+ options[:expand_refs] = true
82
83
  options[:use_stdout] = !$stdout.tty?
83
84
  options[:width] = 72
84
85
 
@@ -245,6 +246,12 @@ or the PAGER environment variable.
245
246
 
246
247
  opt.separator nil
247
248
 
249
+ opt.on("--[no-]expand-refs", "Expand rdoc-refs at the end of output") do |value|
250
+ options[:expand_refs] = value
251
+ end
252
+
253
+ opt.separator nil
254
+
248
255
  opt.on("--help", "-h",
249
256
  "Show help and exit.") do
250
257
  puts opts
@@ -425,6 +432,7 @@ or the PAGER environment variable.
425
432
  @use_stdout = options[:use_stdout]
426
433
  @show_all = options[:show_all]
427
434
  @width = options[:width]
435
+ @expand_refs = options[:expand_refs]
428
436
  end
429
437
 
430
438
  ##
@@ -549,11 +557,8 @@ or the PAGER environment variable.
549
557
  # Looks up the method +name+ and adds it to +out+
550
558
 
551
559
  def add_method out, name
552
- filtered = lookup_method name
553
-
554
- method_out = method_document name, filtered
555
-
556
- out.concat method_out.parts
560
+ filtered = lookup_method name
561
+ method_document out, name, filtered
557
562
  end
558
563
 
559
564
  ##
@@ -645,6 +650,7 @@ or the PAGER environment variable.
645
650
 
646
651
  add_also_in out, also_in
647
652
 
653
+ expand_rdoc_refs_at_the_bottom(out)
648
654
  out
649
655
  end
650
656
 
@@ -824,6 +830,8 @@ or the PAGER environment variable.
824
830
 
825
831
  add_method out, name
826
832
 
833
+ expand_rdoc_refs_at_the_bottom(out)
834
+
827
835
  display out
828
836
  end
829
837
 
@@ -1255,9 +1263,7 @@ or the PAGER environment variable.
1255
1263
  ##
1256
1264
  # Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+
1257
1265
 
1258
- def method_document name, filtered
1259
- out = RDoc::Markup::Document.new
1260
-
1266
+ def method_document out, name, filtered
1261
1267
  out << RDoc::Markup::Heading.new(1, name)
1262
1268
  out << RDoc::Markup::BlankLine.new
1263
1269
 
@@ -1514,4 +1520,38 @@ or the PAGER environment variable.
1514
1520
  server.start
1515
1521
  end
1516
1522
 
1523
+ RDOC_REFS_REGEXP = /\[rdoc-ref:([\w.]+)(@.*)?\]/
1524
+
1525
+ def expand_rdoc_refs_at_the_bottom(out)
1526
+ return unless @expand_refs
1527
+
1528
+ extracted_rdoc_refs = []
1529
+
1530
+ out.each do |part|
1531
+ content = if part.respond_to?(:text)
1532
+ part.text
1533
+ else
1534
+ next
1535
+ end
1536
+
1537
+ rdoc_refs = content.scan(RDOC_REFS_REGEXP).uniq.map do |file_name, _anchor|
1538
+ file_name
1539
+ end
1540
+
1541
+ extracted_rdoc_refs.concat(rdoc_refs)
1542
+ end
1543
+
1544
+ found_pages = extracted_rdoc_refs.map do |ref|
1545
+ begin
1546
+ @stores.first.load_page(ref)
1547
+ rescue RDoc::Store::MissingFileError
1548
+ end
1549
+ end.compact
1550
+
1551
+ found_pages.each do |page|
1552
+ out << RDoc::Markup::Heading.new(4, "Expanded from #{page.full_name}")
1553
+ out << RDoc::Markup::BlankLine.new
1554
+ out << page.comment
1555
+ end
1556
+ end
1517
1557
  end
@@ -3,13 +3,19 @@ require 'rubygems/user_interaction'
3
3
  require 'fileutils'
4
4
  require_relative '../rdoc'
5
5
 
6
- ##
7
- # Gem::RDoc provides methods to generate RDoc and ri data for installed gems
8
- # upon gem installation.
6
+ # We define the following two similar name classes in this file:
9
7
  #
10
- # This file is automatically required by RubyGems 1.9 and newer.
8
+ # - RDoc::RubyGemsHook
9
+ # - RDoc::RubygemsHook
10
+ #
11
+ # RDoc::RubyGemsHook is the main class that has real logic.
12
+ #
13
+ # RDoc::RubygemsHook is a class that is only for
14
+ # compatibility. RDoc::RubygemsHook is used by RubyGems directly. We
15
+ # can remove this when all maintained RubyGems remove
16
+ # `rubygems/rdoc.rb`.
11
17
 
12
- class RDoc::RubygemsHook
18
+ class RDoc::RubyGemsHook
13
19
 
14
20
  include Gem::UserInteraction
15
21
  extend Gem::UserInteraction
@@ -45,7 +51,7 @@ class RDoc::RubygemsHook
45
51
  # Post installs hook that generates documentation for each specification in
46
52
  # +specs+
47
53
 
48
- def self.generation_hook installer, specs
54
+ def self.generate installer, specs
49
55
  start = Time.now
50
56
  types = installer.document
51
57
 
@@ -64,6 +70,10 @@ class RDoc::RubygemsHook
64
70
  say "Done installing documentation for #{names} after #{duration} seconds"
65
71
  end
66
72
 
73
+ def self.remove uninstaller
74
+ new(uninstaller.spec).remove
75
+ end
76
+
67
77
  ##
68
78
  # Loads the RDoc generator
69
79
 
@@ -246,3 +256,56 @@ class RDoc::RubygemsHook
246
256
  end
247
257
 
248
258
  end
259
+
260
+ # This class is referenced by RubyGems to create documents.
261
+ # All implementations are moved to the above RubyGemsHook.
262
+ #
263
+ # This class does nothing when this RDoc is installed as a normal gem
264
+ # or a bundled gem.
265
+ #
266
+ # This class does generate/remove documents for compatibility when
267
+ # this RDoc is installed as a default gem.
268
+ #
269
+ # We can remove this when all maintained RubyGems remove
270
+ # `rubygems/rdoc.rb`.
271
+ module RDoc
272
+ class RubygemsHook
273
+
274
+ attr_accessor :generate_rdoc, :generate_ri
275
+
276
+ def self.default_gem?
277
+ !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
278
+ end
279
+
280
+ def initialize(spec, generate_rdoc = false, generate_ri = true)
281
+ @spec = spec
282
+ @generate_rdoc = generate_rdoc
283
+ @generate_ri = generate_ri
284
+ end
285
+
286
+ def generate
287
+ # Do nothing if this is NOT a default gem.
288
+ return unless self.class.default_gem?
289
+
290
+ # Generate document for compatibility if this is a default gem.
291
+ RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri).generate
292
+ end
293
+
294
+ def remove
295
+ # Do nothing if this is NOT a default gem.
296
+ return unless self.class.default_gem?
297
+
298
+ # Remove generated document for compatibility if this is a
299
+ # default gem.
300
+ RubyGemsHook.new(@spec).remove
301
+ end
302
+
303
+ def self.generation_hook installer, specs
304
+ # Do nothing if this is NOT a default gem.
305
+ return unless default_gem?
306
+
307
+ # Generate document for compatibility if this is a default gem.
308
+ RubyGemsHook.generate(installer, specs)
309
+ end
310
+ end
311
+ end
data/lib/rdoc/store.rb CHANGED
@@ -197,6 +197,18 @@ class RDoc::Store
197
197
  top_level
198
198
  end
199
199
 
200
+ ##
201
+ # Make sure any references to C variable names are resolved to the corresponding class.
202
+ #
203
+
204
+ def resolve_c_superclasses
205
+ @classes_hash.each_value do |klass|
206
+ if klass.superclass.is_a?(String) && (candidate = find_c_enclosure(klass.superclass))
207
+ klass.superclass = candidate
208
+ end
209
+ end
210
+ end
211
+
200
212
  ##
201
213
  # Sets the parser of +absolute_name+, unless it from a source code file.
202
214
 
data/lib/rdoc/version.rb CHANGED
@@ -5,6 +5,6 @@ module RDoc
5
5
  ##
6
6
  # RDoc version you are using
7
7
 
8
- VERSION = '6.8.1'
8
+ VERSION = '6.9.0'
9
9
 
10
10
  end
data/lib/rdoc.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  $DEBUG_RDOC = nil
3
3
 
4
- # :main: README.rdoc
5
-
6
4
  ##
7
5
  # RDoc produces documentation for Ruby source files by parsing the source and
8
6
  # extracting the definition for classes, modules, methods, includes and
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # If this file is exist, RDoc generates and removes documents by rubygems plugins.
4
+ #
5
+ # In follwing cases,
6
+ # RubyGems directly exectute RDoc::RubygemsHook.generation_hook and RDoc::RubygemsHook#remove to generate and remove documents.
7
+ #
8
+ # - RDoc is used as a default gem.
9
+ # - RDoc is a old version that doesn't have rubygems_plugin.rb.
10
+
11
+ require_relative 'rdoc/rubygems_hook'
12
+
13
+ # To install dependency libraries of RDoc, you need to run bundle install.
14
+ # At that time, rdoc/markdown is not generated.
15
+ # If generate and remove are executed at that time, an error will occur.
16
+ # So, we can't register generate and remove to Gem at that time.
17
+ begin
18
+ require_relative 'rdoc/markdown'
19
+ rescue LoadError
20
+ else
21
+ Gem.done_installing(&RDoc::RubyGemsHook.method(:generate))
22
+ Gem.pre_uninstall(&RDoc::RubyGemsHook.method(:remove))
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.1
4
+ version: 6.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2024-11-19 00:00:00.000000000 Z
17
+ date: 2024-12-13 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: psych
@@ -105,7 +105,6 @@ files:
105
105
  - lib/rdoc/generator/pot/po.rb
106
106
  - lib/rdoc/generator/pot/po_entry.rb
107
107
  - lib/rdoc/generator/ri.rb
108
- - lib/rdoc/generator/template/darkfish/.document
109
108
  - lib/rdoc/generator/template/darkfish/_footer.rhtml
110
109
  - lib/rdoc/generator/template/darkfish/_head.rhtml
111
110
  - lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
@@ -163,7 +162,6 @@ files:
163
162
  - lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
164
163
  - lib/rdoc/generator/template/darkfish/servlet_root.rhtml
165
164
  - lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
166
- - lib/rdoc/generator/template/json_index/.document
167
165
  - lib/rdoc/generator/template/json_index/js/navigation.js
168
166
  - lib/rdoc/generator/template/json_index/js/searcher.js
169
167
  - lib/rdoc/i18n.rb
@@ -215,6 +213,7 @@ files:
215
213
  - lib/rdoc/parser/c.rb
216
214
  - lib/rdoc/parser/changelog.rb
217
215
  - lib/rdoc/parser/markdown.rb
216
+ - lib/rdoc/parser/prism_ruby.rb
218
217
  - lib/rdoc/parser/rd.rb
219
218
  - lib/rdoc/parser/ripper_state_lex.rb
220
219
  - lib/rdoc/parser/ruby.rb
@@ -246,6 +245,7 @@ files:
246
245
  - lib/rdoc/token_stream.rb
247
246
  - lib/rdoc/tom_doc.rb
248
247
  - lib/rdoc/version.rb
248
+ - lib/rubygems_plugin.rb
249
249
  - man/ri.1
250
250
  homepage: https://ruby.github.io/rdoc
251
251
  licenses:
File without changes
@@ -1 +0,0 @@
1
- # ignore all files in this directory