rdoc 7.1.0 → 8.0.0

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +3 -4
  3. data/LICENSE.rdoc +4 -0
  4. data/README.md +43 -2
  5. data/doc/markup_reference/markdown.md +104 -3
  6. data/lib/rdoc/code_object/alias.rb +2 -8
  7. data/lib/rdoc/code_object/any_method.rb +11 -6
  8. data/lib/rdoc/code_object/attr.rb +12 -6
  9. data/lib/rdoc/code_object/class_module.rb +62 -32
  10. data/lib/rdoc/code_object/constant.rb +29 -3
  11. data/lib/rdoc/code_object/context/section.rb +30 -43
  12. data/lib/rdoc/code_object/context.rb +53 -37
  13. data/lib/rdoc/code_object/method_attr.rb +9 -15
  14. data/lib/rdoc/code_object/mixin.rb +3 -0
  15. data/lib/rdoc/code_object/top_level.rb +11 -3
  16. data/lib/rdoc/code_object.rb +2 -4
  17. data/lib/rdoc/comment.rb +1 -66
  18. data/lib/rdoc/cross_reference.rb +8 -30
  19. data/lib/rdoc/encoding.rb +3 -3
  20. data/lib/rdoc/generator/aliki.rb +17 -0
  21. data/lib/rdoc/generator/darkfish.rb +12 -6
  22. data/lib/rdoc/generator/json_index.rb +2 -2
  23. data/lib/rdoc/generator/markup.rb +56 -31
  24. data/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  25. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  26. data/lib/rdoc/generator/template/aliki/_head.rhtml +6 -1
  27. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  28. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  29. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  30. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
  31. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  32. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  33. data/lib/rdoc/generator/template/aliki/class.rhtml +61 -51
  34. data/lib/rdoc/generator/template/aliki/css/rdoc.css +365 -147
  35. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  36. data/lib/rdoc/generator/template/aliki/js/aliki.js +28 -20
  37. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  38. data/lib/rdoc/generator/template/aliki/js/search_controller.js +1 -1
  39. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  40. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  41. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  42. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  43. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  44. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  45. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  46. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  47. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  48. data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
  49. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
  50. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  51. data/lib/rdoc/i18n/text.rb +3 -3
  52. data/lib/rdoc/markdown.kpeg +36 -17
  53. data/lib/rdoc/markdown.rb +324 -125
  54. data/lib/rdoc/markup/document.rb +2 -2
  55. data/lib/rdoc/markup/formatter.rb +128 -115
  56. data/lib/rdoc/markup/heading.rb +3 -6
  57. data/lib/rdoc/markup/indented_paragraph.rb +1 -1
  58. data/lib/rdoc/markup/inline_parser.rb +312 -0
  59. data/lib/rdoc/markup/list.rb +2 -2
  60. data/lib/rdoc/markup/list_item.rb +2 -2
  61. data/lib/rdoc/markup/parser.rb +1 -1
  62. data/lib/rdoc/markup/pre_process.rb +0 -25
  63. data/lib/rdoc/markup/to_ansi.rb +52 -5
  64. data/lib/rdoc/markup/to_bs.rb +23 -43
  65. data/lib/rdoc/markup/to_html.rb +279 -226
  66. data/lib/rdoc/markup/to_html_crossref.rb +122 -136
  67. data/lib/rdoc/markup/to_html_snippet.rb +65 -65
  68. data/lib/rdoc/markup/to_joined_paragraph.rb +0 -5
  69. data/lib/rdoc/markup/to_label.rb +22 -23
  70. data/lib/rdoc/markup/to_markdown.rb +62 -38
  71. data/lib/rdoc/markup/to_rdoc.rb +88 -28
  72. data/lib/rdoc/markup/to_table_of_contents.rb +1 -1
  73. data/lib/rdoc/markup/to_test.rb +9 -1
  74. data/lib/rdoc/markup/to_tt_only.rb +10 -23
  75. data/lib/rdoc/markup/verbatim.rb +1 -1
  76. data/lib/rdoc/markup.rb +8 -30
  77. data/lib/rdoc/options.rb +36 -51
  78. data/lib/rdoc/parser/c.rb +7 -6
  79. data/lib/rdoc/parser/changelog.rb +21 -0
  80. data/lib/rdoc/parser/rbs.rb +275 -0
  81. data/lib/rdoc/parser/ruby.rb +955 -2067
  82. data/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  83. data/lib/rdoc/parser.rb +3 -2
  84. data/lib/rdoc/rbs_helper.rb +186 -0
  85. data/lib/rdoc/rdoc.rb +196 -24
  86. data/lib/rdoc/ri/driver.rb +8 -2
  87. data/lib/rdoc/ri/paths.rb +1 -1
  88. data/lib/rdoc/{servlet.rb → ri/servlet.rb} +5 -5
  89. data/lib/rdoc/ri.rb +4 -3
  90. data/lib/rdoc/rubygems_hook.rb +11 -11
  91. data/lib/rdoc/server.rb +460 -0
  92. data/lib/rdoc/stats.rb +147 -124
  93. data/lib/rdoc/store.rb +212 -4
  94. data/lib/rdoc/task.rb +16 -15
  95. data/lib/rdoc/text.rb +24 -117
  96. data/lib/rdoc/token_stream.rb +11 -33
  97. data/lib/rdoc/version.rb +1 -1
  98. data/lib/rdoc.rb +35 -7
  99. data/lib/rubygems_plugin.rb +2 -11
  100. data/rdoc-logo.svg +43 -0
  101. data/rdoc.gemspec +6 -4
  102. metadata +37 -23
  103. data/lib/rdoc/code_object/anon_class.rb +0 -10
  104. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  105. data/lib/rdoc/code_object/meta_method.rb +0 -6
  106. data/lib/rdoc/markup/attr_changer.rb +0 -22
  107. data/lib/rdoc/markup/attr_span.rb +0 -35
  108. data/lib/rdoc/markup/attribute_manager.rb +0 -432
  109. data/lib/rdoc/markup/attributes.rb +0 -70
  110. data/lib/rdoc/markup/regexp_handling.rb +0 -40
  111. data/lib/rdoc/parser/prism_ruby.rb +0 -1100
  112. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  113. data/lib/rdoc/parser/ruby_tools.rb +0 -163
