rdoc 6.6.2 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 060b06473aafc2a0a07ded738b5be7819ddd0520d7e2033ef72311ff8dd57248
4
- data.tar.gz: 500fd282367d6cefeb9257518a0ed5e5371cf3c09a6addc8ac30be1dbe7ba267
3
+ metadata.gz: 7b5120e82f653957d49d069e88f361f338a2db7f40bdc0756ffcea7d3bd3c4f2
4
+ data.tar.gz: a0f09a9246684a22992f2deff120c238b24fbe59a20dfdfa87b340fecc9ce297
5
5
  SHA512:
6
- metadata.gz: 52461100f11f5123da6874e2786b4a83248435fd4955609647421c49a71c5d6ba98bd869fc3c510e64d148992461762b4213390b7aa33bd9dd80d7caad665638
7
- data.tar.gz: 87b21e587bc4e2d97b35f56b4be8e28a1ac40961dc5caf2f61ab3500f5f3a9147195b917d329a1264cb6f4605daec30bb5603c2269a09c5a89da359074928805
6
+ metadata.gz: e0391b650362cb28f505eaf1d258b259debc4d828ad98643e3a27c1a16811d2bf126b40dd3f9872f4d50536e6875a4691e52c4e6d3732850150710866baf0f69
7
+ data.tar.gz: c8a40bfeedd964ce6b42781c1ee6c93dda1917a3333b79ebe8b886cd26a8fe49b32522a156c39c99811134fa8bd60612aface400f06641bea155d07a9de6ec2a
data/CONTRIBUTING.rdoc CHANGED
@@ -40,7 +40,7 @@ If the tests don't pass on the first run check the {GitHub Actions page}[https:/
40
40
  You can now use `rake` and `autotest` to run the tests.
41
41
 
42
42
  Note: the `rake` command must be used first before running any tests, because
43
- its used to generate various parsers implemented in RDoc. Also `rake clean` is
43
+ it's used to generate various parsers implemented in RDoc. Also `rake clean` is
44
44
  helpful to delete these generated files.
45
45
 
46
46
  == Glossary
data/lib/rdoc/context.rb CHANGED
@@ -710,7 +710,7 @@ class RDoc::Context < RDoc::CodeObject
710
710
  # This method exists to make it easy to work with Context subclasses that
711
711
  # aren't part of RDoc.
712
712
 
713
- def each_ancestor # :nodoc:
713
+ def each_ancestor(&_) # :nodoc:
714
714
  end
715
715
 
716
716
  ##
@@ -9,7 +9,7 @@
9
9
  # RDoc::Markdown as described by the [markdown syntax][syntax].
10
10
  #
11
11
  # To choose Markdown as your only default format see
12
- # RDoc::Options@Saved+Options for instructions on setting up a `.doc_options`
12
+ # RDoc::Options@Saved+Options for instructions on setting up a `.rdoc_options`
13
13
  # file to store your project default.
14
14
  #
15
15
  # ## Usage
@@ -1237,7 +1237,7 @@ DefinitionListItem = ( DefinitionListLabel+ ):label
1237
1237
  list_items
1238
1238
  }
1239
1239
 
1240
- DefinitionListLabel = StrChunk:label @Sp @Newline
1240
+ DefinitionListLabel = Inline:label @Sp @Newline
1241
1241
  { label }
1242
1242
 
1243
1243
  DefinitionListDefinition = @NonindentSpace ":" @Space Inlines:a @BlankLine+
data/lib/rdoc/markdown.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # RDoc::Markdown as described by the [markdown syntax][syntax].
7
7
  #
8
8
  # To choose Markdown as your only default format see
9
- # RDoc::Options@Saved+Options for instructions on setting up a `.doc_options`
9
+ # RDoc::Options@Saved+Options for instructions on setting up a `.rdoc_options`
10
10
  # file to store your project default.
11
11
  #
12
12
  # ## Usage
@@ -16445,12 +16445,12 @@ class RDoc::Markdown
16445
16445
  return _tmp
16446
16446
  end
16447
16447
 
16448
- # DefinitionListLabel = StrChunk:label @Sp @Newline { label }
16448
+ # DefinitionListLabel = Inline:label @Sp @Newline { label }
16449
16449
  def _DefinitionListLabel
