rdoc 6.8.1 → 6.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdoc/code_object/alias.rb +2 -9
  3. data/lib/rdoc/code_object/any_method.rb +7 -12
  4. data/lib/rdoc/code_object/attr.rb +4 -7
  5. data/lib/rdoc/code_object/class_module.rb +53 -20
  6. data/lib/rdoc/code_object/constant.rb +1 -1
  7. data/lib/rdoc/code_object/context/section.rb +10 -68
  8. data/lib/rdoc/code_object/context.rb +4 -46
  9. data/lib/rdoc/code_object/method_attr.rb +16 -24
  10. data/lib/rdoc/code_object/require.rb +1 -1
  11. data/lib/rdoc/code_object/top_level.rb +6 -24
  12. data/lib/rdoc/code_object.rb +3 -35
  13. data/lib/rdoc/comment.rb +12 -5
  14. data/lib/rdoc/generator/darkfish.rb +92 -108
  15. data/lib/rdoc/generator/json_index.rb +1 -17
  16. data/lib/rdoc/generator/markup.rb +2 -2
  17. data/lib/rdoc/generator/pot/message_extractor.rb +2 -2
  18. data/lib/rdoc/generator/pot.rb +0 -5
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -29
  20. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  21. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  22. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
  23. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +40 -21
  24. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -4
  25. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -1
  26. data/lib/rdoc/markdown.kpeg +7 -5
  27. data/lib/rdoc/markdown.rb +34 -21
  28. data/lib/rdoc/markup/formatter.rb +19 -12
  29. data/lib/rdoc/markup/heading.rb +7 -1
  30. data/lib/rdoc/markup/pre_process.rb +17 -0
  31. data/lib/rdoc/markup/to_html.rb +7 -2
  32. data/lib/rdoc/markup/to_html_crossref.rb +63 -12
  33. data/lib/rdoc/markup/to_rdoc.rb +1 -1
  34. data/lib/rdoc/options.rb +68 -7
  35. data/lib/rdoc/parser/c.rb +29 -8
  36. data/lib/rdoc/parser/changelog.rb +3 -2
  37. data/lib/rdoc/parser/prism_ruby.rb +1092 -0
  38. data/lib/rdoc/parser/ruby.rb +8 -11
  39. data/lib/rdoc/parser/simple.rb +1 -1
  40. data/lib/rdoc/parser.rb +3 -3
  41. data/lib/rdoc/rd/block_parser.rb +3 -3
  42. data/lib/rdoc/rd/inline_parser.rb +3 -3
  43. data/lib/rdoc/rdoc.rb +6 -19
  44. data/lib/rdoc/ri/driver.rb +75 -26
  45. data/lib/rdoc/rubygems_hook.rb +91 -15
  46. data/lib/rdoc/servlet.rb +8 -7
  47. data/lib/rdoc/stats.rb +2 -2
  48. data/lib/rdoc/store.rb +21 -13
  49. data/lib/rdoc/text.rb +2 -2
  50. data/lib/rdoc/version.rb +1 -1
  51. data/lib/rdoc.rb +0 -2
  52. data/lib/rubygems_plugin.rb +23 -0
  53. metadata +5 -10
  54. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  55. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  56. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  57. data/lib/rdoc/generator/template/json_index/.document +0 -1
@@ -199,6 +199,19 @@ nav h3,
199
199
  font-size: 1em;
200
200
  }
201
201
 
202
+ ol.breadcrumb {
203
+ display: flex;
204
+
205
+ padding: 0;
206
+ margin: 0 0 1em;
207
+ }
208
+
209
+ ol.breadcrumb li {
210
+ display: block;
211
+ list-style: none;
212
+ font-size: 125%;
213
+ }
214
+
202
215
  nav ul,
203
216
  nav dl,
204
217
  nav p {
@@ -292,6 +305,14 @@ main {
292
305
  main {
293
306
  margin-left: var(--sidebar-width);
294
307
  }
308
+
309
+ .table-of-contents main {
310
+ margin-left: 20em;
311
+ }
312
+
313
+ #navigation-toggle {
314
+ display: none;
315
+ }
295
316
  }
296
317
 