@@ -28,7 +28,7 @@
28
28
  <%- elsif @title %>
29
29
  <meta name="keywords" content="ruby,documentation,<%= h @title %>">
30
30
  <%- if @options.main_page and
31
- main_page = @files.find { |f| f.full_name == @options.main_page } then %>
31
+ main_page = @files.find { |f| f.full_name == @options.main_page } %>
32
32
  <meta
33
33
  name="description"
34
34
  content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>"
@@ -140,6 +140,11 @@
140
140
  defer
141
141
  ></script>
142
142
 
143
+ <script
144
+ src="<%= h asset_rel_prefix %>/js/bash_highlighter.js?v=<%= h RDoc::VERSION %>"
145
+ defer
146
+ ></script>
147
+
143
148
  <script
144
149
  src="<%= h asset_rel_prefix %>/js/aliki.js?v=<%= h RDoc::VERSION %>"
145
150
  defer
@@ -1,4 +1,4 @@
1
- <%- unless klass.extends.empty? then %>
1
+ <%- unless klass.extends.empty? %>
2
2
  <div id="extends-section" class="nav-section">
3
3
  <details class="nav-section-collapsible" open>
4
4
  <summary class="nav-section-header">
@@ -13,11 +13,13 @@
13
13
 
14
14
  <ul class="nav-list">
15
15
  <%- klass.extends.each do |ext| %>
16
- <%- unless String === ext.module then %>
17
- <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a></li>
18
- <%- else %>
19
- <li><span class="extend"><%= ext.name %></span></li>
20
- <%- end %>
16
+ <li>
17
+ <%- unless String === ext.module %>
18
+ <a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
19
+ <%- else %>
20
+ <span class="extend"><%= ext.name %></span>
21
+ <%- end %>
22
+ </li>
21
23
  <%- end %>
22
24
  </ul>
23
25
  </details>
@@ -1,4 +1,4 @@
1
- <%- unless klass.includes.empty? then %>
1
+ <%- unless klass.includes.empty? %>
2
2
  <div id="includes-section" class="nav-section">
3
3
  <details class="nav-section-collapsible" open>