16450
16450
 
16451
16451
  _save = self.pos
16452
16452
  while true # sequence
16453
- _tmp = apply(:_StrChunk)
16453
+ _tmp = apply(:_Inline)
16454
16454
  label = @result
16455
16455
  unless _tmp
16456
16456
  self.pos = _save
@@ -16777,7 +16777,7 @@ class RDoc::Markdown
16777
16777
  Rules[:_TableAlign] = rule_info("TableAlign", "< /:?-+:?/ > @Sp { text.start_with?(\":\") ? (text.end_with?(\":\") ? :center : :left) : (text.end_with?(\":\") ? :right : nil) }")
16778
16778
  Rules[:_DefinitionList] = rule_info("DefinitionList", "&{ definition_lists? } DefinitionListItem+:list { RDoc::Markup::List.new :NOTE, *list.flatten }")
16779
16779
  Rules[:_DefinitionListItem] = rule_info("DefinitionListItem", "DefinitionListLabel+:label DefinitionListDefinition+:defns { list_items = [] list_items << RDoc::Markup::ListItem.new(label, defns.shift) list_items.concat defns.map { |defn| RDoc::Markup::ListItem.new nil, defn } unless list_items.empty? list_items }")
16780
- Rules[:_DefinitionListLabel] = rule_info("DefinitionListLabel", "StrChunk:label @Sp @Newline { label }")
16780
+ Rules[:_DefinitionListLabel] = rule_info("DefinitionListLabel", "Inline:label @Sp @Newline { label }")
16781
16781
  Rules[:_DefinitionListDefinition] = rule_info("DefinitionListDefinition", "@NonindentSpace \":\" @Space Inlines:a @BlankLine+ { paragraph a }")
16782
16782
  # :startdoc:
16783
16783
  end
@@ -40,6 +40,31 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
40
40
  @res << "\n"
41
41
  end
42
42
 
43
+ ##
44
+ # Prepares the visitor for consuming +list_item+
45
+
46
+ def accept_list_item_start list_item
47
+ type = @list_type.last
48
+
49
+ case type
50
+ when :NOTE, :LABEL then
51
+ bullets = Array(list_item.label).map do |label|
52
+ attributes(label).strip
53
+ end.join "\n"
54
+
55
+ bullets << ":\n" unless bullets.empty?
56
+
57
+ @prefix = ' ' * @indent
58
+ @indent += 2
59
+ @prefix << bullets + (' ' * @indent)
60
+ else
61
+ bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'
62
+ @prefix = (' ' * @indent) + bullet.ljust(bullet.length + 1)
63
+ width = bullet.length + 1
64
+ @indent += width
65
+ end
66
+ end
67
+
43
68
  ##
44
69
  # Turns on or off regexp handling for +convert_string+
45
70
 
@@ -63,8 +63,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
63
63
 
64
64
  name = name[1..-1] unless @show_hash if name[0, 1] == '#'
65
65
 
66
- if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
67
- text ||= "#{CGI.unescape $'} at <code>#{$1}</code>"
66
+ if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])?@/
67
+ text ||= [CGI.unescape($'), (" at <code>#{$1}</code>" if $~.begin(1))].join("")
68
68
  code = false
69
69
  else
70
70
  text ||= name
@@ -139,35 +139,34 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
139
139
  # Creates an HTML link to +name+ with the given +text+.
140
140
 
141
141
  def link name, text, code = true
142
- if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
142
+ if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])?@/
143
143
  name = $1
144
144
  label = $'
145
145
  end
146
146
 
147
- ref = @cross_reference.resolve name, text
147
+ ref = @cross_reference.resolve name, text if name
148
148
 
149
149
  case ref
150
150
  when String then
151
151
  ref
152
152
  else
153
- path = ref.as_href @from_path
153
+ path = ref ? ref.as_href(@from_path) : +""
154
154
 
155
155
  if code and RDoc::CodeObject === ref and !(RDoc::TopLevel === ref)
156
156
  text = "<code>#{CGI.escapeHTML text}</code>"
157
157
  end
158
158
 
