rdoc 6.9.1 → 6.10.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: 1941dad44ac3feaeea7befa661f56a2b58052b0c3fe14186593139234a5d14ee
4
- data.tar.gz: 85745f705a09ceb1039b8888fe853d617e5391949f9a5dde1d0cfa582a05c2b4
3
+ metadata.gz: 59a2919a713acb30b6faff04d96186d25a5e7ab06b76fdfb0df2d42b086b4517
4
+ data.tar.gz: 78cb25012a74e585bf9deb1cb0829404cd568d098eac337048a04170f3a7df61
5
5
  SHA512:
6
- metadata.gz: 2e4a0dd698c7f469b361ee4baf9acded0c4d202df288b026dce14adc79ef44912af00bb74ea7187ac973f6b26d34ca8041bdc2498b796e281b9f9f6a45cdab64
7
- data.tar.gz: 3ecac3e56d13bab06679d072813adc0091fad04a10b9a31ce12ff8137462557a1032a88ca3c42e0cc4d366ecf9e7d13002092605e202fb7dae55a286bfac18ae
6
+ metadata.gz: 26d8df27e608c4f1d07d3c5f20996514523636447136ec9726ddd0cfdf64ee6c28cd9362e9b1c9747ba41076672c21a8e05c54d934de16f3bebed39bd95ebfc6
7
+ data.tar.gz: bfb38f2b3baecd464e36da81caf477de2096ab7c5c059a52167dc0f84bc00b579261b37bf18f63a1ae34953ad1d10699043e1c881166e7c11f17736edb2627e8
@@ -103,6 +103,12 @@ function hookSidebar() {
103
103
  if (isSmallViewport) {
104
104
  navigation.hidden = true;
105
105
  navigationToggle.ariaExpanded = false;
106
+ document.addEventListener('click', (e) => {
107
+ if (e.target.closest('#navigation a')) {
108
+ navigation.hidden = true;
109
+ navigationToggle.ariaExpanded = false;
110
+ }
111
+ });
106
112
  }
107
113
  }
108
114
 
@@ -195,18 +195,20 @@ class RDoc::Markup::Formatter
195
195
  @in_tt > 0
196
196
  end
197
197
 
198
+ def tt_tag? attr_mask, reverse = false
199
+ each_attr_tag(attr_mask, reverse) do |tag|
200
+ return true if tt? tag
201
+ end
202
+ false
203
+ end
204
+
198
205
  ##
199
206
  # Turns on tags for +item+ on +res+
200
207
 
201
208
  def on_tags res, item
202
- attr_mask = item.turn_on
203
- return if attr_mask.zero?
204
-
205
- @attr_tags.each do |tag|
206
- if attr_mask & tag.bit != 0 then
207
- res << annotate(tag.on)
208
- @in_tt += 1 if tt? tag
209
- end
209
+ each_attr_tag(item.turn_on) do |tag|
210
+ res << annotate(tag.on)
211
+ @in_tt += 1 if tt? tag
210
212
  end
211
213
  end
212
214
 
@@ -214,13 +216,18 @@ class RDoc::Markup::Formatter
214
216
  # Turns off tags for +item+ on +res+
215
217
 
216
218
  def off_tags res, item
217
- attr_mask = item.turn_off
219
+ each_attr_tag(item.turn_off, true) do |tag|
220
+ @in_tt -= 1 if tt? tag
221
+ res << annotate(tag.off)
222
+ end
223
+ end
224
+
225
+ def each_attr_tag attr_mask, reverse = false
218
226
  return if attr_mask.zero?
219
227
 
220
- @attr_tags.reverse_each do |tag|
228
+ @attr_tags.public_send(reverse ? :reverse_each : :each) do |tag|
221
229
  if attr_mask & tag.bit != 0 then
222
- @in_tt -= 1 if tt? tag
223
- res << annotate(tag.off)
230
+ yield tag
224
231
  end
225
232
  end
226
233
  end
@@ -58,7 +58,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
58
58
  # Creates a link to the reference +name+ if the name exists. If +text+ is
