rdoc 3.1 → 6.3.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (247) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.rdoc +220 -0
  3. data/CVE-2013-0256.rdoc +49 -0
  4. data/ExampleMarkdown.md +37 -0
  5. data/ExampleRDoc.rdoc +208 -0
  6. data/Gemfile +12 -0
  7. data/History.rdoc +1666 -0
  8. data/LEGAL.rdoc +50 -0
  9. data/LICENSE.rdoc +57 -0
  10. data/README.rdoc +129 -0
  11. data/RI.rdoc +57 -0
  12. data/Rakefile +84 -81
  13. data/TODO.rdoc +59 -0
  14. data/bin/console +7 -0
  15. data/bin/setup +6 -0
  16. data/{bin → exe}/rdoc +11 -2
  17. data/exe/ri +12 -0
  18. data/lib/rdoc/alias.rb +1 -2
  19. data/lib/rdoc/anon_class.rb +3 -2
  20. data/lib/rdoc/any_method.rb +234 -40
  21. data/lib/rdoc/attr.rb +79 -11
  22. data/lib/rdoc/class_module.rb +443 -71
  23. data/lib/rdoc/code_object.rb +216 -20
  24. data/lib/rdoc/code_objects.rb +4 -21
  25. data/lib/rdoc/comment.rb +250 -0
  26. data/lib/rdoc/constant.rb +110 -9
  27. data/lib/rdoc/context/section.rb +232 -0
  28. data/lib/rdoc/context.rb +392 -172
  29. data/lib/rdoc/cross_reference.rb +202 -0
  30. data/lib/rdoc/encoding.rb +83 -28
  31. data/lib/rdoc/erb_partial.rb +19 -0
  32. data/lib/rdoc/erbio.rb +8 -3
  33. data/lib/rdoc/extend.rb +10 -0
  34. data/lib/rdoc/generator/darkfish.rb +507 -84
  35. data/lib/rdoc/generator/json_index.rb +300 -0
  36. data/lib/rdoc/generator/markup.rb +27 -74
  37. data/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  38. data/lib/rdoc/generator/pot/po.rb +84 -0
  39. data/lib/rdoc/generator/pot/po_entry.rb +141 -0
  40. data/lib/rdoc/generator/pot.rb +98 -0
  41. data/lib/rdoc/generator/ri.rb +8 -62
  42. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  43. data/lib/rdoc/generator/template/darkfish/_head.rhtml +22 -0
  44. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +19 -0
  45. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +9 -0
  46. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +15 -0
  47. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +9 -0
  48. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +15 -0
  49. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +15 -0
  50. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +12 -0
  51. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  52. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +12 -0
  53. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +11 -0
  54. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +14 -0
  55. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  56. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +18 -0
  57. data/lib/rdoc/generator/template/darkfish/class.rhtml +172 -0
  58. data/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  59. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +639 -0
  60. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  61. data/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  62. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  63. data/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  64. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  65. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  66. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  67. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  68. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  69. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  70. data/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  71. data/lib/rdoc/generator/template/darkfish/index.rhtml +18 -60
  72. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +51 -83
  73. data/lib/rdoc/generator/template/darkfish/js/search.js +110 -0
  74. data/lib/rdoc/generator/template/darkfish/page.rhtml +18 -0
  75. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
  76. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +62 -0
  77. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +58 -0
  78. data/lib/rdoc/generator/template/json_index/.document +1 -0
  79. data/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  80. data/lib/rdoc/generator/template/json_index/js/searcher.js +229 -0
  81. data/lib/rdoc/generator.rb +24 -13
  82. data/lib/rdoc/ghost_method.rb +1 -2
  83. data/lib/rdoc/i18n/locale.rb +102 -0
  84. data/lib/rdoc/i18n/text.rb +126 -0
  85. data/lib/rdoc/i18n.rb +10 -0
  86. data/lib/rdoc/include.rb +5 -95
  87. data/lib/rdoc/known_classes.rb +5 -2
  88. data/lib/rdoc/markdown/entities.rb +2132 -0
  89. data/lib/rdoc/markdown/literals.kpeg +23 -0
  90. data/lib/rdoc/markdown/literals.rb +416 -0
  91. data/lib/rdoc/markdown.kpeg +1237 -0
  92. data/lib/rdoc/markdown.rb +16684 -0
  93. data/lib/rdoc/markup/attr_changer.rb +23 -0
  94. data/lib/rdoc/markup/attr_span.rb +36 -0
  95. data/lib/rdoc/markup/attribute_manager.rb +135 -62
  96. data/lib/rdoc/markup/attributes.rb +71 -0
  97. data/lib/rdoc/markup/blank_line.rb +1 -0
  98. data/lib/rdoc/markup/block_quote.rb +15 -0
  99. data/lib/rdoc/markup/document.rb +96 -9
  100. data/lib/rdoc/markup/formatter.rb +138 -25
  101. data/lib/rdoc/markup/hard_break.rb +32 -0
  102. data/lib/rdoc/markup/heading.rb +61 -2
  103. data/lib/rdoc/markup/include.rb +43 -0
  104. data/lib/rdoc/markup/indented_paragraph.rb +48 -0
  105. data/lib/rdoc/markup/list.rb +25 -4
  106. data/lib/rdoc/markup/list_item.rb +18 -4
  107. data/lib/rdoc/markup/paragraph.rb +15 -0
  108. data/lib/rdoc/markup/parser.rb +180 -88
  109. data/lib/rdoc/markup/pre_process.rb +183 -38
  110. data/lib/rdoc/markup/raw.rb +6 -5
  111. data/lib/rdoc/markup/regexp_handling.rb +41 -0
  112. data/lib/rdoc/markup/rule.rb +1 -0
  113. data/lib/rdoc/markup/table.rb +47 -0
  114. data/lib/rdoc/markup/to_ansi.rb +17 -7
  115. data/lib/rdoc/markup/to_bs.rb +5 -8
  116. data/lib/rdoc/markup/to_html.rb +238 -137
  117. data/lib/rdoc/markup/to_html_crossref.rb +125 -152
  118. data/lib/rdoc/markup/to_html_snippet.rb +285 -0
  119. data/lib/rdoc/markup/to_joined_paragraph.rb +47 -0
  120. data/lib/rdoc/markup/to_label.rb +75 -0
  121. data/lib/rdoc/markup/to_markdown.rb +192 -0
  122. data/lib/rdoc/markup/to_rdoc.rb +85 -15
  123. data/lib/rdoc/markup/to_table_of_contents.rb +89 -0
  124. data/lib/rdoc/markup/to_test.rb +2 -4
  125. data/lib/rdoc/markup/to_tt_only.rb +121 -0
  126. data/lib/rdoc/markup/verbatim.rb +39 -0
  127. data/lib/rdoc/markup.rb +388 -110
  128. data/lib/rdoc/meta_method.rb +1 -2
  129. data/lib/rdoc/method_attr.rb +87 -21
  130. data/lib/rdoc/mixin.rb +121 -0
  131. data/lib/rdoc/normal_class.rb +39 -10
  132. data/lib/rdoc/normal_module.rb +22 -7
  133. data/lib/rdoc/options.rb +613 -73
  134. data/lib/rdoc/parser/c.rb +621 -287
  135. data/lib/rdoc/parser/changelog.rb +335 -0
  136. data/lib/rdoc/parser/markdown.rb +24 -0
  137. data/lib/rdoc/parser/rd.rb +23 -0
  138. data/lib/rdoc/parser/ripper_state_lex.rb +590 -0
  139. data/lib/rdoc/parser/ruby.rb +1368 -762
  140. data/lib/rdoc/parser/ruby_tools.rb +42 -35
  141. data/lib/rdoc/parser/simple.rb +23 -11
  142. data/lib/rdoc/parser/text.rb +12 -0
  143. data/lib/rdoc/parser.rb +162 -89
  144. data/lib/rdoc/rd/block_parser.rb +1056 -0
  145. data/lib/rdoc/rd/block_parser.ry +639 -0
  146. data/lib/rdoc/rd/inline.rb +72 -0
  147. data/lib/rdoc/rd/inline_parser.rb +1208 -0
  148. data/lib/rdoc/rd/inline_parser.ry +593 -0
  149. data/lib/rdoc/rd.rb +100 -0
  150. data/lib/rdoc/rdoc.rb +208 -115
  151. data/lib/rdoc/require.rb +1 -2
  152. data/lib/rdoc/ri/driver.rb +734 -239
  153. data/lib/rdoc/ri/formatter.rb +1 -0
  154. data/lib/rdoc/ri/paths.rb +91 -48
  155. data/lib/rdoc/ri/store.rb +3 -261
  156. data/lib/rdoc/ri/task.rb +71 -0
  157. data/lib/rdoc/ri.rb +5 -2
  158. data/lib/rdoc/rubygems_hook.rb +246 -0
  159. data/lib/rdoc/servlet.rb +451 -0
  160. data/lib/rdoc/single_class.rb +14 -2
  161. data/lib/rdoc/stats/normal.rb +19 -12
  162. data/lib/rdoc/stats/quiet.rb +1 -0
  163. data/lib/rdoc/stats/verbose.rb +1 -0
  164. data/lib/rdoc/stats.rb +262 -104
  165. data/lib/rdoc/store.rb +979 -0
  166. data/lib/rdoc/task.rb +84 -44
  167. data/lib/rdoc/text.rb +117 -72
  168. data/lib/rdoc/token_stream.rb +73 -4
  169. data/lib/rdoc/tom_doc.rb +263 -0
  170. data/lib/rdoc/top_level.rb +111 -261
  171. data/lib/rdoc/version.rb +8 -0
  172. data/lib/rdoc.rb +127 -64
  173. data/man/ri.1 +247 -0
  174. data/rdoc.gemspec +249 -0
  175. metadata +171 -291
  176. data/.autotest +0 -16
  177. data/.document +0 -5
  178. data/History.txt +0 -594
  179. data/LICENSE.txt +0 -57
  180. data/Manifest.txt +0 -158
  181. data/README.txt +0 -45
  182. data/RI.txt +0 -58
  183. data/bin/ri +0 -5
  184. data/lib/rdoc/gauntlet.rb +0 -52
  185. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -296
  186. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -124
  187. data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -32
  188. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  189. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
  190. data/lib/rdoc/generator/template/darkfish/rdoc.css +0 -706
  191. data/lib/rdoc/markup/formatter_test_case.rb +0 -689
  192. data/lib/rdoc/markup/inline.rb +0 -137
  193. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -116
  194. data/lib/rdoc/ruby_lex.rb +0 -1291
  195. data/lib/rdoc/ruby_token.rb +0 -416
  196. data/test/README +0 -1
  197. data/test/binary.dat +0 -0
  198. data/test/hidden.zip.txt +0 -1
  199. data/test/test.ja.rdoc +0 -10
  200. data/test/test.ja.txt +0 -8
  201. data/test/test.txt +0 -1
  202. data/test/test_attribute_manager.rb +0 -120
  203. data/test/test_rdoc_alias.rb +0 -13
  204. data/test/test_rdoc_any_method.rb +0 -126
  205. data/test/test_rdoc_attr.rb +0 -61
  206. data/test/test_rdoc_class_module.rb +0 -233
  207. data/test/test_rdoc_code_object.rb +0 -165
  208. data/test/test_rdoc_constant.rb +0 -15
  209. data/test/test_rdoc_context.rb +0 -370
  210. data/test/test_rdoc_encoding.rb +0 -166
  211. data/test/test_rdoc_generator_darkfish.rb +0 -119
  212. data/test/test_rdoc_generator_ri.rb +0 -76
  213. data/test/test_rdoc_include.rb +0 -96
  214. data/test/test_rdoc_markup.rb +0 -37
  215. data/test/test_rdoc_markup_attribute_manager.rb +0 -240
  216. data/test/test_rdoc_markup_document.rb +0 -51
  217. data/test/test_rdoc_markup_paragraph.rb +0 -9
  218. data/test/test_rdoc_markup_parser.rb +0 -1395
  219. data/test/test_rdoc_markup_pre_process.rb +0 -185
  220. data/test/test_rdoc_markup_raw.rb +0 -27
  221. data/test/test_rdoc_markup_to_ansi.rb +0 -328
  222. data/test/test_rdoc_markup_to_bs.rb +0 -341
  223. data/test/test_rdoc_markup_to_html.rb +0 -335
  224. data/test/test_rdoc_markup_to_html_crossref.rb +0 -169
  225. data/test/test_rdoc_markup_to_rdoc.rb +0 -327
  226. data/test/test_rdoc_method_attr.rb +0 -122
  227. data/test/test_rdoc_normal_class.rb +0 -17
  228. data/test/test_rdoc_normal_module.rb +0 -31
  229. data/test/test_rdoc_options.rb +0 -342
  230. data/test/test_rdoc_parser.rb +0 -83
  231. data/test/test_rdoc_parser_c.rb +0 -912
  232. data/test/test_rdoc_parser_ruby.rb +0 -1754
  233. data/test/test_rdoc_parser_simple.rb +0 -99
  234. data/test/test_rdoc_rdoc.rb +0 -164
  235. data/test/test_rdoc_require.rb +0 -25
  236. data/test/test_rdoc_ri_driver.rb +0 -846
  237. data/test/test_rdoc_ri_paths.rb +0 -43
  238. data/test/test_rdoc_ri_store.rb +0 -352
  239. data/test/test_rdoc_ruby_lex.rb +0 -23
  240. data/test/test_rdoc_stats.rb +0 -38
  241. data/test/test_rdoc_task.rb +0 -92
  242. data/test/test_rdoc_text.rb +0 -251
  243. data/test/test_rdoc_top_level.rb +0 -120
  244. data/test/xref_data.rb +0 -62
  245. data/test/xref_test_case.rb +0 -61
  246. data.tar.gz.sig +0 -3
  247. metadata.gz.sig +0 -0