4
4
  <summary class="nav-section-header">
@@ -13,11 +13,13 @@
13
13
 
14
14
  <ul class="nav-list">
15
15
  <%- klass.includes.each do |inc| %>
16
- <%- unless String === inc.module then %>
17
- <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
18
- <%- else %>
19
- <li><span class="include"><%= inc.name %></span></li>
20
- <%- end %>
16
+ <li>
17
+ <%- unless String === inc.module %>
18
+ <a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
19
+ <%- else %>
20
+ <span class="include"><%= inc.name %></span>
21
+ <%- end %>
22
+ </li>
21
23
  <%- end %>
22
24
  </ul>
23
25
  </details>
@@ -5,7 +5,7 @@
5
5
  <%- installed.each do |name, href, exists, type, _| %>
6
6
  <%- next if type == :extra %>
7
7
  <li class="folder">
8
- <%- if exists then %>
8
+ <%- if exists %>
9
9
  <a href="<%= href %>"><%= h name %></a>
10
10
  <%- else %>
11
11
  <%= h name %>
@@ -1,10 +1,10 @@
1
- <%- simple_files = @files.select { |f| f.text? } %>
1
+ <%- simple_files = @files.select { |f| f.text? && f.full_name != @options.main_page } %>
2
2
 
3
3
  <%- if defined?(current) && current.respond_to?(:page_name) %>
4
4
  <%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name %>
5
5
  <%- end %>
6
6
 
7
- <%- unless simple_files.empty? then %>
7
+ <%- unless simple_files.empty? %>
8
8
  <div id="fileindex-section" class="nav-section">
9
9
  <details class="nav-section-collapsible" <%= 'open' unless @inside_class_file %>>
10
10
  <summary class="nav-section-header">
@@ -1,4 +1,4 @@
1
- <%- unless klass.sections.length == 1 then %>
1
+ <%- unless klass.sections.length == 1 %>
2
2
  <div id="sections-section" class="nav-section">
3
3
  <details class="nav-section-collapsible" open>
4
4
  <summary class="nav-section-header">
@@ -1,3 +1,3 @@
1
- <div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
1
+ <div id="sidebar-navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="false" aria-controls="sidebar-navigation">
2
2
  <span aria-hidden="true">&#9776;</span>
3
3
  </div>
@@ -3,7 +3,7 @@
3
3
  <%= render '_header.rhtml' %>
4
4
  <%= render '_sidebar_toggle.rhtml' %>
5
5
 
6
- <nav id="navigation" role="navigation" hidden>
6
+ <nav id="sidebar-navigation" role="navigation" hidden>
7
7
  <%= render '_sidebar_pages.rhtml' %>
8
8
  <%= render '_sidebar_sections.rhtml' %>
9
9
  <%= render '_sidebar_ancestors.rhtml' %>
@@ -22,7 +22,7 @@
22
22
  <% if namespace[:self] %>
23
23
  <span><%= namespace[:name] %></span>
24
24
  <% else %>
25
- <a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span>::</span>
25
+ <a href="<%= namespace[:path] %>"><%= namespace[:name] %></a><span class="separator">::</span>
26
26
  <% end %>
27
27
  </li>
28
28
  <% end %>
@@ -30,8 +30,9 @@
30
30
  <% end %>
31
31
 
32
32
  <span id="<%= h klass.legacy_aref %>" class="legacy-anchor"></span>
33
- <h1 id="<%= h klass.aref %>" class="anchor-link <%= klass.type %>">
34
- <%= klass.type %> <%= klass.full_name %>
33
+ <h1 id="<%= h klass.aref %>" class="anchor-link <%= klass.type %> page-title">
34
+ <span class="page-title-kind"><%= klass.type %></span>
35
+ <span class="page-title-name"><%= klass.full_name %></span>
35
36
  </h1>
36
37
 
37
38
  <section class="description">
@@ -40,32 +41,32 @@
40
41
 
41
42
  <%- klass.each_section do |section, constants, attributes| %>
42
43
  <span id="<%= section.legacy_aref %>" class="legacy-anchor"></span>
