rdoc 6.3.4.1 → 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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +195 -0
  3. data/History.rdoc +65 -63
  4. data/LEGAL.rdoc +7 -1
  5. data/LICENSE.rdoc +6 -0
  6. data/README.md +236 -0
  7. data/RI.md +842 -0
  8. data/TODO.rdoc +8 -7
  9. data/doc/markup_reference/markdown.md +659 -0
  10. data/doc/markup_reference/rdoc.rdoc +1169 -0
  11. data/exe/rdoc +0 -1
  12. data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -18
  13. data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +50 -24
  14. data/lib/rdoc/{attr.rb → code_object/attr.rb} +16 -14
  15. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +225 -58
  16. data/lib/rdoc/{constant.rb → code_object/constant.rb} +44 -10
  17. data/lib/rdoc/code_object/context/section.rb +182 -0
  18. data/lib/rdoc/{context.rb → code_object/context.rb} +78 -106
  19. data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -1
  20. data/lib/rdoc/{include.rb → code_object/include.rb} +0 -1
  21. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +46 -48
  22. data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +6 -4
  23. data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +2 -3
  24. data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
  25. data/lib/rdoc/{require.rb → code_object/require.rb} +1 -2
  26. data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +5 -1
  27. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +60 -63
  28. data/lib/rdoc/code_object.rb +11 -39
  29. data/lib/rdoc/code_objects.rb +1 -2
  30. data/lib/rdoc/comment.rb +202 -99
  31. data/lib/rdoc/cross_reference.rb +75 -62
  32. data/lib/rdoc/encoding.rb +8 -24
  33. data/lib/rdoc/erb_partial.rb +1 -2
  34. data/lib/rdoc/erbio.rb +3 -8
  35. data/lib/rdoc/generator/aliki.rb +200 -0
  36. data/lib/rdoc/generator/darkfish.rb +156 -122
  37. data/lib/rdoc/generator/json_index.rb +8 -24
  38. data/lib/rdoc/generator/markup.rb +70 -34
  39. data/lib/rdoc/generator/pot/message_extractor.rb +7 -7
  40. data/lib/rdoc/generator/pot/po.rb +1 -1
  41. data/lib/rdoc/generator/pot/po_entry.rb +8 -8
  42. data/lib/rdoc/generator/pot.rb +1 -5
  43. data/lib/rdoc/generator/ri.rb +1 -2
  44. data/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  45. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  46. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  47. data/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  48. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  49. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  50. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  51. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  52. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  53. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  54. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  55. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  56. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  57. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  58. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  59. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  60. data/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  61. data/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  62. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  63. data/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  64. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  65. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  66. data/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  67. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  68. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  69. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  70. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  71. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  72. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  73. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  74. data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -14
  75. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
  76. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +11 -9
  77. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +11 -9
  78. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  79. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
  80. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +25 -5
  81. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
  82. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +2 -1
  83. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  84. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +28 -7
  85. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  86. data/lib/rdoc/generator/template/darkfish/class.rhtml +138 -90
  87. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +420 -358
  88. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  89. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  90. data/lib/rdoc/generator/template/darkfish/index.rhtml +14 -12
  91. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +59 -3
  92. data/lib/rdoc/generator/template/darkfish/js/search.js +15 -5
  93. data/lib/rdoc/generator/template/darkfish/page.rhtml +7 -6
  94. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +12 -9
  95. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +24 -21
  96. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +35 -21
  97. data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
  98. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  99. data/lib/rdoc/generator.rb +6 -5
  100. data/lib/rdoc/i18n/text.rb +3 -3
  101. data/lib/rdoc/i18n.rb +1 -1
  102. data/lib/rdoc/known_classes.rb +5 -4
  103. data/lib/rdoc/markdown/entities.rb +0 -1
  104. data/lib/rdoc/markdown/literals.kpeg +0 -2
  105. data/lib/rdoc/markdown/literals.rb +0 -1
  106. data/lib/rdoc/markdown.kpeg +140 -62
  107. data/lib/rdoc/markdown.rb +1015 -873
  108. data/lib/rdoc/markup/blank_line.rb +25 -24
  109. data/lib/rdoc/markup/block_quote.rb +1 -2
  110. data/lib/rdoc/markup/document.rb +10 -11
  111. data/lib/rdoc/markup/element.rb +21 -0
  112. data/lib/rdoc/markup/formatter.rb +134 -115
  113. data/lib/rdoc/markup/hard_break.rb +30 -28
  114. data/lib/rdoc/markup/heading.rb +163 -72
  115. data/lib/rdoc/markup/include.rb +3 -4
  116. data/lib/rdoc/markup/indented_paragraph.rb +4 -5
  117. data/lib/rdoc/markup/inline_parser.rb +312 -0
  118. data/lib/rdoc/markup/list.rb +6 -7
  119. data/lib/rdoc/markup/list_item.rb +6 -7
  120. data/lib/rdoc/markup/paragraph.rb +2 -3
  121. data/lib/rdoc/markup/parser.rb +29 -19
  122. data/lib/rdoc/markup/pre_process.rb +39 -18
  123. data/lib/rdoc/markup/raw.rb +52 -56
  124. data/lib/rdoc/markup/rule.rb +2 -3
  125. data/lib/rdoc/markup/table.rb +49 -32
  126. data/lib/rdoc/markup/to_ansi.rb +58 -8
  127. data/lib/rdoc/markup/to_bs.rb +47 -38
  128. data/lib/rdoc/markup/to_html.rb +343 -105
  129. data/lib/rdoc/markup/to_html_crossref.rb +143 -58
  130. data/lib/rdoc/markup/to_html_snippet.rb +78 -76
  131. data/lib/rdoc/markup/to_joined_paragraph.rb +3 -9
  132. data/lib/rdoc/markup/to_label.rb +34 -25
  133. data/lib/rdoc/markup/to_markdown.rb +74 -51
  134. data/lib/rdoc/markup/to_rdoc.rb +141 -82
  135. data/lib/rdoc/markup/to_table_of_contents.rb +4 -5
  136. data/lib/rdoc/markup/to_test.rb +10 -3
  137. data/lib/rdoc/markup/to_tt_only.rb +17 -31
  138. data/lib/rdoc/markup/verbatim.rb +5 -6
  139. data/lib/rdoc/markup.rb +59 -707
  140. data/lib/rdoc/options.rb +228 -101
  141. data/lib/rdoc/parser/c.rb +186 -184
  142. data/lib/rdoc/parser/changelog.rb +57 -13
  143. data/lib/rdoc/parser/markdown.rb +0 -2
  144. data/lib/rdoc/parser/rbs.rb +275 -0
  145. data/lib/rdoc/parser/rd.rb +0 -1
  146. data/lib/rdoc/parser/ruby.rb +963 -2024
  147. data/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  148. data/lib/rdoc/parser/simple.rb +6 -23
  149. data/lib/rdoc/parser/text.rb +0 -1
  150. data/lib/rdoc/parser.rb +35 -14
  151. data/lib/rdoc/rbs_helper.rb +186 -0
  152. data/lib/rdoc/rd/block_parser.rb +659 -11
  153. data/lib/rdoc/rd/block_parser.ry +13 -9
  154. data/lib/rdoc/rd/inline.rb +4 -5
  155. data/lib/rdoc/rd/inline_parser.rb +646 -2
  156. data/lib/rdoc/rd.rb +4 -5
  157. data/lib/rdoc/rdoc.rb +234 -90
  158. data/lib/rdoc/ri/driver.rb +172 -172
  159. data/lib/rdoc/ri/paths.rb +3 -3
  160. data/lib/rdoc/{servlet.rb → ri/servlet.rb} +28 -27
  161. data/lib/rdoc/ri/store.rb +0 -1
  162. data/lib/rdoc/ri/task.rb +3 -3
  163. data/lib/rdoc/ri.rb +5 -5
  164. data/lib/rdoc/rubygems_hook.rb +106 -25
  165. data/lib/rdoc/server.rb +460 -0
  166. data/lib/rdoc/stats/normal.rb +1 -1
  167. data/lib/rdoc/stats/quiet.rb +1 -2
  168. data/lib/rdoc/stats/verbose.rb +3 -5
  169. data/lib/rdoc/stats.rb +158 -136
  170. data/lib/rdoc/store.rb +267 -48
  171. data/lib/rdoc/task.rb +54 -28
  172. data/lib/rdoc/text.rb +60 -120
  173. data/lib/rdoc/token_stream.rb +30 -45
  174. data/lib/rdoc/tom_doc.rb +9 -15
  175. data/lib/rdoc/version.rb +3 -1
  176. data/lib/rdoc.rb +90 -52
  177. data/lib/rubygems_plugin.rb +14 -0
  178. data/man/ri.1 +2 -0
  179. data/rdoc-logo.svg +43 -0
  180. data/rdoc.gemspec +25 -200
  181. metadata +120 -53
  182. data/CONTRIBUTING.rdoc +0 -220
  183. data/ExampleMarkdown.md +0 -37
  184. data/ExampleRDoc.rdoc +0 -208
  185. data/Gemfile +0 -12
  186. data/README.rdoc +0 -129
  187. data/RI.rdoc +0 -57
  188. data/Rakefile +0 -101
  189. data/bin/console +0 -7
  190. data/bin/setup +0 -6
  191. data/lib/rdoc/anon_class.rb +0 -11
  192. data/lib/rdoc/context/section.rb +0 -232
  193. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  194. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  195. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  196. data/lib/rdoc/generator/template/json_index/.document +0 -1
  197. data/lib/rdoc/ghost_method.rb +0 -7
  198. data/lib/rdoc/markup/attr_changer.rb +0 -23
  199. data/lib/rdoc/markup/attr_span.rb +0 -36
  200. data/lib/rdoc/markup/attribute_manager.rb +0 -409
  201. data/lib/rdoc/markup/attributes.rb +0 -71
  202. data/lib/rdoc/markup/regexp_handling.rb +0 -41
  203. data/lib/rdoc/meta_method.rb +0 -7
  204. data/lib/rdoc/parser/ripper_state_lex.rb +0 -590
  205. data/lib/rdoc/parser/ruby_tools.rb +0 -167