@@ -1,64 +1,22 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1
+ <body id="top" role="document" class="file">
2
+ <nav role="navigation">
3
+ <div id="project-navigation">
4
+ <%= render '_sidebar_navigation.rhtml' %>
4
5
 
5
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
- <head>
7
- <meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type" />
8
-
9
- <title><%= h @options.title %></title>
10
-
11
- <link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
12
-
13
- <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
14
- <script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
15
- <script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
16
- <script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
17
-
18
- </head>
19
- <body class="indexpage">
20
-
21
- <% $stderr.sync = true %>
22
- <h1><%= h @options.title %></h1>
23
-
24
- <% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %>
25
- <div id="main">
26
- <%= main_page.description.sub(%r{^\s*<h1.*?/h1>}i, '') %>
6
+ <%= render '_sidebar_search.rhtml' %>
27
7
  </div>
28
- <% else %>
29
- <p>This is the API documentation for '<%= @options.title %>'.</p>
30
- <% end %>
31
-
32
- <% simple_files = @files.select {|tl| tl.parser == RDoc::Parser::Simple } %>
33
- <% unless simple_files.empty? then %>
34
- <h2>Files</h2>
35
- <ul>
36
- <% simple_files.sort.each do |file| %>
37
- <li class="file"><a href="<%= file.path %>"><%= h file.base_name %></a></li>
38
- <% end %>
39
- </ul>
40
- <% end %>
41
-
42
- <h2 id="classes">Classes/Modules</h2>
43
- <ul>
44
- <% @modsort.each do |klass| %>
45
- <li class="<%= klass.type %>"><a href="<%= klass.path %>"><%= klass.full_name %></a></li>
46
- <% end %>
47
- </ul>
48
-
49
- <h2 id="methods">Methods</h2>
50
- <ul>
51
- <% RDoc::TopLevel.all_classes_and_modules.map do |mod|
52
- mod.method_list
53
- end.flatten.sort.each do |method| %>
54
- <li><a href="<%= method.path %>"><%= method.pretty_name %> &mdash; <%= method.parent.full_name %></a></li>
55
- <% end %>
56
- </ul>
57
8
 