43
- <section id="<%= section.aref %>" class="documentation-section anchor-link">
44
- <%- if section.title then %>
44
+ <section class="documentation-section anchor-link">
45
+ <%- if section.title %>
45
46
  <header class="documentation-section-title">
46
- <h2>
47
+ <h2 id="<%= section.aref %>">
47
48
  <a href="#<%= section.aref %>"><%= section.title %></a>
48
49
  </h2>
49
50
  </header>
50
51
  <%- end %>
51
52
 
52
- <%- if section.comment then %>
53
+ <%- if section.comment %>
53
54
  <div>
54
55
  <%= section.description %>
55
56
  </div>
56
57
  <%- end %>
57
58
 
58
- <%- unless constants.empty? then %>
59
+ <%- unless constants.empty? %>
59
60
  <section class="constants-list">
60
61
  <header>
61
- <h3 id="constants"><a href="#constants">Constants</a></h3>
62
+ <h3 id="<%= section.aref %>-constants"><a href="#<%= section.aref %>-constants">Constants</a></h3>
62
63
  </header>
63
64
  <dl>
64
65
  <%- constants.each do |const| %>
65
66
  <dt id="<%= const.name %>"><%= const.name %></dt>
66
- <%- if const.comment then %>
67
+ <%- if const.comment %>
67
68
  <dd>
68
- <%- if const.mixin_from then %>
69
+ <%- if const.mixin_from %>
69
70
  <div class="mixin-from">
70
71
  Included from <a href="<%= klass.aref_to(const.mixin_from.path) %>"><%= const.mixin_from.full_name %></a>
71
72
  </div>
@@ -80,10 +81,10 @@
80
81
  </section>
81
82
  <%- end %>
82
83
 
83
- <%- unless attributes.empty? then %>
84
+ <%- unless attributes.empty? %>
84
85
  <section class="attribute-method-details method-section">
85
86
  <header>
86
- <h3 id="attributes"><a href="#attributes">Attributes</a></h3>
87
+ <h3 id="<%= section.aref %>-attributes"><a href="#<%= section.aref %>-attributes">Attributes</a></h3>
87
88
  </header>
88
89
 
89
90
  <%- attributes.each do |attrib| %>
@@ -93,15 +94,18 @@
93
94
  <span class="method-name"><%= h attrib.name %></span>
94
95
  <span class="attribute-access-type">[<%= attrib.rw %>]</span>
95
96
  </a>
97
+ <%- if (sig_html = type_signature_html(attrib, klass.path)) %>
98
+ <span class="method-type-signature"><code><%= sig_html %></code></span>
99
+ <%- end %>
96
100
  </div>
97
101
 
98
102
  <div class="method-description">
99
- <%- if attrib.mixin_from then %>
103
+ <%- if attrib.mixin_from %>
100
104
  <div class="mixin-from">
101
105
  <%= attrib.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(attrib.mixin_from.path) %>"><%= attrib.mixin_from.full_name %></a>
102
106
  </div>
103
107
  <%- end %>
104
- <%- if attrib.comment then %>
108
+ <%- if attrib.comment %>
105
109
  <%= attrib.description.strip %>
106
110
  <%- else %>
107
111
  <p class="missing-docs">(Not documented)</p>
@@ -118,76 +122,82 @@
118
122
  <%- next if methods.empty? %>
119
123
  <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section anchor-link">
120
124
  <header>
121
- <h3 id="<%= visibility %>-<%= type %>-methods"><a href="#<%= visibility %>-<%= type %>-methods"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</a></h3>
125
+ <h3 id="<%= visibility %>-<%= type %>-<%= section.aref %>-methods"><a href="#<%= visibility %>-<%= type %>-<%= section.aref %>-methods"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</a></h3>
122
126
  </header>
123
127
 
124
128
  <%- methods.each do |method| %>
125
129
  <div id="<%= method.aref %>" class="method-detail anchor-link <%= method.is_alias_for ? "method-alias" : '' %>">
126
130
  <div class="method-header">