159
- if path =~ /#/ then
160
- path << "-label-#{label}"
161
- elsif ref.sections and
162
- ref.sections.any? { |section| label == section.title } then
163
- path << "##{label}"
164
- else
165
- if ref.respond_to?(:aref)
159
+ if label
160
+ if path =~ /#/
161
+ path << "-label-#{label}"
162
+ elsif ref&.sections&.any? { |section| label == section.title }
163
+ path << "##{label}"
164
+ elsif ref.respond_to?(:aref)
166
165
  path << "##{ref.aref}-label-#{label}"
167
166
  else
168
167
  path << "#label-#{label}"
169
168
  end
170
- end if label
169
+ end
171
170
 
172
171
  "<a href=\"#{path}\">#{text}</a>"
173
172
  end
@@ -45,8 +45,6 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
45
45
  # Finishes consumption of `list`
46
46
 
47
47
  def accept_list_end list
48
- @res << "\n"
49
-
50
48
  super
51
49
  end
52
50
 
@@ -60,6 +58,8 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
60
58
  when :NOTE, :LABEL then
61
59
  use_prefix
62
60
 
61
+ @res << "\n"
62
+
63
63
  4
64
64
  else
65
65
  @list_index[-1] = @list_index.last.succ
@@ -81,11 +81,11 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
81
81
  attributes(label).strip
82
82
  end.join "\n"
83
83
 
84
- bullets << "\n:"
84
+ bullets << "\n" unless bullets.empty?
85
85
 
86
86
  @prefix = ' ' * @indent
87
87
  @indent += 4
88
- @prefix << bullets + (' ' * (@indent - 1))
88
+ @prefix << bullets << ":" << (' ' * (@indent - 1))
89
89
  else
90
90
  bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'
91
91
  @prefix = (' ' * @indent) + bullet.ljust(4)
@@ -145,11 +145,19 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
145
145
 
146
146
  case type
147
147
  when :NOTE, :LABEL then
148
- bullets = Array(list_item.label).map do |label|
148
+ stripped_labels = Array(list_item.label).map do |label|
149
149
  attributes(label).strip
150
- end.join "\n"
150
+ end
151
+
152
+ bullets = case type
153
+ when :NOTE
154
+ stripped_labels.map { |b| "#{b}::" }
155
+ when :LABEL
156
+ stripped_labels.map { |b| "[#{b}]" }
157
+ end
151
158
 
152
- bullets << ":\n" unless bullets.empty?
159
+ bullets = bullets.join("\n")
160
+ bullets << "\n" unless stripped_labels.empty?
153
161
 
154
162
  @prefix = ' ' * @indent
155
163
  @indent += 2
data/lib/rdoc/options.rb CHANGED
@@ -105,6 +105,7 @@ class RDoc::Options
105
105
  generator_name
106
106
  generator_options
107
107
  generators
108
+ locale
108
109
  op_dir
109
110
  page_dir
110
111
  option_parser
data/lib/rdoc/parser/c.rb CHANGED
@@ -756,17 +756,27 @@ class RDoc::Parser::C < RDoc::Parser
756
756
  def gen_const_table file_content
757
757
  table = {}