58
- <div id="validator-badges">
59
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
60
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
61
- Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %></small>.</p>
9
+ <div id="project-metadata">
10
+ <%= render '_sidebar_pages.rhtml' %>
11
+ <%= render '_sidebar_classes.rhtml' %>
62
12
  </div>
63
- </body>
64
- </html>
13
+ </nav>
14
+
15
+ <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 -%>
22
+ </main>
@@ -8,109 +8,77 @@
8
8
  */
9
9
 
10
10
  /* Provide console simulation for firebug-less environments */
11
+ /*
11
12
  if (!("console" in window) || !("firebug" in console)) {
12
- var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
14
  "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
15
 
15
- window.console = {};
16
- for (var i = 0; i < names.length; ++i)
17
- window.console[names[i]] = function() {};
18
- };
19
-
20
-
21
- /**
22
- * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
- */
24
- $.fn.unwrap = function( expr ) {
25
- return this.each( function() {
26
- $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
- });
16
+ window.console = {};
17
+ for (var i = 0; i < names.length; ++i)
18
+ window.console[names[i]] = function() {};
28
19
  };
20
+ */
29
21
 
30
22
 
31
23
  function showSource( e ) {
32
- var target = e.target;
33
- var codeSections = $(target).
34
- parents('.method-detail').
35
- find('.method-source-code');
36
-
37
- $(target).
38
- parents('.method-detail').
39
- find('.method-source-code').
40
- slideToggle();
24
+ var target = e.target;
25
+ while (!target.classList.contains('method-detail')) {
26
+ target = target.parentNode;
27
+ }
28
+ if (typeof target !== "undefined" && target !== null) {
29
+ target = target.querySelector('.method-source-code');
30
+ }
31
+ if (typeof target !== "undefined" && target !== null) {
32
+ target.classList.toggle('active-menu')
33
+ }
41
34
  };