297
318
  main h1[class] {
@@ -311,12 +332,6 @@ main h6 {
311
332
  color: var(--highlight-color);
312
333
  }
313
334
 
314
- @media (min-width: 1024px) {
315
- .table-of-contents main {
316
- margin-left: 20em;
317
- }
318
- }
319
-
320
335
  /* Search */
321
336
  #search-section {
322
337
  padding: 1em;
@@ -469,14 +484,30 @@ main dl {
469
484
  }
470
485
 
471
486
  main dt {
472
- margin-bottom: 0.5em;
487
+ line-height: 1.5; /* matches `main p` */
488
+ font-weight: bold;
489
+ }
490
+
491
+ main dl.note-list dt {
473
492
  margin-right: 1em;
474
493
  float: left;
475
- font-weight: bold;
494
+ }
495
+
496
+ main dl.note-list dt:has(+ dt) {
497
+ margin-right: 0.25em;
498
+ }
499
+
500
+ main dl.note-list dt:has(+ dt)::after {
501
+ content: ', ';
502
+ font-weight: normal;
476
503
  }
477
504
 
478
505
  main dd {
479
- margin: 0 1em 1em 0.5em;
506
+ margin: 0 0 1em 1em;
507
+ }
508
+
509
+ main dd p:first-child {
510
+ margin-top: 0;
480
511
  }
481
512
 
482
513
  /* Headers within Main */
@@ -498,18 +529,6 @@ main header h3 {
498
529
  .hide { display: none !important; }
499
530
  .initially-hidden { display: none; }
500
531
 
501
- /* Media Queries */
502
- @media (min-width: 1024px) {
503
- /* Styles for larger screens */
504
- .table-of-contents main {
505
- margin-left: 20em;
506
- }
507
- }
508
-
509
- @media print {
510
- /* Print-specific styles */
511
- }
512
-
513
532
  /* Table of Contents */
514
533
  .table-of-contents ul {
515
534
  margin: 1em;
@@ -7,6 +7,7 @@
7
7
  <%= render '_sidebar_search.rhtml' %>
8
8
  </div>
9
9
 
10
+ <%= render '_sidebar_table_of_contents.rhtml' if defined?(current) %>
10
11
  <%= render '_sidebar_pages.rhtml' %>
11
12
  <%= render '_sidebar_classes.rhtml' %>
12
13
 
@@ -14,10 +15,9 @@
14
15
  </nav>
15
16
 
16
17
  <main role="main">
17
- <%- if @options.main_page and
18
- main_page = @files.find { |f| f.full_name == @options.main_page } then %>
19
- <%= main_page.description %>
18
+ <%- if @main_page %>
19
+ <%= @main_page.description %>
20
20
  <%- else -%>
21
- <p>This is the API documentation for <%= h @title %>.
21
+ <p>This is the API documentation for <%= h @title %>.
22
22
  <%- end -%>
23
23
  </main>
@@ -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
 
@@ -992,9 +992,8 @@ Strike = &{ strike? }
992
992
  "~~"
993
993
  { strike a.join }
994
994
 
995
- # TODO alt text support
996
- Image = "!" ( ExplicitLink | ReferenceLink ):a
997
- { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
995
+ Image = "!" ExplicitLinkWithLabel:a
996
+ { "rdoc-image:#{a[:link]}:#{a[:label]}" }
998
997
 
999
998
  Link = ExplicitLink | ReferenceLink | AutoLink
1000
999
 
@@ -1006,8 +1005,11 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label
1006
1005
  ReferenceLinkSingle = Label:content < (Spnl "[]")? >
1007
1006
  { link_to content, content, text }
1008
1007
 
1009
- ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")"
1010
- { "{#{l}}[#{s}]" }
1008
+ ExplicitLink = ExplicitLinkWithLabel:a
1009
+ { "{#{a[:label]}}[#{a[:link]}]" }
1010
+
1011
+ ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")"
1012
+ { { label: label, link: link } }
1011
1013
 
1012
1014
  Source = ( "<" < SourceContents > ">" | < SourceContents > )
1013
1015
  { text }
data/lib/rdoc/markdown.rb CHANGED
@@ -10978,7 +10978,7 @@ class RDoc::Markdown
10978
10978
  return _tmp
10979
10979
  end
10980
10980
 
10981
- # Image = "!" (ExplicitLink | ReferenceLink):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
10981
+ # Image = "!" ExplicitLinkWithLabel:a { "rdoc-image:#{a[:link]}:#{a[:label]}" }
10982
10982
  def _Image
10983
10983
 
10984
10984
  _save = self.pos
@@ -10988,24 +10988,13 @@ class RDoc::Markdown
10988
10988
  self.pos = _save
10989
10989
  break
10990
10990
  end
10991
-
10992
- _save1 = self.pos
10993
- while true # choice
10994
- _tmp = apply(:_ExplicitLink)
10995
- break if _tmp
10996
- self.pos = _save1
10997
- _tmp = apply(:_ReferenceLink)
10998
- break if _tmp
10999
- self.pos = _save1
11000
- break
11001
- end # end choice
11002
-
10991
+ _tmp = apply(:_ExplicitLinkWithLabel)
11003
10992
  a = @result
11004
10993
  unless _tmp
11005
10994
  self.pos = _save
11006
10995
  break
11007
10996
  end
11008
- @result = begin; "rdoc-image:#{a[/\[(.*)\]/, 1]}" ; end
10997
+ @result = begin; "rdoc-image:#{a[:link]}:#{a[:label]}" ; end
11009
10998
  _tmp = true
11010
10999
  unless _tmp
11011
11000
  self.pos = _save
@@ -11153,13 +11142,36 @@ class RDoc::Markdown
11153
11142
  return _tmp
11154
11143
  end
11155
11144
 
11156
- # ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" }
11145
+ # ExplicitLink = ExplicitLinkWithLabel:a { "{#{a[:label]}}[#{a[:link]}]" }
11157
11146
  def _ExplicitLink
11158
11147
 
11148
+ _save = self.pos
11149
+ while true # sequence
11150
+ _tmp = apply(:_ExplicitLinkWithLabel)
11151
+ a = @result
11152
+ unless _tmp
11153
+ self.pos = _save
11154
+ break
11155
+ end
11156
+ @result = begin; "{#{a[:label]}}[#{a[:link]}]" ; end
11157
+ _tmp = true
11158
+ unless _tmp
11159
+ self.pos = _save
11160
+ end
11161
+ break
11162
+ end # end sequence
11163
+
11164
+ set_failed_rule :_ExplicitLink unless _tmp
11165
+ return _tmp
11166
+ end
11167
+
11168
+ # ExplicitLinkWithLabel = Label:label "(" @Sp Source:link Spnl Title @Sp ")" { { label: label, link: link } }
11169
+ def _ExplicitLinkWithLabel
11170
+
11159
11171
  _save = self.pos
11160
11172
  while true # sequence
11161
11173
  _tmp = apply(:_Label)
11162
- l = @result
11174
+ label = @result
11163
11175
  unless _tmp
11164
11176
  self.pos = _save
11165
11177
  break
@@ -11175,7 +11187,7 @@ class RDoc::Markdown
11175
11187
  break
11176
11188
  end
11177
11189
  _tmp = apply(:_Source)
11178
- s = @result
11190
+ link = @result
11179
11191
  unless _tmp
11180
11192
  self.pos = _save
11181
11193
  break
@@ -11200,7 +11212,7 @@ class RDoc::Markdown
11200
11212
  self.pos = _save
11201
11213
  break
11202
11214
  end
11203
- @result = begin; "{#{l}}[#{s}]" ; end
11215
+ @result = begin; { label: label, link: link } ; end
11204
11216
  _tmp = true
11205
11217
  unless _tmp
11206
11218
  self.pos = _save
@@ -11208,7 +11220,7 @@ class RDoc::Markdown
11208
11220
  break
11209
11221
  end # end sequence
11210
11222
 
11211
- set_failed_rule :_ExplicitLink unless _tmp
11223
+ set_failed_rule :_ExplicitLinkWithLabel unless _tmp
11212
11224
  return _tmp
11213
11225
  end
11214
11226
 
@@ -16711,12 +16723,13 @@ class RDoc::Markdown
16711
16723
  Rules[:_StrongStar] = rule_info("StrongStar", "\"**\" !@Whitespace @StartList:a (!\"**\" Inline:b { a << b })+ \"**\" { strong a.join }")
16712
16724
  Rules[:_StrongUl] = rule_info("StrongUl", "\"__\" !@Whitespace @StartList:a (!\"__\" Inline:b { a << b })+ \"__\" { strong a.join }")
16713
16725
  Rules[:_Strike] = rule_info("Strike", "&{ strike? } \"~~\" !@Whitespace @StartList:a (!\"~~\" Inline:b { a << b })+ \"~~\" { strike a.join }")
16714
- Rules[:_Image] = rule_info("Image", "\"!\" (ExplicitLink | ReferenceLink):a { \"rdoc-image:\#{a[/\\[(.*)\\]/, 1]}\" }")
16726
+ Rules[:_Image] = rule_info("Image", "\"!\" ExplicitLinkWithLabel:a { \"rdoc-image:\#{a[:link]}:\#{a[:label]}\" }")
16715
16727
  Rules[:_Link] = rule_info("Link", "(ExplicitLink | ReferenceLink | AutoLink)")
16716
16728
  Rules[:_ReferenceLink] = rule_info("ReferenceLink", "(ReferenceLinkDouble | ReferenceLinkSingle)")
16717
16729
  Rules[:_ReferenceLinkDouble] = rule_info("ReferenceLinkDouble", "Label:content < Spnl > !\"[]\" Label:label { link_to content, label, text }")
16718
16730
  Rules[:_ReferenceLinkSingle] = rule_info("ReferenceLinkSingle", "Label:content < (Spnl \"[]\")? > { link_to content, content, text }")
16719
- Rules[:_ExplicitLink] = rule_info("ExplicitLink", "Label:l \"(\" @Sp Source:s Spnl Title @Sp \")\" { \"{\#{l}}[\#{s}]\" }")
16731
+ Rules[:_ExplicitLink] = rule_info("ExplicitLink", "ExplicitLinkWithLabel:a { \"{\#{a[:label]}}[\#{a[:link]}]\" }")
16732
+ Rules[:_ExplicitLinkWithLabel] = rule_info("ExplicitLinkWithLabel", "Label:label \"(\" @Sp Source:link Spnl Title @Sp \")\" { { label: label, link: link } }")
16720
16733
  Rules[:_Source] = rule_info("Source", "(\"<\" < SourceContents > \">\" | < SourceContents >) { text }")
16721
16734
  Rules[:_SourceContents] = rule_info("SourceContents", "((!\"(\" !\")\" !\">\" Nonspacechar)+ | \"(\" SourceContents \")\")*")
16722
16735
  Rules[:_Title] = rule_info("Title", "(TitleSingle | TitleDouble | \"\"):a { a }")
@@ -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
@@ -66,7 +66,13 @@ RDoc::Markup::Heading =
66
66
  # element.
67
67
 
68
68
  def plain_html
69
- self.class.to_html.to_html(text.dup)
69
+ text = self.text.dup
70
+
71
+ if matched = text.match(/rdoc-image:[^:]+:(.*)/)
72
+ text = matched[1]
73
+ end
74
+
75
+ self.class.to_html.to_html(text)
70
76
  end
71
77
 
72
78
  def pretty_print q # :nodoc:
@@ -187,6 +187,14 @@ class RDoc::Markup::PreProcess
187
187
  include_file filename, prefix, encoding
188
188
  when 'main' then
189
189
  @options.main_page = param if @options.respond_to? :main_page
190
+ warn <<~MSG
191
+ The :main: directive is deprecated and will be removed in RDoc 7.
192
+
193
+ You can use these options to specify the initial page displayed instead:
194
+ - `--main=#{param}` via the command line
195
+ - `rdoc.main = "#{param}"` if you use `RDoc::Task`
196
+ - `main_page: #{param}` in your `.rdoc_options` file
197
+ MSG
190
198
 
191
199
  blankline
192
200
  when 'nodoc' then
@@ -217,6 +225,15 @@ class RDoc::Markup::PreProcess
217
225
  when 'title' then
218
226
  @options.default_title = param if @options.respond_to? :default_title=
219
227
 
228
+ warn <<~MSG
229
+ The :title: directive is deprecated and will be removed in RDoc 7.
230
+
231
+ You can use these options to specify the title displayed instead:
232
+ - `--title=#{param}` via the command line
233
+ - `rdoc.title = "#{param}"` if you use `RDoc::Task`
234
+ - `title: #{param}` in your `.rdoc_options` file
235
+ MSG
236
+
220
237
  blankline
221
238
  when 'yield', 'yields' then
222
239
  return blankline unless code_object
@@ -98,7 +98,12 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
98
98
 
99
99
  gen_url CGI.escapeHTML(url), CGI.escapeHTML(text)
100
100
  when /^rdoc-image:/
101
- %[<img src=\"#{CGI.escapeHTML($')}\">]
101
+ url, alt = $'.split(":", 2) # Split the string after "rdoc-image:" into url and alt
102
+ if alt && !alt.empty?
103
+ %[<img src="#{CGI.escapeHTML(url)}" alt="#{CGI.escapeHTML(alt)}">]
104
+ else
105
+ %[<img src="#{CGI.escapeHTML(url)}">]
106
+ end
102
107
  when /\Ardoc-[a-z]+:/
103
108
  CGI.escapeHTML($')
104
109
  end
@@ -407,7 +412,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
407
412
  "<li>"
408
413
  when :LABEL, :NOTE then
409
414
  Array(list_item.label).map do |label|
410
- "<dt>#{to_html label}\n"
415
+ "<dt>#{to_html label}</dt>\n"
411
416
  end.join << "<dd>"
412
417
  else
413
418
  raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
@@ -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
  ##
@@ -83,6 +83,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
83
83
  def handle_regexp_CROSSREF(target)
84
84
  name = target.text
85
85
 
86
+ return name if @options.autolink_excluded_words&.include?(name)
87
+
86
88
  return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
87
89
 
88
90
  unless @hyperlink_all then
@@ -92,7 +94,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
92
94
  return name if name =~ /\A[a-z]*\z/
93
95
  end
94
96
 
95
- cross_reference name
97
+ cross_reference name, rdoc_ref: false
96
98
  end
97
99
 
98
100
  ##
@@ -100,9 +102,14 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
100
102
  # handle other schemes.
101
103
 
102
104
  def handle_regexp_HYPERLINK target
103
- return cross_reference $' if target.text =~ /\Ardoc-ref:/
105
+ url = target.text
104
106
 
105
- super
107
+ case url
108
+ when /\Ardoc-ref:/
109
+ cross_reference $', rdoc_ref: true
110
+ else
111
+ super
112
+ end
106
113
  end
107
114
 
108
115
  ##
@@ -117,8 +124,8 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
117
124
  url = target.text
118
125
 
119
126
  case url
120
- when /\Ardoc-ref:/ then
121
- cross_reference $'
127
+ when /\Ardoc-ref:/
128
+ cross_reference $', rdoc_ref: true
122
129
  else
123
130
  super
124
131
  end
@@ -129,16 +136,18 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
129
136
  # RDoc::Markup::ToHtml to handle other schemes.
130
137
 
131
138
  def gen_url url, text
132
- return super unless url =~ /\Ardoc-ref:/
133
-
134
- name = $'
135
- cross_reference name, text, name == text
139
+ if url =~ /\Ardoc-ref:/
140
+ name = $'
141
+ cross_reference name, text, name == text, rdoc_ref: true
142
+ else
143
+ super
144
+ end
136
145
  end
137
146
 
138
147
  ##
139
148
  # Creates an HTML link to +name+ with the given +text+.
140
149
 
141
- def link name, text, code = true
150
+ def link name, text, code = true, rdoc_ref: false
142
151
  if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])?@/
143
152
  name = $1
144
153
  label = $'
@@ -148,6 +157,9 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
148
157
 
149
158
  case ref
150
159
  when String then
160
+ if rdoc_ref && @options.warn_missing_rdoc_ref
161
+ puts "#{@from_path}: `rdoc-ref:#{name}` can't be resolved for `#{text}`"
162
+ end
151
163
  ref
152
164
  else
153
165
  path = ref ? ref.as_href(@from_path) : +""
@@ -172,4 +184,43 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
172
184
  end
173
185
  end
174
186
 
187
+ def convert_flow(flow)
188
+ res = []
189
+
190
+ i = 0
191
+ while i < flow.size
192
+ item = flow[i]
193
+ i += 1
194
+ case item
195
+ when RDoc::Markup::AttrChanger then
196
+ # Make "+Class#method+" a cross reference
197
+ if tt_tag?(item.turn_on) and
198
+ String === (str = flow[i]) and
199
+ RDoc::Markup::AttrChanger === flow[i+1] and
200
+ tt_tag?(flow[i+1].turn_off, true) and
201
+ (@options.hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP).match?(str) and
202
+ (text = cross_reference str) != str
203
+ then
204
+ text = yield text, res if defined?(yield)
205
+ res << text
206
+ i += 2
207
+ next
208
+ end
209
+ off_tags res, item
210
+ on_tags res, item
211
+ when String then
212
+ text = convert_string(item)
213
+ text = yield text, res if defined?(yield)
214
+ res << text
215
+ when RDoc::Markup::RegexpHandling then
216
+ text = convert_regexp_handling(item)
217
+ text = yield text, res if defined?(yield)
218
+ res << text
219
+ else
220
+ raise "Unknown flow element: #{item.inspect}"
221
+ end
222
+ end
223
+
224
+ res.join('')
225
+ end
175
226
  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