758
758
  @content.scan(%r{
759
- ((?>^\s*/\*.*?\*/\s+))
760
- rb_define_(\w+)\((?:\s*(?:\w+),)?\s*
761
- "(\w+)"\s*,
759
+ (?<doc>(?>^\s*/\*.*?\*/\s+))
760
+ rb_define_(?<type>\w+)\(\s*(?:\w+),\s*
761
+ "(?<name>\w+)"\s*,
762
762
  .*?\)\s*;
763
+ | (?<doc>(?>^\s*/\*.*?\*/\s+))
764
+ rb_file_(?<type>const)\(\s*
765
+ "(?<name>\w+)"\s*,
766
+ .*?\)\s*;
767
+ | (?<doc>(?>^\s*/\*.*?\*/\s+))
768
+ rb_curses_define_(?<type>const)\(\s*
769
+ (?<name>\w+)
770
+ \s*\)\s*;
763
771
  | Document-(?:const|global|variable):\s
764
- ((?:\w+::)*\w+)
765
- \s*?\n((?>.*?\*/))
772
+ (?<name>(?:\w+::)*\w+)
773
+ \s*?\n(?<doc>(?>.*?\*/))
766
774
  }mxi) do
767
- case
768
- when $1 then table[[$2, $3]] = $1
769
- when $4 then table[$4] = "/*\n" + $5
775
+ name, doc, type = $~.values_at(:name, :doc, :type)
776
+ if type
777
+ table[[type, name]] = doc
778
+ else
779
+ table[name] = "/*\n" + doc
770
780
  end
771
781
  end
772
782
  table
@@ -789,8 +789,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
789
789
  al.line = line_no
790
790
 
791
791
  read_documentation_modifiers al, RDoc::ATTR_MODIFIERS
792
- context.add_alias al
793
- @stats.add_alias al
792
+ if al.document_self or not @track_visibility
793
+ context.add_alias al
794
+ @stats.add_alias al
795
+ end
794
796
 
795
797
  al
796
798
  end
@@ -1453,6 +1455,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
1453
1455
  meth = RDoc::AnyMethod.new get_tkread, name
1454
1456
  look_for_directives_in meth, comment
1455
1457
  meth.singleton = single == SINGLE ? true : singleton
1458
+ if singleton
1459
+ # `current_line_visibility' is useless because it works against
1460
+ # the normal method named as same as the singleton method, after
1461
+ # the latter was defined. Of course these are different things.
1462
+ container.current_line_visibility = :public
1463
+ end
1456
1464
 
1457
1465
  record_location meth
1458
1466
  meth.line = line_no
@@ -1776,6 +1784,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1776
1784
 
1777
1785
  nest = 1
1778
1786
  save_visibility = container.visibility
1787
+ container.visibility = :public unless current_method
1779
1788
 
1780
1789
  non_comment_seen = true
1781
1790
 
data/lib/rdoc/parser.rb CHANGED
@@ -125,9 +125,11 @@ class RDoc::Parser
125
125
  return parser if ext_name.empty?
126
126
 
127
127
  if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/ then
128
- case check_modeline file_name
128
+ case mode = check_modeline(file_name)
129
129
  when nil, 'rdoc' then # continue
130
- else return nil
130
+ else
131
+ RDoc::Parser.parsers.find { |_, p| return p if mode.casecmp?(p.name[/\w+\z/]) }
132
+ return nil
131
133
  end
132
134
  end
133
135
 
@@ -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.7.3
4
+ # This file is automatically generated by Racc 1.8.0
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.7.3'
26
+ VERSION = '1.8.0'
27
27
  Version = VERSION
28
28
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
29
29
  end
@@ -31,10 +31,6 @@ end
31
31
  end
32
32
 
33
33
 
34
- unless defined?(NotImplementedError)
35
- NotImplementedError = NotImplementError # :nodoc:
36
- end
37
-
38
34
  module Racc
39
35
  class ParseError < StandardError; end
40
36
  end
@@ -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.7.3
4
+ # This file is automatically generated by Racc 1.8.0
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.7.3'
26
+ VERSION = '1.8.0'
27
27
  Version = VERSION
28
28
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
29
29
  end
@@ -31,10 +31,6 @@ end
31
31
  end
32
32
 
33
33
 
34
- unless defined?(NotImplementedError)
35
- NotImplementedError = NotImplementError # :nodoc:
36
- end
37
-
38
34
  module Racc
39
35
  class ParseError < StandardError; end
40
36
  end
@@ -1088,7 +1088,7 @@ or the PAGER environment variable.
1088
1088
 
1089
1089
  loop do
1090
1090
  name = if defined? Readline then
1091
- Readline.readline ">> "
1091
+ Readline.readline ">> ", true
1092
1092
  else
1093
1093
  print ">> "
1094
1094
  $stdin.gets
data/lib/rdoc/store.rb CHANGED
@@ -559,9 +559,7 @@ class RDoc::Store
559
559
  def load_cache
560
560
  #orig_enc = @encoding
561
561
 
562
- File.open cache_path, 'rb' do |io|
563
- @cache = Marshal.load io
564
- end
562
+ @cache = marshal_load(cache_path)
565
563
 
566
564
  load_enc = @cache[:encoding]
567
565
 
@@ -618,9 +616,7 @@ class RDoc::Store
618
616
  def load_class_data klass_name
619
617
  file = class_file klass_name
620
618
 
621
- File.open file, 'rb' do |io|
622
- Marshal.load io
623
- end
619
+ marshal_load(file)
624
620
  rescue Errno::ENOENT => e
625
621
  error = MissingFileError.new(self, file, klass_name)
626
622
  error.set_backtrace e.backtrace
@@ -633,14 +629,10 @@ class RDoc::Store
633
629
  def load_method klass_name, method_name
634
630
  file = method_file klass_name, method_name
635
631
 
636
- File.open file, 'rb' do |io|
637
- obj = Marshal.load io
638
- obj.store = self
639
- obj.parent =
640
- find_class_or_module(klass_name) || load_class(klass_name) unless
641
- obj.parent
642
- obj
643
- end
632
+ obj = marshal_load(file)
633
+ obj.store = self
634
+ obj.parent ||= find_class_or_module(klass_name) || load_class(klass_name)
635
+ obj
644
636
  rescue Errno::ENOENT => e
645
637
  error = MissingFileError.new(self, file, klass_name + method_name)
646
638
  error.set_backtrace e.backtrace
@@ -653,11 +645,9 @@ class RDoc::Store
653
645
  def load_page page_name
654
646
  file = page_file page_name
655
647
 
656
- File.open file, 'rb' do |io|
657
- obj = Marshal.load io
658
- obj.store = self
659
- obj
660
- end
648
+ obj = marshal_load(file)
649
+ obj.store = self
650
+ obj
661
651
  rescue Errno::ENOENT => e
662
652
  error = MissingFileError.new(self, file, page_name)
663
653
  error.set_backtrace e.backtrace
@@ -979,4 +969,21 @@ class RDoc::Store
979
969
  @unique_modules
980
970
  end
981
971
 
972
+ private
973
+ def marshal_load(file)
974
+ File.open(file, 'rb') {|io| Marshal.load(io, MarshalFilter)}
975
+ end
976
+
977
+ MarshalFilter = proc do |obj|
978
+ case obj
979
+ when true, false, nil, Array, Class, Encoding, Hash, Integer, String, Symbol, RDoc::Text
980
+ else
981
+ unless obj.class.name.start_with?("RDoc::")
982
+ raise TypeError, "not permitted class: #{obj.class.name}"
983
+ end
984
+ end
985
+ obj
986
+ end
987
+ private_constant :MarshalFilter
988
+
982
989
  end
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.6.2'
8
+ VERSION = '6.7.0'
9
9
 
10
10
  end
data/lib/rdoc.rb CHANGED
@@ -121,7 +121,7 @@ module RDoc
121
121
  end
122
122
 
123
123
  ##
124
- # Seaches and returns the directory for settings.
124
+ # Searches and returns the directory for settings.
125
125
  #
126
126
  # 1. <tt>$HOME/.rdoc</tt> directory, if it exists.
127
127
  # 2. The +rdoc+ directory under the path specified by the
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.6.2
4
+ version: 6.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -11,10 +11,9 @@ authors:
11
11
  - Zachary Scott
12
12
  - Hiroshi SHIBATA
13
13
  - ITOYANAGI Sakura
14
- autorequire:
15
14
  bindir: exe
16
15
  cert_chain: []
17
- date: 2023-12-16 00:00:00.000000000 Z
16
+ date: 2024-05-23 00:00:00.000000000 Z
18
17
  dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: psych
@@ -253,7 +252,6 @@ metadata:
253
252
  homepage_uri: https://ruby.github.io/rdoc
254
253
  source_code_uri: https://github.com/ruby/rdoc
255
254
  changelog_uri: https://github.com/ruby/rdoc/releases
256
- post_install_message:
257
255
  rdoc_options:
258
256
  - "--main"
259
257
  - README.rdoc
@@ -270,8 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
268
  - !ruby/object:Gem::Version
271
269
  version: '2.2'
272
270
  requirements: []
273
- rubygems_version: 3.5.0.dev
274
- signing_key:
271
+ rubygems_version: 3.6.0.dev
275
272
  specification_version: 4
276
273
  summary: RDoc produces HTML and command-line documentation for Ruby projects
277
274
  test_files: []