42
35
 
43
36
  function hookSourceViews() {
44
- $('.method-description,.method-heading').click( showSource );
37
+ document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
+ codeObject.addEventListener('click', showSource);
39
+ });
45
40
  };
46
41
 
47
- function toggleDebuggingSection() {
48
- $('.debugging-section').slideToggle();
49
- };
42
+ function hookSearch() {
43
+ var input = document.querySelector('#search-field');
44
+ var result = document.querySelector('#search-results');
45
+ result.classList.remove("initially-hidden");
50
46
 
51
- function hookDebuggingToggle() {
52
- $('#debugging-toggle img').click( toggleDebuggingSection );
53
- };
47
+ var search_section = document.querySelector('#search-section');
48
+ search_section.classList.remove("initially-hidden");
54
49
 
55
- function hookQuickSearch() {
56
- $('.quicksearch-field').each( function() {
57
- var searchElems = $(this).parents('.section').find( 'li' );
58
- var toggle = $(this).parents('.section').find('h3 .search-toggle');
59
- // console.debug( "Toggle is: %o", toggle );
60
- var qsbox = $(this).parents('form').get( 0 );
61
-
62
- $(this).quicksearch( this, searchElems, {
63
- noSearchResultsIndicator: 'no-class-search-results',
64
- focusOnLoad: false
65
- });
66
- $(toggle).click( function() {
67
- // console.debug( "Toggling qsbox: %o", qsbox );
68
- $(qsbox).toggle();
69
- });
70
- });
71
- };
50
+ var search = new Search(search_data, input, result);
72
51
 
73
- function highlightTarget( anchor ) {
74
- console.debug( "Highlighting target '%s'.", anchor );
75
-
76
- $("a[name=" + anchor + "]").each( function() {
77
- if ( !$(this).parent().parent().hasClass('target-section') ) {
78
- console.debug( "Wrapping the target-section" );
79
- $('div.method-detail').unwrap( 'div.target-section' );
80
- $(this).parent().wrap( '<div class="target-section"></div>' );
81
- } else {
82
- console.debug( "Already wrapped." );
83
- }
84
- });
85
- };
52
+ search.renderItem = function(result) {
53
+ var li = document.createElement('li');
54
+ var html = '';
86
55
 
87
- function highlightLocationTarget() {
88
- console.debug( "Location hash: %s", window.location.hash );
89
- if ( ! window.location.hash || window.location.hash.length == 0 ) return;
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);
58
+ if (result.params)
59
+ html += '<span class="params">' + result.params + '</span>';
60
+ html += '</a>';
90
61
 
91
- var anchor = window.location.hash.substring(1);
92
- console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
93
62
 
94
- highlightTarget( anchor );
95
- };
63
+ if (result.namespace)
64
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
96
65
 
97
- function highlightClickTarget( event ) {
98
- console.debug( "Highlighting click target for event %o", event.target );
99
- try {
100
- var anchor = $(event.target).attr( 'href' ).substring(1);
101
- console.debug( "Found target anchor: %s", anchor );
102
- highlightTarget( anchor );
103
- } catch ( err ) {
104
- console.error( "Exception while highlighting: %o", err );
105
- };
106
- };
66
+ if (result.snippet)
67
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
68
+
69
+ li.innerHTML = html;
107
70
 
71
+ return li;
72
+ }
108
73
 