59
59
  # given it is used as the link text, otherwise +name+ is used.
60
60
 
61
- def cross_reference name, text = nil, code = true
61
+ def cross_reference name, text = nil, code = true, rdoc_ref: false
62
62
  lookup = name
63
63
 
64
64
  name = name[1..-1] unless @show_hash if name[0, 1] == '#'
@@ -70,7 +70,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
70
70
  text ||= name
71
71
  end
72
72
 
73
- link lookup, text, code
73
+ link lookup, text, code, rdoc_ref: rdoc_ref
74
74
  end
75
75
 
76
76
  ##
@@ -92,7 +92,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
92
92
  return name if name =~ /\A[a-z]*\z/
93
93
  end
94
94
 
95
- cross_reference name
95
+ cross_reference name, rdoc_ref: false
96
96
  end
97
97
 
98
98
  ##
@@ -100,9 +100,14 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
100
100
  # handle other schemes.
101
101
 
102
102
  def handle_regexp_HYPERLINK target
103
- return cross_reference $' if target.text =~ /\Ardoc-ref:/
103
+ url = target.text
104
104
 
105
- super
105
+ case url
106
+ when /\Ardoc-ref:/
107
+ cross_reference $', rdoc_ref: true
108
+ else
109
+ super
110
+ end
106
111
  end
107
112
 
108
113
  ##
@@ -117,8 +122,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
117
122
  url = target.text
118
123
 
119
124
  case url
120
- when /\Ardoc-ref:/ then
121
- cross_reference $'
125
+ when /\Ardoc-ref:/
126
+ cross_reference $', rdoc_ref: true
122
127
  else
123
128
  super
124
129
  end
@@ -129,16 +134,18 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
129
134
  # RDoc::Markup::ToHtml to handle other schemes.
130
135
 
131
136
  def gen_url url, text
132
- return super unless url =~ /\Ardoc-ref:/
133
-
134
- name = $'
135
- cross_reference name, text, name == text
137
+ if url =~ /\Ardoc-ref:/
138
+ name = $'
139
+ cross_reference name, text, name == text, rdoc_ref: true
140
+ else
141
+ super
142
+ end
136
143
  end
137
144
 
138
145
  ##
139
146
  # Creates an HTML link to +name+ with the given +text+.
140
147
 
141
- def link name, text, code = true
148
+ def link name, text, code = true, rdoc_ref: false
142
149
  if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])?@/
143
150
  name = $1
144
151
  label = $'
@@ -148,6 +155,9 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
148
155
 
149
156
  case ref
150
157
  when String then
158
+ if rdoc_ref && @options.warn_missing_rdoc_ref
159
+ puts "#{@from_path}: `rdoc-ref:#{name}` can't be resolved for `#{text}`"
160
+ end
151
161
  ref
152
162
  else
153
163
  path = ref ? ref.as_href(@from_path) : +""
@@ -172,4 +182,43 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
172
182
  end
173
183
  end
174
184
 
185
+ def convert_flow(flow)
186
+ res = []
187
+
188
+ i = 0
189
+ while i < flow.size
190
+ item = flow[i]
191
+ i += 1
192
+ case item
193
+ when RDoc::Markup::AttrChanger then
194
+ # Make "+Class#method+" a cross reference
195
+ if tt_tag?(item.turn_on) and
196
+ String === (str = flow[i]) and
197
+ RDoc::Markup::AttrChanger === flow[i+1] and
198
+ tt_tag?(flow[i+1].turn_off, true) and
199
+ (@options.hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP).match?(str) and
200
+ (text = cross_reference str) != str
201
+ then
202
+ text = yield text, res if defined?(yield)
203
+ res << text
204
+ i += 2
205
+ next
206
+ end
207
+ off_tags res, item
208
+ on_tags res, item
209
+ when String then
210
+ text = convert_string(item)
211
+ text = yield text, res if defined?(yield)
212
+ res << text
213
+ when RDoc::Markup::RegexpHandling then
214
+ text = convert_regexp_handling(item)
215
+ text = yield text, res if defined?(yield)
216
+ res << text
217
+ else
218
+ raise "Unknown flow element: #{item.inspect}"
219
+ end
220
+ end
221
+
222
+ res.join('')
223
+ end
175
224
  end