@@ -1,22 +1,24 @@
1
1
  <body id="top" role="document" class="file">
2
- <nav role="navigation">
2
+ <%= render '_sidebar_toggle.rhtml' %>
3
+
4
+ <nav id="navigation" role="navigation">
3
5
  <div id="project-navigation">
4
6
  <%= render '_sidebar_navigation.rhtml' %>
5
-
6
7
  <%= render '_sidebar_search.rhtml' %>
7
8
  </div>
8
9
 
9
- <div id="project-metadata">
10
- <%= render '_sidebar_pages.rhtml' %>
11
- <%= render '_sidebar_classes.rhtml' %>
12
- </div>
10
+ <%= render '_sidebar_table_of_contents.rhtml' if defined?(current) %>
11
+ <%= render '_sidebar_pages.rhtml' %>
12
+ <%= render '_sidebar_classes.rhtml' %>
13
+
14
+ <%= render '_footer.rhtml' %>
13
15
  </nav>
14
16
 
15
17
  <main role="main">
16
- <%- if @options.main_page and
17
- main_page = @files.find { |f| f.full_name == @options.main_page } then %>
18
- <%= main_page.description %>
19
- <%- else -%>
20
- <p>This is the API documentation for <%= @title %>.
21
- <%- end -%>
18
+ <%- if @main_page %>
19
+ <%= @main_page.description %>
20
+ <%- else %>
21
+ <p>This is the API documentation for <%= h @title %>.</p>
22
+ <%- end %>
22
23
  </main>