109
- $(document).ready( function() {
110
- hookSourceViews();
111
- hookDebuggingToggle();
112
- hookQuickSearch();
113
- highlightLocationTarget();
74
+ search.select = function(result) {
75
+ window.location.href = result.firstChild.firstChild.href;
76
+ }
77
+
78
+ search.scrollIntoView = search.scrollInWindow;
79
+ };
114
80
 
115
- $('ul.link-list a').bind( "click", highlightClickTarget );
81
+ document.addEventListener('DOMContentLoaded', function() {
82
+ hookSourceViews();
83
+ hookSearch();
116
84
  });
@@ -0,0 +1,110 @@
1
+ Search = function(data, input, result) {
2
+ this.data = data;
3
+ this.input = input;
4
+ this.result = result;
5
+
6
+ this.current = null;
7
+ this.view = this.result.parentNode;
8
+ this.searcher = new Searcher(data.index);
9
+ this.init();
10
+ }
11
+
12
+ Search.prototype = Object.assign({}, Navigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.keyCode) {
19
+ case 38: // Event.KEY_UP
20
+ case 40: // Event.KEY_DOWN
21
+ return;
22
+ }
23
+ _this.search(_this.input.value);
24
+ };
25
+ this.input.addEventListener('keyup', observer);
26
+ this.input.addEventListener('click', observer); // mac's clear field
27
+
28
+ this.searcher.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ value = value.trim().toLowerCase();
38
+ if (value) {
39
+ this.setNavigationActive(true);
40
+ } else {
41
+ this.setNavigationActive(false);
42
+ }
43
+
44
+ if (value == '') {
45
+ this.lastQuery = value;
46
+ this.result.innerHTML = '';
47
+ this.result.setAttribute('aria-expanded', 'false');
48
+ this.setNavigationActive(false);
49
+ } else if (value != this.lastQuery) {
50
+ this.lastQuery = value;
51
+ this.result.setAttribute('aria-busy', 'true');
52
+ this.result.setAttribute('aria-expanded', 'true');
53
+ this.firstRun = true;
54
+ this.searcher.find(value);
55
+ }
56
+ }
57
+
58
+ this.addResults = function(results, isLast) {
59
+ var target = this.result;
60
+ if (this.firstRun && (results.length > 0 || isLast)) {
61
+ this.current = null;
62
+ this.result.innerHTML = '';
63
+ }
64
+
65
+ for (var i=0, l = results.length; i < l; i++) {
66
+ var item = this.renderItem.call(this, results[i]);
67
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
68
+ target.appendChild(item);
69
+ };
70
+
71
+ if (this.firstRun && results.length > 0) {
72
+ this.firstRun = false;
73
+ this.current = target.firstChild;
74
+ this.current.classList.add('search-selected');
75
+ }
76
+ //TODO: ECMAScript
77
+ //if (jQuery.browser.msie) this.$element[0].className += '';
78
+
79
+ if (isLast) this.result.setAttribute('aria-busy', 'false');
80
+ }
81
+
82
+ this.move = function(isDown) {
83
+ if (!this.current) return;
84
+ var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
85
+ if (next) {
86
+ this.current.classList.remove('search-selected');
87
+ next.classList.add('search-selected');
88
+ this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
89
+ this.scrollIntoView(next, this.view);
90
+ this.current = next;
91
+ this.input.value = next.firstChild.firstChild.text;
92
+ this.input.select();
93
+ }
94
+ return true;
95
+ }
96
+
97
+ this.hlt = function(html) {
98
+ return this.escapeHTML(html).
99
+ replace(/\u0001/g, '<em>').
100
+ replace(/\u0002/g, '</em>');
101
+ }
102
+
103
+ this.escapeHTML = function(html) {
104
+ return html.replace(/[&<>]/g, function(c) {
105
+ return '&#' + c.charCodeAt(0) + ';';
106
+ });
107
+ }
108
+
109
+ });
110
+
@@ -0,0 +1,18 @@
1
+ <body id="top" role="document" class="file">
2
+ <nav role="navigation">
3
+ <div id="project-navigation">
4
+ <%= render '_sidebar_navigation.rhtml' %>
5
+ <%= render '_sidebar_search.rhtml' %>
6
+ </div>
7
+
8
+ <%= render '_sidebar_table_of_contents.rhtml' %>
9
+
10
+ <div id="project-metadata">
11
+ <%= render '_sidebar_pages.rhtml' %>
12
+ </div>
13
+ </nav>
14
+
15
+ <main role="main" aria-label="Page <%=h file.full_name%>">
16
+ <%= file.description %>
17
+ </main>
18
+
@@ -0,0 +1,18 @@
1
+ <body role="document">
2
+ <nav role="navigation">
3
+ <%= render '_sidebar_navigation.rhtml' %>
4
+
5
+ <%= render '_sidebar_search.rhtml' %>
6
+
7
+ <div id="project-metadata">
8
+ <%= render '_sidebar_pages.rhtml' %>
9
+ <%= render '_sidebar_classes.rhtml' %>
10
+ </div>
11
+ </nav>
12
+
13
+ <main role="main">
14
+ <h1>Not Found</h1>
15
+
16
+ <p><%= message %>
17
+ </main>
18
+
@@ -0,0 +1,62 @@
1
+ <body role="document">
2
+ <nav role="navigation">
3
+ <div id="project-navigation">
4
+ <div id="home-section" class="nav-section">
5
+ <h2>
6
+ <a href="<%= rel_prefix %>/" rel="home">Home</a>
7
+ </h2>
8
+ </div>
9
+
10
+ <%= render '_sidebar_search.rhtml' %>
11
+ </div>
12
+
13
+ <%= render '_sidebar_installed.rhtml' %>
14
+ </nav>
15
+
16
+ <main role="main">
17
+ <h1>Local RDoc Documentation</h1>
18
+
19
+ <p>Here you can browse local documentation from the ruby standard library and
20
+ your installed gems.
21
+
22
+ <%- extra_dirs = installed.select { |_, _, _, type,| type == :extra } -%>
23
+ <%- unless extra_dirs.empty? -%>
24
+ <h2>Extra Documentation Directories</h2>
25
+
26
+ <p>The following additional documentation directories are available:</p>
27
+
28
+ <ol>
29
+ <%- extra_dirs.each do |name, href, exists, _, path| -%>
30
+ <li>
31
+ <%- if exists -%>
32
+ <a href="<%= href %>"><%= h name %></a> (<%= h path %>)
33
+ <%- else -%>
34
+ <%= h name %> (<%= h path %>; <i>not available</i>)
35
+ <%- end -%>
36
+ </li>
37
+ <%- end -%>
38
+ </ol>
39
+ <%- end -%>
40
+
41
+ <%- gems = installed.select { |_, _, _, type,| type == :gem } -%>
42
+ <%- missing = gems.reject { |_, _, exists,| exists } -%>
43
+ <%- unless missing.empty? then -%>
44
+ <h2>Missing Gem Documentation</h2>
45
+
46
+ <p>You are missing documentation for some of your installed gems.
47
+ You can install missing documentation for gems by running
48
+ <kbd>gem rdoc --all</kbd>. After installing the missing documentation you
49
+ only need to reload this page. The newly created documentation will
50
+ automatically appear.
51
+
52
+ <p>You can also install documentation for a specific gem by running one of
53
+ the following commands.
54
+
55
+ <ul>
56
+ <%- names = missing.map { |name,| name.sub(/-([^-]*)$/, '') }.uniq -%>
57
+ <%- names.each do |name| -%>
58
+ <li><kbd>gem rdoc <%=h name %></kbd>
59
+ <%- end -%>
60
+ </ul>
61
+ <%- end -%>
62
+ </main>
@@ -0,0 +1,58 @@
1
+ <body id="top" class="table-of-contents">
2
+ <main role="main">
3
+ <h1 class="class"><%= h @title %></h1>
4
+
5
+ <%- simple_files = @files.select { |f| f.text? } -%>
6
+ <%- unless simple_files.empty? then -%>
7
+ <h2 id="pages">Pages</h2>
8
+ <ul>
9
+ <%- simple_files.sort.each do |file| -%>
10
+ <li class="file">
11
+ <a href="<%= file.path %>"><%= h file.page_name %></a>
12
+ <%
13
+ # HACK table_of_contents should not exist on Document
14
+ table = file.parse(file.comment).table_of_contents
15
+ unless table.empty? then %>
16
+ <ul>
17
+ <%- table.each do |heading| -%>
18
+ <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
19
+ <%- end -%>
20
+ </ul>
21
+ <%- end -%>
22
+ </li>
23
+ <%- end -%>
24
+ </ul>
25
+ <%- end -%>
26
+
27
+ <h2 id="classes">Classes and Modules</h2>
28
+ <ul>
29
+ <%- @modsort.each do |klass| -%>
30
+ <li class="<%= klass.type %>">
31
+ <a href="<%= klass.path %>"><%= klass.full_name %></a>
32
+ <%- table = []
33
+ table.concat klass.parse(klass.comment_location).table_of_contents
34
+ table.concat klass.section_contents
35
+
36
+ unless table.empty? then %>
37
+ <ul>
38
+ <%- table.each do |item| -%>
39
+ <li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
40
+ <%- end -%>
41
+ </ul>
42
+ <%- end -%>
43
+ </li>
44
+ <%- end -%>
45
+ </ul>
46
+
47
+ <h2 id="methods">Methods</h2>
48
+ <ul>
49
+ <%- @store.all_classes_and_modules.map do |mod|
50
+ mod.method_list
51
+ end.flatten.sort.each do |method| %>
52
+ <li class="method">
53
+ <a href="<%= method.path %>"><%= h method.pretty_name %></a>
54
+ &mdash;
55
+ <span class="container"><%= method.parent.full_name %></span>
56
+ <%- end -%>
57
+ </ul>
58
+ </main>
@@ -0,0 +1 @@
1
+ # ignore all files in this directory
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Navigation allows movement using the arrow keys through the search results.
3
+ *
4
+ * When using this library you will need to set scrollIntoView to the
5
+ * appropriate function for your layout. Use scrollInWindow if the container
6
+ * is not scrollable and scrollInElement if the container is a separate
7
+ * scrolling region.
8
+ */
9
+ Navigation = new function() {
10
+ this.initNavigation = function() {
11
+ var _this = this;
12
+
13
+ document.addEventListener('keydown', function(e) {
14
+ _this.onkeydown(e);
15
+ });
16
+
17
+ this.navigationActive = true;
18
+ }
19
+
20
+ this.setNavigationActive = function(state) {
21
+ this.navigationActive = state;
22
+ }
23
+
24
+ this.onkeydown = function(e) {
25
+ if (!this.navigationActive) return;
26
+ switch(e.keyCode) {
27
+ case 37: //Event.KEY_LEFT:
28
+ if (this.moveLeft()) e.preventDefault();
29
+ break;
30
+ case 38: //Event.KEY_UP:
31
+ if (e.keyCode == 38 || e.ctrlKey) {
32
+ if (this.moveUp()) e.preventDefault();
33
+ }
34
+ break;
35
+ case 39: //Event.KEY_RIGHT:
36
+ if (this.moveRight()) e.preventDefault();
37
+ break;
38
+ case 40: //Event.KEY_DOWN:
39
+ if (e.keyCode == 40 || e.ctrlKey) {
40
+ if (this.moveDown()) e.preventDefault();
41
+ }
42
+ break;
43
+ case 13: //Event.KEY_RETURN:
44
+ if (this.current) e.preventDefault();
45
+ this.select(this.current);
46
+ break;
47
+ }
48
+ if (e.ctrlKey && e.shiftKey) this.select(this.current);
49
+ }
50
+
51
+ this.moveRight = function() {
52
+ }
53
+
54
+ this.moveLeft = function() {
55
+ }
56
+
57
+ this.move = function(isDown) {
58
+ }
59
+
60
+ this.moveUp = function() {
61
+ return this.move(false);
62
+ }
63
+
64
+ this.moveDown = function() {
65
+ return this.move(true);
66
+ }
67
+
68
+ /*
69
+ * Scrolls to the given element in the scrollable element view.
70
+ */
71
+ this.scrollInElement = function(element, view) {
72
+ var offset, viewHeight, viewScroll, height;
73
+ offset = element.offsetTop;
74
+ height = element.offsetHeight;
75
+ viewHeight = view.offsetHeight;
76
+ viewScroll = view.scrollTop;
77
+
78
+ if (offset - viewScroll + height > viewHeight) {
79
+ view.scrollTop = offset - viewHeight + height;
80
+ }
81
+ if (offset < viewScroll) {
82
+ view.scrollTop = offset;
83
+ }
84
+ }
85
+
86
+ /*
87
+ * Scrolls to the given element in the window. The second argument is
88
+ * ignored
89
+ */
90
+ this.scrollInWindow = function(element, ignored) {
91
+ var offset, viewHeight, viewScroll, height;
92
+ offset = element.offsetTop;
93
+ height = element.offsetHeight;
94
+ viewHeight = window.innerHeight;
95
+ viewScroll = window.scrollY;
96
+
97
+ if (offset - viewScroll + height > viewHeight) {
98
+ window.scrollTo(window.scrollX, offset - viewHeight + height);
99
+ }
100
+ if (offset < viewScroll) {
101
+ window.scrollTo(window.scrollX, offset);
102
+ }
103
+ }
104
+ }
105
+