rdoc 6.9.0 → 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: e8d7aec4fc5f30f9f33ef7dccb85f885775137d9fdea7993823ac93c322a6214
4
- data.tar.gz: 5f3636164c89b6a183e9d6598a4633148b8e311f1344a04c6f331c17b8b5b3fb
3
+ metadata.gz: 59a2919a713acb30b6faff04d96186d25a5e7ab06b76fdfb0df2d42b086b4517
4
+ data.tar.gz: 78cb25012a74e585bf9deb1cb0829404cd568d098eac337048a04170f3a7df61
5
5
  SHA512:
6
- metadata.gz: 6d6744cd8cce25be176b36df564646a41656c60ff0a4f6d581748b8300ca8960a14c46f3f14e478c4b6fa9c9c1cfbd12a3fcb25f624637b01473e885a51127bc
7
- data.tar.gz: e4f917825bbed2f768ed8ad28db175b67d37a9919fde1fe4e4383f150ff83d22a49c180874506fecab223e5b892d88a066b327d7edb4bf699e6295adb56adf69
6
+ metadata.gz: 26d8df27e608c4f1d07d3c5f20996514523636447136ec9726ddd0cfdf64ee6c28cd9362e9b1c9747ba41076672c21a8e05c54d934de16f3bebed39bd95ebfc6
7
+ data.tar.gz: bfb38f2b3baecd464e36da81caf477de2096ab7c5c059a52167dc0f84bc00b579261b37bf18f63a1ae34953ad1d10699043e1c881166e7c11f17736edb2627e8
@@ -292,6 +292,14 @@ main {
292
292
  main {
293
293
  margin-left: var(--sidebar-width);
294
294
  }
295
+
296
+ .table-of-contents main {
297
+ margin-left: 20em;
298
+ }
299
+
300
+ #navigation-toggle {
301
+ display: none;
302
+ }
295
303
  }
296
304
 
297
305
  main h1[class] {
@@ -311,12 +319,6 @@ main h6 {
311
319
  color: var(--highlight-color);
312
320
  }
313
321
 
314
- @media (min-width: 1024px) {
315
- .table-of-contents main {
316
- margin-left: 20em;
317
- }
318
- }
319
-
320
322
  /* Search */
321
323
  #search-section {
322
324
  padding: 1em;
@@ -514,18 +516,6 @@ main header h3 {
514
516
  .hide { display: none !important; }
515
517
  .initially-hidden { display: none; }
516
518
 
517
- /* Media Queries */
518
- @media (min-width: 1024px) {
519
- /* Styles for larger screens */
520
- .table-of-contents main {
521
- margin-left: 20em;
522
- }
523
- }
524
-
525
- @media print {
526
- /* Print-specific styles */
527
- }
528
-
529
519
  /* Table of Contents */
530
520
  .table-of-contents ul {
531
521
  margin: 1em;
@@ -99,10 +99,16 @@ function hookSidebar() {
99
99
  navigationToggle.ariaExpanded = navigationToggle.ariaExpanded !== 'true';
100
100
  });
101
101
 
102
- var isSmallViewport = window.matchMedia("(max-width: 1024px)").matches;
102
+ var isSmallViewport = window.matchMedia("(max-width: 1023px)").matches;
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*,
@@ -271,7 +271,7 @@ end
271
271
  module RDoc
272
272
  class RubygemsHook
273
273
 
274
- attr_accessor :generate_rdoc, :generate_ri
274
+ attr_accessor :generate_rdoc, :generate_ri, :force
275
275
 
276
276
  def self.default_gem?
277
277
  !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
@@ -281,6 +281,7 @@ module RDoc
281
281
  @spec = spec
282
282
  @generate_rdoc = generate_rdoc
283
283
  @generate_ri = generate_ri
284
+ @force = false
284
285
  end
285
286
 
286
287
  def generate
@@ -288,7 +289,9 @@ module RDoc
288
289
  return unless self.class.default_gem?
289
290
 
290
291
  # Generate document for compatibility if this is a default gem.
291
- RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri).generate
292
+ hook = RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri)
293
+ hook.force = @force
294
+ hook.generate
292
295
  end
293
296
 
294
297
  def remove
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.0'
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.0
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-13 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