@@ -254,7 +254,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
254
254
  end
255
255
  aligns = aligns.map do |a|
256
256
  case a
257
- when nil
257
+ when nil, :center
258
258
  :center
259
259
  when :left
260
260
  :ljust
data/lib/rdoc/options.rb CHANGED
@@ -325,6 +325,12 @@ class RDoc::Options
325
325
 
326
326
  attr_accessor :verbosity
327
327
 
328
+ ##
329
+ # Warn if rdoc-ref links can't be resolved
330
+ # Default is +false+
331
+
332
+ attr_accessor :warn_missing_rdoc_ref
333
+
328
334
  ##
329
335
  # URL of web cvs frontend
330
336
 
@@ -393,6 +399,7 @@ class RDoc::Options
393
399
  @update_output_dir = true
394
400
  @verbosity = 1
395
401
  @visibility = :protected
402
+ @warn_missing_rdoc_ref = false
396
403
  @webcvs = nil
397
404
  @write_options = false
398
405
  @encoding = Encoding::UTF_8
@@ -457,6 +464,8 @@ class RDoc::Options
457
464
  @visibility = map['visibility'] if map.has_key?('visibility')
458
465
  @webcvs = map['webcvs'] if map.has_key?('webcvs')
459
466
 
467
+ @warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
468
+
460
469
  if map.has_key?('rdoc_include')
461
470
  @rdoc_include = sanitize_path map['rdoc_include']
462
471
  end
@@ -1104,6 +1113,13 @@ Usage: #{opt.program_name} [options] [names...]
1104
1113
 
1105
1114
  opt.separator nil
1106
1115
 
1116
+ opt.on("--warn-missing-rdoc-ref",
1117
+ "Warn if rdoc-ref links can't be resolved") do |value|
1118
+ @warn_missing_rdoc_ref = value
1119
+ end
1120
+
1121
+ opt.separator nil
1122
+
1107
1123
  opt.on("--[no-]ignore-invalid",
1108
1124
  "Ignore invalid options and continue",
1109
1125
  "(default true).") do |value|
data/lib/rdoc/parser/c.rb CHANGED
@@ -405,6 +405,7 @@ class RDoc::Parser::C < RDoc::Parser
405
405
  \s*(.*?)\s*\)\s*;
406
406
  %xm) do |type, var_name, const_name, definition|
407
407
  var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
408
+ type = "const" if type == "global_const"
408
409
  handle_constants type, var_name, const_name, definition
409
410
  end
410
411
 
@@ -760,6 +761,10 @@ class RDoc::Parser::C < RDoc::Parser
760
761
  rb_define_(?<type>\w+)\(\s*(?:\w+),\s*
761
762
  "(?<name>\w+)"\s*,
762
763
  .*?\)\s*;
764
+ | (?<doc>(?>^\s*/\*.*?\*/\s+))
765
+ rb_define_global_(?<type>const)\(\s*
766
+ "(?<name>\w+)"\s*,
767
+ .*?\)\s*;
763
768
  | (?<doc>(?>^\s*/\*.*?\*/\s+))
764
769
  rb_file_(?<type>const)\(\s*
765
770
  "(?<name>\w+)"\s*,
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.9.1'
8
+ VERSION = '6.10.0'
9
9
 
10
10
  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.9.1
4
+ version: 6.10.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-12-16 00:00:00.000000000 Z
17
+ date: 2024-12-18 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: psych
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  - !ruby/object:Gem::Version
272
272
  version: '2.2'
273
273
  requirements: []
274
- rubygems_version: 3.5.11
274
+ rubygems_version: 3.5.22
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: RDoc produces HTML and command-line documentation for Ruby projects