24
+ </body>
@@ -34,7 +34,7 @@ function showSource( e ) {
34
34
  };
35
35
 
36
36
  function hookSourceViews() {
37
- document.querySelectorAll('.method-heading').forEach(function (codeObject) {
37
+ document.querySelectorAll('.method-source-toggle').forEach(function (codeObject) {
38
38
  codeObject.addEventListener('click', showSource);
39
39
  });
40
40
  };
@@ -54,7 +54,7 @@ function hookSearch() {
54
54
  var html = '';
55
55
 
56
56
  // TODO add relative path to <script> per-page
57
- html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
57
+ html += '<p class="search-match"><a href="' + index_rel_prefix + this.escapeHTML(result.path) + '">' + this.hlt(result.title);
58
58
  if (result.params)
59
59
  html += '<span class="params">' + result.params + '</span>';
60
60
  html += '</a>';
@@ -72,13 +72,69 @@ function hookSearch() {
72
72
  }
73
73
 
74
74
  search.select = function(result) {
75
- window.location.href = result.firstChild.firstChild.href;
75
+ var href = result.firstChild.firstChild.href;
76
+ var query = this.input.value;
77
+ if (query) {
78
+ var url = new URL(href, window.location.origin);
79
+ url.searchParams.set('q', query);
80
+ url.searchParams.set('nav', '0');
81
+ href = url.toString();
82
+ }
83
+ window.location.href = href;
76
84
  }
77
85
 
78
86
  search.scrollIntoView = search.scrollInWindow;
87
+
88
+ // Check for ?q= URL parameter and trigger search automatically
89
+ if (typeof URLSearchParams !== 'undefined') {
90
+ var urlParams = new URLSearchParams(window.location.search);
91
+ var queryParam = urlParams.get('q');
92
+ if (queryParam) {
93
+ var navParam = urlParams.get('nav');
94
+ var autoSelect = navParam !== '0';
95
+ input.value = queryParam;
96
+ search.search(queryParam, autoSelect);
97
+ }
98
+ }
79
99
  };
80
100
 
101
+ function hookFocus() {
102
+ document.addEventListener("keydown", (event) => {
103
+ if (document.activeElement.tagName === 'INPUT') {
104
+ return;
105
+ }
106
+ if (event.key === "/") {
107
+ event.preventDefault();
108
+ document.querySelector('#search-field').focus();
109
+ }
110
+ });
111
+ }
112
+
113
+ function hookSidebar() {
114
+ var navigation = document.querySelector('#navigation');
115
+ var navigationToggle = document.querySelector('#navigation-toggle');
116
+
117
+ navigationToggle.addEventListener('click', function() {
118
+ navigation.hidden = !navigation.hidden;
119
+ navigationToggle.ariaExpanded = navigationToggle.ariaExpanded !== 'true';
120
+ });
121
+
122
+ var isSmallViewport = window.matchMedia("(max-width: 1023px)").matches;
123
+ if (isSmallViewport) {
124
+ navigation.hidden = true;
125
+ navigationToggle.ariaExpanded = false;
126
+ document.addEventListener('click', (e) => {
127
+ if (e.target.closest('#navigation a')) {
128
+ navigation.hidden = true;
129
+ navigationToggle.ariaExpanded = false;
130
+ }
131
+ });
132
+ }
133
+ }
134
+
81
135
  document.addEventListener('DOMContentLoaded', function() {
82
136
  hookSourceViews();
83
137
  hookSearch();
138
+ hookFocus();
139
+ hookSidebar();
84
140
  });
@@ -15,9 +15,9 @@ Search.prototype = Object.assign({}, Navigation, new function() {
15
15
  this.init = function() {
16
16
  var _this = this;
17
17
  var observer = function(e) {
18
- switch(e.keyCode) {
19
- case 38: // Event.KEY_UP
20
- case 40: // Event.KEY_DOWN
18
+ switch(e.key) {
19
+ case 'ArrowUp':
20
+ case 'ArrowDown':
21
21
  return;
22
22
  }
23
23
  _this.search(_this.input.value);
@@ -34,6 +34,8 @@ Search.prototype = Object.assign({}, Navigation, new function() {
34
34
  }
35
35
 
36
36
  this.search = function(value, selectFirstMatch) {
37
+ this.selectFirstMatch = selectFirstMatch;
38
+
37
39
  value = value.trim().toLowerCase();
38
40
  if (value) {
39
41
  this.setNavigationActive(true);
@@ -76,7 +78,15 @@ Search.prototype = Object.assign({}, Navigation, new function() {
76
78
  //TODO: ECMAScript
77
79
  //if (jQuery.browser.msie) this.$element[0].className += '';
78
80
 
79
- if (isLast) this.result.setAttribute('aria-busy', 'false');
81
+ if (this.selectFirstMatch && this.current) {
82
+ this.selectFirstMatch = false;
83
+ this.select(this.current);
84
+ }
85
+
86
+ if (isLast) {
87
+ this.selectFirstMatch = false;
88
+ this.result.setAttribute('aria-busy', 'false');
89
+ }
80
90
  }
81
91
 
82
92
  this.move = function(isDown) {
@@ -101,7 +111,7 @@ Search.prototype = Object.assign({}, Navigation, new function() {
101
111
  }
102
112
 
103
113
  this.escapeHTML = function(html) {
104
- return html.replace(/[&<>]/g, function(c) {
114
+ return html.replace(/[&<>"`']/g, function(c) {
105
115
  return '&#' + c.charCodeAt(0) + ';';
106
116
  });
107
117
  }
@@ -1,18 +1,19 @@
1
1
  <body id="top" role="document" class="file">
2
- <nav role="navigation">
2
+ <%= render '_sidebar_toggle.rhtml' %>
3
+
4
+ <nav id="navigation" role="navigation">
3
5
  <div id="project-navigation">
4
6
  <%= render '_sidebar_navigation.rhtml' %>
5
7
  <%= render '_sidebar_search.rhtml' %>
6
8
  </div>
7
9
 
8
10
  <%= render '_sidebar_table_of_contents.rhtml' %>
11
+ <%= render '_sidebar_pages.rhtml' %>
9
12
 
10
- <div id="project-metadata">
11
- <%= render '_sidebar_pages.rhtml' %>
12
- </div>
13
+ <%= render '_footer.rhtml' %>
13
14
  </nav>
14
15
 
15
- <main role="main" aria-label="Page <%=h file.full_name%>">
16
+ <main role="main" aria-label="Page <%= h file.full_name %>">
16
17
  <%= file.description %>
17
18
  </main>
18
-
19
+ </body>
@@ -1,18 +1,21 @@
1
1
  <body role="document">
2
- <nav role="navigation">
3
- <%= render '_sidebar_navigation.rhtml' %>
2
+ <%= render '_sidebar_toggle.rhtml' %>
4
3
 
5
- <%= render '_sidebar_search.rhtml' %>
6
-
7
- <div id="project-metadata">
8
- <%= render '_sidebar_pages.rhtml' %>
9
- <%= render '_sidebar_classes.rhtml' %>
4
+ <nav id="navigation" role="navigation">
5
+ <div id="project-navigation">
6
+ <%= render '_sidebar_navigation.rhtml' %>
7
+ <%= render '_sidebar_search.rhtml' %>
10
8
  </div>
9
+
10
+ <%= render '_sidebar_pages.rhtml' %>
11
+ <%= render '_sidebar_classes.rhtml' %>
12
+
13
+ <%= render '_footer.rhtml' %>
11
14
  </nav>
12
15
 
13
16
  <main role="main">
14
17
  <h1>Not Found</h1>
15
18
 
16
- <p><%= message %>
19
+ <p><%= message %></p>
17
20
  </main>
18
-
21
+ </body>
@@ -1,5 +1,7 @@
1
1
  <body role="document">
2
- <nav role="navigation">
2
+ <%= render '_sidebar_toggle.rhtml' %>
3
+
4
+ <nav id="navigation" role="navigation">
3
5
  <div id="project-navigation">
4
6
  <div id="home-section" class="nav-section">
5
7
  <h2>
@@ -10,53 +12,54 @@
10
12
  <%= render '_sidebar_search.rhtml' %>
11
13
  </div>
12
14
 
13
- <%= render '_sidebar_installed.rhtml' %>
15
+ <%= render '_sidebar_installed.rhtml' %>
16
+ <%= render '_footer.rhtml' %>
14
17
  </nav>
15
18
 
16
19
  <main role="main">
17
20
  <h1>Local RDoc Documentation</h1>
18
21
 
19
22
  <p>Here you can browse local documentation from the ruby standard library and
20
- your installed gems.
23
+ your installed gems.</p>
21
24
 
22
- <%- extra_dirs = installed.select { |_, _, _, type,| type == :extra } -%>
23
- <%- unless extra_dirs.empty? -%>
25
+ <%- extra_dirs = installed.select { |_, _, _, type,| type == :extra } %>
26
+ <%- unless extra_dirs.empty? %>
24
27
  <h2>Extra Documentation Directories</h2>
25
28
 
26
29
  <p>The following additional documentation directories are available:</p>
27
30
 
28
31
  <ol>
29
- <%- extra_dirs.each do |name, href, exists, _, path| -%>
32
+ <%- extra_dirs.each do |name, href, exists, _, path| %>
30
33
  <li>
31
- <%- if exists -%>
34
+ <%- if exists %>
32
35
  <a href="<%= href %>"><%= h name %></a> (<%= h path %>)
33
- <%- else -%>
36
+ <%- else %>
34
37
  <%= h name %> (<%= h path %>; <i>not available</i>)
35
- <%- end -%>
38
+ <%- end %>
36
39
  </li>
37
- <%- end -%>
40
+ <%- end %>
38
41
  </ol>
39
- <%- end -%>
42
+ <%- end %>
40
43
 
41
- <%- gems = installed.select { |_, _, _, type,| type == :gem } -%>
42
- <%- missing = gems.reject { |_, _, exists,| exists } -%>
43
- <%- unless missing.empty? then -%>
44
+ <%- gems = installed.select { |_, _, _, type,| type == :gem } %>
45
+ <%- missing = gems.reject { |_, _, exists,| exists } %>
46
+ <%- unless missing.empty? %>
44
47
  <h2>Missing Gem Documentation</h2>
45
48
 
46
49
  <p>You are missing documentation for some of your installed gems.
47
50
  You can install missing documentation for gems by running
48
51
  <kbd>gem rdoc --all</kbd>. After installing the missing documentation you
49
52
  only need to reload this page. The newly created documentation will
50
- automatically appear.
53
+ automatically appear.</p>
51
54
 
52
55
  <p>You can also install documentation for a specific gem by running one of
53
- the following commands.
56
+ the following commands.</p>
54
57
 
55
58
  <ul>
56
- <%- names = missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq -%>
57
- <%- names.each do |name| -%>
58
- <li><kbd>gem rdoc <%=h name %></kbd>
59
- <%- end -%>
59
+ <%- missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq.each do |name| %>
60
+ <li><kbd>gem rdoc <%= h name %></kbd></li>
61
+ <%- end %>
60
62
  </ul>
61
- <%- end -%>
63
+ <%- end %>
62
64
  </main>
65
+ </body>
@@ -1,58 +1,72 @@
1
1
  <body id="top" class="table-of-contents">
2
+ <%= render '_sidebar_toggle.rhtml' %>
3
+
4
+ <nav id="navigation" role="navigation">
5
+ <div id="project-navigation">
6
+ <%= render '_sidebar_navigation.rhtml' %>
7
+
8
+ <%= render '_sidebar_search.rhtml' %>
9
+ </div>
10
+
11
+ <%= render '_footer.rhtml' %>
12
+ </nav>
2
13
  <main role="main">
3
14
  <h1 class="class"><%= h @title %></h1>
4
15
 
5
- <%- simple_files = @files.select { |f| f.text? } -%>
6
- <%- unless simple_files.empty? then -%>
16
+ <%- simple_files = @files.select { |f| f.text? } %>
17
+ <%- unless simple_files.empty? %>
7
18
  <h2 id="pages">Pages</h2>
8
19
  <ul>
9
- <%- simple_files.sort.each do |file| -%>
20
+ <%- simple_files.sort.each do |file| %>
10
21
  <li class="file">
11
- <a href="<%= file.path %>"><%= h file.page_name %></a>
22
+ <a href="<%= h file.path %>"><%= h file.page_name %></a>
12
23
  <%
13
24
  # HACK table_of_contents should not exist on Document
14
25
  table = file.parse(file.comment).table_of_contents
15
- unless table.empty? then %>
26
+ unless table.empty? %>
16
27
  <ul>
17
- <%- table.each do |heading| -%>
18
- <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
19
- <%- end -%>
28
+ <%- table.each do |heading| %>
29
+ <li><a href="<%= h file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a></li>
30
+ <%- end %>
20
31
  </ul>
21
- <%- end -%>
32
+ <%- end %>
22
33
  </li>
23
- <%- end -%>
34
+ <%- end %>
24
35
  </ul>
25
- <%- end -%>
36
+ <%- end %>
26
37
 
27
38
  <h2 id="classes">Classes and Modules</h2>
28
39
  <ul>
29
- <%- @modsort.each do |klass| -%>
40
+ <%- @modsort.each do |klass| %>
30
41
  <li class="<%= klass.type %>">
31
42
  <a href="<%= klass.path %>"><%= klass.full_name %></a>
32
43
  <%- table = []
33
44
  table.concat klass.parse(klass.comment_location).table_of_contents
34
45
  table.concat klass.section_contents
35
46
 
36
- unless table.empty? then %>
47
+ unless table.empty? %>
37
48
  <ul>
38
- <%- table.each do |item| -%>
39
- <li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
40
- <%- end -%>
49
+ <%- table.each do |item| %>
50
+ <%- label = item.respond_to?(:label) ? item.label(klass) : item.aref %>
51
+ <li><a href="<%= klass.path %>#<%= label %>"><%= item.plain_html %></a></li>
52
+ <%- end %>
41
53
  </ul>
42
- <%- end -%>
54
+ <%- end %>
43
55
  </li>
44
- <%- end -%>
56
+ <%- end %>
45
57
  </ul>
46
58
 
47
59
  <h2 id="methods">Methods</h2>
48
60
  <ul>
49
- <%- @store.all_classes_and_modules.map do |mod|
61
+ <%- @store.all_classes_and_modules.flat_map do |mod|
50
62
  mod.method_list
51
- end.flatten.sort.each do |method| %>
63
+ end.sort.each do |method| %>
52
64
  <li class="method">
53
65
  <a href="<%= method.path %>"><%= h method.pretty_name %></a>
54
66
  &mdash;
55
67
  <span class="container"><%= method.parent.full_name %></span>
56
- <%- end -%>
68
+ </li>
69
+ <%- end %>
57
70
  </ul>
58
71
  </main>
72
+ </body>
@@ -23,24 +23,24 @@ Navigation = new function() {
23
23
 
24
24
  this.onkeydown = function(e) {
25
25
  if (!this.navigationActive) return;
26
- switch(e.keyCode) {
27
- case 37: //Event.KEY_LEFT:
26
+ switch(e.key) {
27
+ case 'ArrowLeft':
28
28
  if (this.moveLeft()) e.preventDefault();
29
29
  break;
30
- case 38: //Event.KEY_UP:
31
- if (e.keyCode == 38 || e.ctrlKey) {
30
+ case 'ArrowUp':
31
+ if (e.key == 'ArrowUp' || e.ctrlKey) {
32
32
  if (this.moveUp()) e.preventDefault();
33
33
  }
34
34
  break;
35
- case 39: //Event.KEY_RIGHT:
35
+ case 'ArrowRight':
36
36
  if (this.moveRight()) e.preventDefault();
37
37
  break;
38
- case 40: //Event.KEY_DOWN:
39
- if (e.keyCode == 40 || e.ctrlKey) {
38
+ case 'ArrowDown':
39
+ if (e.key == 'ArrowDown' || e.ctrlKey) {
40
40
  if (this.moveDown()) e.preventDefault();
41
41
  }
42
42
  break;
43
- case 13: //Event.KEY_RETURN:
43
+ case 'Enter':
44
44
  if (this.current) e.preventDefault();
45
45
  this.select(this.current);
46
46
  break;
@@ -29,7 +29,7 @@ Searcher.prototype = new function() {
29
29
 
30
30
  var results =
31
31
  performSearch(_this.data, regexps, queries, highlighters, state);
32
- var hasMore = (state.limit > 0 && state.pass < 4);
32
+ var hasMore = (state.limit > 0 && state.pass < 6);
33
33
 
34
34
  triggerResults.call(_this, results, !hasMore);
35
35
  if (hasMore) {
@@ -57,8 +57,17 @@ Searcher.prototype = new function() {
57
57
  }
58
58
 
59
59
  function buildRegexps(queries) {
60
+ // A small minority of older browsers don't have RegExp.escape
61
+ // but it's not worth including a complex polyfill.
62
+ var escape = RegExp.escape || function(s) { return s };
63
+
60
64
  return queries.map(function(query) {
61
- return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
65
+ var pattern = [];
66
+ for (var i = 0; i < query.length; i++) {
67
+ var char = escape(query[i]);
68
+ pattern.push('([' + char + '])([^' + char + ']*?)');
69
+ }
70
+ return new RegExp(pattern.join(''), 'i');
62
71
  });
63
72
  }
64
73
 
@@ -80,6 +89,30 @@ Searcher.prototype = new function() {
80
89
 
81
90
  /* ----- Mathchers ------ */
82
91
 
92
+ /*
93
+ * This record matches if both the index and longIndex exactly equal queries[0]
94
+ * and the record matches all of the regexps. This ensures top-level exact matches
95
+ * like "String" are prioritized over nested classes like "Gem::Module::String".
96
+ */
97
+ function matchPassExact(index, longIndex, queries) {
98
+ return index == queries[0] && longIndex == queries[0];
99
+ }
100
+
101
+ /*
102
+ * This record matches if the index without "()" exactly equals queries[0].
103
+ * This prioritizes methods like "attribute()" when searching for "attribute".
104
+ */
105
+ function matchPassExactMethod(index, longIndex, queries, regexps) {
106
+ var indexWithoutParens = index.replace(/\(\)$/, '');
107
+ if (indexWithoutParens != queries[0]) return false;
108
+ if (index === indexWithoutParens) return false; // Not a method (no parens to remove)
109
+ for (var i=1, l = regexps.length; i < l; i++) {
110
+ if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
111
+ return false;
112
+ };
113
+ return true;
114
+ }
115
+
83
116
  /*
84
117
  * This record matches if the index starts with queries[0] and the record
85
118
  * matches all of the regexps
@@ -187,17 +220,26 @@ Searcher.prototype = new function() {
187
220
  var togo = CHUNK_SIZE;
188
221
  var matchFunc, hltFunc;
189
222
 
190
- while (state.pass < 4 && state.limit > 0 && togo > 0) {
223
+ var isLowercaseQuery = queries[0] === queries[0].toLowerCase();
224
+
225
+ while (state.pass < 6 && state.limit > 0 && togo > 0) {
226
+ // When query is lowercase, prioritize methods over classes
191
227
  if (state.pass == 0) {
192
- matchFunc = matchPassBeginning;
228
+ matchFunc = isLowercaseQuery ? matchPassExactMethod : matchPassExact;
193
229
  hltFunc = highlightQuery;
194
230
  } else if (state.pass == 1) {
195
- matchFunc = matchPassLongIndex;
231
+ matchFunc = isLowercaseQuery ? matchPassExact : matchPassExactMethod;
196
232
  hltFunc = highlightQuery;
197
233
  } else if (state.pass == 2) {
198
- matchFunc = matchPassContains;
234
+ matchFunc = matchPassBeginning;
199
235
  hltFunc = highlightQuery;
200
236
  } else if (state.pass == 3) {
237
+ matchFunc = matchPassLongIndex;
238
+ hltFunc = highlightQuery;
239
+ } else if (state.pass == 4) {
240
+ matchFunc = matchPassContains;
241
+ hltFunc = highlightQuery;
242
+ } else if (state.pass == 5) {
201
243
  matchFunc = matchPassRegexp;
202
244
  hltFunc = highlightRegexp;
203
245
  }
@@ -41,11 +41,12 @@
41
41
 
42
42
  module RDoc::Generator
43
43
 
44
- autoload :Markup, 'rdoc/generator/markup'
44
+ autoload :Markup, "#{__dir__}/generator/markup"
45
45
 
46
- autoload :Darkfish, 'rdoc/generator/darkfish'
47
- autoload :JsonIndex, 'rdoc/generator/json_index'
48
- autoload :RI, 'rdoc/generator/ri'
49
- autoload :POT, 'rdoc/generator/pot'
46
+ autoload :Aliki, "#{__dir__}/generator/aliki"
47
+ autoload :Darkfish, "#{__dir__}/generator/darkfish"
48
+ autoload :JsonIndex, "#{__dir__}/generator/json_index"
49
+ autoload :RI, "#{__dir__}/generator/ri"
50
+ autoload :POT, "#{__dir__}/generator/pot"
50
51
 
51
52
  end
@@ -89,9 +89,9 @@ class RDoc::I18n::Text
89
89
  case raw
90
90
  when RDoc::Comment
91
91
  raw.text.each_line(&block)
92
- when Array
93
- raw.each do |comment, location|
94
- each_line(comment, &block)
92
+ when Hash
93
+ raw.each_value do |comments|
94
+ comments.each { |comment| each_line(comment, &block) }
95
95
  end
96
96
  else
97
97
  raw.each_line(&block)
data/lib/rdoc/i18n.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  module RDoc::I18n
6
6
 
7
- autoload :Locale, 'rdoc/i18n/locale'
7
+ autoload :Locale, "#{__dir__}/i18n/locale"
8
8
  require_relative 'i18n/text'
9
9
 
10
10
  end
@@ -25,6 +25,7 @@ module RDoc
25
25
  "rb_cObject" => "Object",
26
26
  "rb_cProc" => "Proc",
27
27
  "rb_cRange" => "Range",
28
+ "rb_cRefinement" => "Refinement",
28
29
  "rb_cRegexp" => "Regexp",
29
30
  "rb_cRubyVM" => "RubyVM",
30
31
  "rb_cSocket" => "Socket",
@@ -35,7 +36,7 @@ module RDoc
35
36
  "rb_cTime" => "Time",
36
37
  "rb_cTrueClass" => "TrueClass",
37
38
 
38
- "rb_eArgError" => "ArgError",
39
+ "rb_eArgError" => "ArgumentError",
39
40
  "rb_eEOFError" => "EOFError",
40
41
  "rb_eException" => "Exception",
41
42
  "rb_eFatal" => "fatal",
@@ -45,8 +46,8 @@ module RDoc
45
46
  "rb_eInterrupt" => "Interrupt",
46
47
  "rb_eLoadError" => "LoadError",
47
48
  "rb_eNameError" => "NameError",
48
- "rb_eNoMemError" => "NoMemError",
49
- "rb_eNotImpError" => "NotImpError",
49
+ "rb_eNoMemError" => "NoMemoryError",
50
+ "rb_eNotImpError" => "NotImplementedError",
50
51
  "rb_eRangeError" => "RangeError",
51
52
  "rb_eRuntimeError" => "RuntimeError",
52
53
  "rb_eScriptError" => "ScriptError",
@@ -57,7 +58,7 @@ module RDoc
57
58
  "rb_eSystemCallError" => "SystemCallError",
58
59
  "rb_eSystemExit" => "SystemExit",
59
60
  "rb_eTypeError" => "TypeError",
60
- "rb_eZeroDivError" => "ZeroDivError",
61
+ "rb_eZeroDivError" => "ZeroDivisionError",
61
62
 
62
63
  "rb_mComparable" => "Comparable",
63
64
  "rb_mEnumerable" => "Enumerable",
@@ -2129,4 +2129,3 @@ RDoc::Markdown::HTML_ENTITIES = {
2129
2129
  "zwj" => [0x0200D],
2130
2130
  "zwnj" => [0x0200C],
2131
2131
  }
2132
-
@@ -6,7 +6,6 @@
6
6
  # :markup: markdown
7
7
 
8
8
  ##
9
- #--
10
9
  # This set of literals is for Ruby 1.9 regular expressions and gives full
11
10
  # unicode support.
12
11
  #
@@ -20,4 +19,3 @@ BOM = "\uFEFF"
20
19
  Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/
21
20
  NonAlphanumeric = /\p{^Word}/
22
21
  Spacechar = /\t|\p{Zs}/
23
-
@@ -3,7 +3,6 @@
3
3
  # :markup: markdown
4
4
 
5
5
  ##
6
- #--
7
6
  # This set of literals is for Ruby 1.9 regular expressions and gives full
8
7
  # unicode support.
9
8
  #