127
- <%- if (call_seq = method.call_seq) then %>
128
- <%- call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
131
+ <div class="method-heading-group">
132
+ <%- if (call_seq = method.call_seq) %>
133
+ <%- call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
134
+ <div class="method-heading">
135
+ <a href="#<%= method.aref %>" title="Link to this method">
136
+ <span class="method-callseq">
137
+ <%= h(call_seq.strip.
138
+ gsub( /^\w+\./m, '')).
139
+ gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
140
+ </span>
141
+ </a>
142
+ </div>
143
+ <%- end %>
144
+ <%- elsif method.has_call_seq? %>
145
+ <div class="method-heading">
146
+ <a href="#<%= method.aref %>" title="Link to this method">
147
+ <span class="method-name"><%= h method.name %></span>
148
+ </a>
149
+ </div>
150
+ <%- else %>
129
151
  <div class="method-heading">
130
152
  <a href="#<%= method.aref %>" title="Link to this method">
131
- <span class="method-callseq">
132
- <%= h(call_seq.strip.
133
- gsub( /^\w+\./m, '')).
134
- gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
135
- </span>
153
+ <span class="method-name"><%= h method.name %></span>
154
+ <span class="method-args"><%= h method.param_seq %></span>
136
155
  </a>
137
156
  </div>
138
157
  <%- end %>
139
- <%- elsif method.has_call_seq? then %>
140
- <div class="method-heading">
141
- <a href="#<%= method.aref %>" title="Link to this method">
142
- <span class="method-name"><%= h method.name %></span>
143
- </a>
144
- </div>
145
- <%- else %>
146
- <div class="method-heading">
147
- <a href="#<%= method.aref %>" title="Link to this method">
148
- <span class="method-name"><%= h method.name %></span>
149
- <span class="method-args"><%= h method.param_seq %></span>
150
- </a>
158
+
159
+ <%- if (sig_html = type_signature_html(method, klass.path)) %>
160
+ <pre class="method-type-signature"><code><%= sig_html %></code></pre>
161
+ <%- end %>
162
+ </div>
163
+
164
+ <%- if method.token_stream %>
165
+ <div class="method-controls">
166
+ <details class="method-source-toggle">
167
+ <summary><span class="method-source-icon" aria-hidden="true">{}</span> Source</summary>
168
+ </details>
151
169
  </div>
152
170
  <%- end %>
153
171
  </div>
154
172
 
155
173
  <%- if method.token_stream %>
156
- <div class="method-controls">
157
- <details class="method-source-toggle">
158
- <summary>Source</summary>
159
- </details>
160
- </div>
161
174
  <div class="method-source-code" id="<%= method.html_name %>-source">
162
175
  <pre class="<%= method.source_language %>"><%= method.markup_code %></pre>
163
176
  </div>
164
177
  <%- end %>
165
178
 
166
- <%- unless method.skip_description? then %>
179
+ <%- unless method.skip_description? %>
167
180
  <div class="method-description">
168
- <%- if method.mixin_from then %>
181
+ <%- if method.mixin_from %>
169
182
  <div class="mixin-from">
170
183
  <%= method.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(method.mixin_from.path) %>"><%= method.mixin_from.full_name %></a>
171
184
  </div>
172
185
  <%- end %>
173
- <%- if method.comment then %>
186
+ <%- if method.comment %>
174
187
  <%= method.description.strip %>
175
188
  <%- else %>
176
189
  <p class="missing-docs">(Not documented)</p>
177
190
  <%- end %>
178
- <%- if method.calls_super then %>
191
+ <%- if method.calls_super %>
179
192
  <div class="method-calls-super">
180
193
  Calls superclass method
181
- <%=
182
- method.superclass_method ?
183
- method.formatter.link(method.superclass_method.full_name, method.superclass_method.full_name) : nil
184
- %>
194
+ <%= method.superclass_method_link %>
185
195
  </div>
186
196
  <%- end %>
187
197
  </div>
188
198
  <%- end %>
189
199
 
190
- <%- unless method.aliases.empty? then %>
200
+ <%- unless method.aliases.empty? %>
191
201
  <div class="aliases">
192
202
  Also aliased as: <%= method.aliases.map do |aka|
193
203
  if aka.parent then # HACK lib/rexml/encodings
@@ -199,7 +209,7 @@
199
209
  </div>
200
210
  <%- end %>
201
211
 
202
- <%- if method.is_alias_for then %>
212
+ <%- if method.is_alias_for %>
203
213
  <div class="aliases">
204
214
  Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
205
215
  </div>