super-quick-rb 0.0.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 (218) hide show
  1. checksums.yaml +7 -0
  2. data/rdoc-8.0.0/CONTRIBUTING.md +195 -0
  3. data/rdoc-8.0.0/CVE-2013-0256.rdoc +49 -0
  4. data/rdoc-8.0.0/History.rdoc +1668 -0
  5. data/rdoc-8.0.0/LEGAL.rdoc +56 -0
  6. data/rdoc-8.0.0/LICENSE.rdoc +63 -0
  7. data/rdoc-8.0.0/README.md +236 -0
  8. data/rdoc-8.0.0/RI.md +842 -0
  9. data/rdoc-8.0.0/TODO.rdoc +60 -0
  10. data/rdoc-8.0.0/doc/markup_reference/markdown.md +659 -0
  11. data/rdoc-8.0.0/doc/markup_reference/rdoc.rdoc +1169 -0
  12. data/rdoc-8.0.0/exe/rdoc +43 -0
  13. data/rdoc-8.0.0/exe/ri +12 -0
  14. data/rdoc-8.0.0/lib/rdoc/code_object/alias.rb +98 -0
  15. data/rdoc-8.0.0/lib/rdoc/code_object/any_method.rb +387 -0
  16. data/rdoc-8.0.0/lib/rdoc/code_object/attr.rb +178 -0
  17. data/rdoc-8.0.0/lib/rdoc/code_object/class_module.rb +969 -0
  18. data/rdoc-8.0.0/lib/rdoc/code_object/constant.rb +221 -0
  19. data/rdoc-8.0.0/lib/rdoc/code_object/context/section.rb +182 -0
  20. data/rdoc-8.0.0/lib/rdoc/code_object/context.rb +1238 -0
  21. data/rdoc-8.0.0/lib/rdoc/code_object/extend.rb +9 -0
  22. data/rdoc-8.0.0/lib/rdoc/code_object/include.rb +9 -0
  23. data/rdoc-8.0.0/lib/rdoc/code_object/method_attr.rb +417 -0
  24. data/rdoc-8.0.0/lib/rdoc/code_object/mixin.rb +123 -0
  25. data/rdoc-8.0.0/lib/rdoc/code_object/normal_class.rb +92 -0
  26. data/rdoc-8.0.0/lib/rdoc/code_object/normal_module.rb +73 -0
  27. data/rdoc-8.0.0/lib/rdoc/code_object/require.rb +51 -0
  28. data/rdoc-8.0.0/lib/rdoc/code_object/single_class.rb +30 -0
  29. data/rdoc-8.0.0/lib/rdoc/code_object/top_level.rb +286 -0
  30. data/rdoc-8.0.0/lib/rdoc/code_object.rb +393 -0
  31. data/rdoc-8.0.0/lib/rdoc/code_objects.rb +5 -0
  32. data/rdoc-8.0.0/lib/rdoc/comment.rb +353 -0
  33. data/rdoc-8.0.0/lib/rdoc/cross_reference.rb +215 -0
  34. data/rdoc-8.0.0/lib/rdoc/encoding.rb +120 -0
  35. data/rdoc-8.0.0/lib/rdoc/erb_partial.rb +18 -0
  36. data/rdoc-8.0.0/lib/rdoc/erbio.rb +37 -0
  37. data/rdoc-8.0.0/lib/rdoc/generator/aliki.rb +200 -0
  38. data/rdoc-8.0.0/lib/rdoc/generator/darkfish.rb +824 -0
  39. data/rdoc-8.0.0/lib/rdoc/generator/json_index.rb +284 -0
  40. data/rdoc-8.0.0/lib/rdoc/generator/markup.rb +196 -0
  41. data/rdoc-8.0.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  42. data/rdoc-8.0.0/lib/rdoc/generator/pot/po.rb +84 -0
  43. data/rdoc-8.0.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
  44. data/rdoc-8.0.0/lib/rdoc/generator/pot.rb +94 -0
  45. data/rdoc-8.0.0/lib/rdoc/generator/ri.rb +30 -0
  46. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  47. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  48. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  49. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  50. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  51. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  52. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  53. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  54. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  55. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  56. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  57. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  58. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  59. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  60. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  61. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  62. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  63. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  64. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  65. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  66. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  67. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  68. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  69. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  70. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  71. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  72. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  73. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  74. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  75. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  76. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
  77. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +5 -0
  78. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +17 -0
  79. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +17 -0
  80. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +16 -0
  81. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
  82. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  83. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
  84. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
  85. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +15 -0
  86. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  87. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
  88. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  89. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/class.rhtml +220 -0
  90. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  91. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +701 -0
  92. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  93. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  94. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  95. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  96. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  97. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  98. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  99. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  100. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  101. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  102. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  103. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  104. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  105. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  106. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  107. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  108. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  109. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  110. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  111. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  112. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  113. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  114. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  115. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  116. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  117. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  118. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  119. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  120. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  121. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  122. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  123. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/index.rhtml +24 -0
  124. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +140 -0
  125. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/search.js +120 -0
  126. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/page.rhtml +19 -0
  127. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +21 -0
  128. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
  129. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +72 -0
  130. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  131. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/searcher.js +271 -0
  132. data/rdoc-8.0.0/lib/rdoc/generator.rb +52 -0
  133. data/rdoc-8.0.0/lib/rdoc/i18n/locale.rb +102 -0
  134. data/rdoc-8.0.0/lib/rdoc/i18n/text.rb +126 -0
  135. data/rdoc-8.0.0/lib/rdoc/i18n.rb +10 -0
  136. data/rdoc-8.0.0/lib/rdoc/known_classes.rb +74 -0
  137. data/rdoc-8.0.0/lib/rdoc/markdown/entities.rb +2131 -0
  138. data/rdoc-8.0.0/lib/rdoc/markdown/literals.kpeg +21 -0
  139. data/rdoc-8.0.0/lib/rdoc/markdown/literals.rb +454 -0
  140. data/rdoc-8.0.0/lib/rdoc/markdown.kpeg +1315 -0
  141. data/rdoc-8.0.0/lib/rdoc/markdown.rb +16865 -0
  142. data/rdoc-8.0.0/lib/rdoc/markup/blank_line.rb +29 -0
  143. data/rdoc-8.0.0/lib/rdoc/markup/block_quote.rb +14 -0
  144. data/rdoc-8.0.0/lib/rdoc/markup/document.rb +164 -0
  145. data/rdoc-8.0.0/lib/rdoc/markup/element.rb +21 -0
  146. data/rdoc-8.0.0/lib/rdoc/markup/formatter.rb +285 -0
  147. data/rdoc-8.0.0/lib/rdoc/markup/hard_break.rb +34 -0
  148. data/rdoc-8.0.0/lib/rdoc/markup/heading.rb +170 -0
  149. data/rdoc-8.0.0/lib/rdoc/markup/include.rb +42 -0
  150. data/rdoc-8.0.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
  151. data/rdoc-8.0.0/lib/rdoc/markup/inline_parser.rb +312 -0
  152. data/rdoc-8.0.0/lib/rdoc/markup/list.rb +101 -0
  153. data/rdoc-8.0.0/lib/rdoc/markup/list_item.rb +99 -0
  154. data/rdoc-8.0.0/lib/rdoc/markup/paragraph.rb +28 -0
  155. data/rdoc-8.0.0/lib/rdoc/markup/parser.rb +585 -0
  156. data/rdoc-8.0.0/lib/rdoc/markup/pre_process.rb +317 -0
  157. data/rdoc-8.0.0/lib/rdoc/markup/raw.rb +66 -0
  158. data/rdoc-8.0.0/lib/rdoc/markup/rule.rb +20 -0
  159. data/rdoc-8.0.0/lib/rdoc/markup/table.rb +64 -0
  160. data/rdoc-8.0.0/lib/rdoc/markup/to_ansi.rb +144 -0
  161. data/rdoc-8.0.0/lib/rdoc/markup/to_bs.rb +86 -0
  162. data/rdoc-8.0.0/lib/rdoc/markup/to_html.rb +682 -0
  163. data/rdoc-8.0.0/lib/rdoc/markup/to_html_crossref.rb +261 -0
  164. data/rdoc-8.0.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
  165. data/rdoc-8.0.0/lib/rdoc/markup/to_joined_paragraph.rb +41 -0
  166. data/rdoc-8.0.0/lib/rdoc/markup/to_label.rb +84 -0
  167. data/rdoc-8.0.0/lib/rdoc/markup/to_markdown.rb +215 -0
  168. data/rdoc-8.0.0/lib/rdoc/markup/to_rdoc.rb +421 -0
  169. data/rdoc-8.0.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
  170. data/rdoc-8.0.0/lib/rdoc/markup/to_test.rb +77 -0
  171. data/rdoc-8.0.0/lib/rdoc/markup/to_tt_only.rb +107 -0
  172. data/rdoc-8.0.0/lib/rdoc/markup/verbatim.rb +83 -0
  173. data/rdoc-8.0.0/lib/rdoc/markup.rb +219 -0
  174. data/rdoc-8.0.0/lib/rdoc/options.rb +1412 -0
  175. data/rdoc-8.0.0/lib/rdoc/parser/c.rb +1227 -0
  176. data/rdoc-8.0.0/lib/rdoc/parser/changelog.rb +379 -0
  177. data/rdoc-8.0.0/lib/rdoc/parser/markdown.rb +22 -0
  178. data/rdoc-8.0.0/lib/rdoc/parser/rbs.rb +275 -0
  179. data/rdoc-8.0.0/lib/rdoc/parser/rd.rb +22 -0
  180. data/rdoc-8.0.0/lib/rdoc/parser/ruby.rb +1266 -0
  181. data/rdoc-8.0.0/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  182. data/rdoc-8.0.0/lib/rdoc/parser/simple.rb +44 -0
  183. data/rdoc-8.0.0/lib/rdoc/parser/text.rb +11 -0
  184. data/rdoc-8.0.0/lib/rdoc/parser.rb +298 -0
  185. data/rdoc-8.0.0/lib/rdoc/rbs_helper.rb +186 -0
  186. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.rb +1706 -0
  187. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.ry +643 -0
  188. data/rdoc-8.0.0/lib/rdoc/rd/inline.rb +71 -0
  189. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.rb +1854 -0
  190. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.ry +593 -0
  191. data/rdoc-8.0.0/lib/rdoc/rd.rb +99 -0
  192. data/rdoc-8.0.0/lib/rdoc/rdoc.rb +724 -0
  193. data/rdoc-8.0.0/lib/rdoc/ri/driver.rb +1572 -0
  194. data/rdoc-8.0.0/lib/rdoc/ri/formatter.rb +6 -0
  195. data/rdoc-8.0.0/lib/rdoc/ri/paths.rb +171 -0
  196. data/rdoc-8.0.0/lib/rdoc/ri/servlet.rb +452 -0
  197. data/rdoc-8.0.0/lib/rdoc/ri/store.rb +6 -0
  198. data/rdoc-8.0.0/lib/rdoc/ri/task.rb +71 -0
  199. data/rdoc-8.0.0/lib/rdoc/ri.rb +21 -0
  200. data/rdoc-8.0.0/lib/rdoc/rubygems_hook.rb +327 -0
  201. data/rdoc-8.0.0/lib/rdoc/server.rb +460 -0
  202. data/rdoc-8.0.0/lib/rdoc/stats/normal.rb +58 -0
  203. data/rdoc-8.0.0/lib/rdoc/stats/quiet.rb +59 -0
  204. data/rdoc-8.0.0/lib/rdoc/stats/verbose.rb +44 -0
  205. data/rdoc-8.0.0/lib/rdoc/stats.rb +484 -0
  206. data/rdoc-8.0.0/lib/rdoc/store.rb +1205 -0
  207. data/rdoc-8.0.0/lib/rdoc/task.rb +355 -0
  208. data/rdoc-8.0.0/lib/rdoc/text.rb +244 -0
  209. data/rdoc-8.0.0/lib/rdoc/token_stream.rb +104 -0
  210. data/rdoc-8.0.0/lib/rdoc/tom_doc.rb +257 -0
  211. data/rdoc-8.0.0/lib/rdoc/version.rb +10 -0
  212. data/rdoc-8.0.0/lib/rdoc.rb +239 -0
  213. data/rdoc-8.0.0/lib/rubygems_plugin.rb +14 -0
  214. data/rdoc-8.0.0/man/ri.1 +249 -0
  215. data/rdoc-8.0.0/rdoc-logo.svg +43 -0
  216. data/rdoc-8.0.0/rdoc.gemspec +74 -0
  217. data/super-quick-rb.gemspec +12 -0
  218. metadata +257 -0
@@ -0,0 +1,824 @@
1
+ # frozen_string_literal: true
2
+ # -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
3
+
4
+ require 'erb'
5
+ require 'fileutils'
6
+ require 'pathname'
7
+ require_relative 'markup'
8
+
9
+ ##
10
+ # Darkfish RDoc HTML Generator
11
+ #
12
+ # $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
13
+ #
14
+ # == Author/s
15
+ # * Michael Granger (ged@FaerieMUD.org)
16
+ #
17
+ # == Contributors
18
+ # * Mahlon E. Smith (mahlon@martini.nu)
19
+ # * Eric Hodel (drbrain@segment7.net)
20
+ #
21
+ # == License
22
+ #
23
+ # Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
24
+ #
25
+ # Redistribution and use in source and binary forms, with or without
26
+ # modification, are permitted provided that the following conditions are met:
27
+ #
28
+ # * Redistributions of source code must retain the above copyright notice,
29
+ # this list of conditions and the following disclaimer.
30
+ #
31
+ # * Redistributions in binary form must reproduce the above copyright notice,
32
+ # this list of conditions and the following disclaimer in the documentation
33
+ # and/or other materials provided with the distribution.
34
+ #
35
+ # * Neither the name of the author/s, nor the names of the project's
36
+ # contributors may be used to endorse or promote products derived from this
37
+ # software without specific prior written permission.
38
+ #
39
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
43
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49
+ #
50
+ # == Attributions
51
+ #
52
+ # Darkfish uses the {Silk Icons}[http://www.famfamfam.com/lab/icons/silk/] set
53
+ # by Mark James.
54
+
55
+ class RDoc::Generator::Darkfish
56
+
57
+ RDoc::RDoc.add_generator self
58
+
59
+ include ERB::Util
60
+
61
+ ##
62
+ # Stylesheets, fonts, etc. that are included in RDoc.
63
+
64
+ BUILTIN_STYLE_ITEMS = # :nodoc:
65
+ %w[
66
+ css/fonts.css
67
+ fonts/Lato-Light.ttf
68
+ fonts/Lato-LightItalic.ttf
69
+ fonts/Lato-Regular.ttf
70
+ fonts/Lato-RegularItalic.ttf
71
+ fonts/SourceCodePro-Bold.ttf
72
+ fonts/SourceCodePro-Regular.ttf
73
+ css/rdoc.css
74
+ ]
75
+
76
+ ##
77
+ # Description of this generator
78
+
79
+ DESCRIPTION = 'HTML generator, written by Michael Granger'
80
+
81
+ ##
82
+ # The relative path to style sheets and javascript. By default this is set
83
+ # the same as the rel_prefix.
84
+
85
+ attr_accessor :asset_rel_path
86
+
87
+ ##
88
+ # The path to generate files into, combined with <tt>--op</tt> from the
89
+ # options for a full path.
90
+
91
+ attr_reader :base_dir
92
+
93
+ ##
94
+ # Classes and modules to be used by this generator, not necessarily
95
+ # displayed. See also #modsort
96
+
97
+ attr_reader :classes
98
+
99
+ ##
100
+ # No files will be written when dry_run is true.
101
+
102
+ attr_accessor :dry_run
103
+
104
+ ##
105
+ # When false the generate methods return a String instead of writing to a
106
+ # file. The default is true.
107
+
108
+ attr_accessor :file_output
109
+
110
+ ##
111
+ # Files to be displayed by this generator
112
+
113
+ attr_reader :files
114
+
115
+ ##
116
+ # The JSON index generator for this Darkfish generator
117
+
118
+ attr_reader :json_index
119
+
120
+ ##
121
+ # Methods to be displayed by this generator
122
+
123
+ attr_reader :methods
124
+
125
+ ##
126
+ # Sorted list of classes and modules to be displayed by this generator
127
+
128
+ attr_reader :modsort
129
+
130
+ ##
131
+ # The RDoc::Store that is the source of the generated content
132
+
133
+ attr_reader :store
134
+
135
+ ##
136
+ # The directory where the template files live
137
+
138
+ attr_reader :template_dir # :nodoc:
139
+
140
+ ##
141
+ # The output directory
142
+
143
+ attr_reader :outputdir
144
+
145
+ ##
146
+ # Initialize a few instance variables before we start
147
+
148
+ def initialize(store, options)
149
+ @store = store
150
+ @options = options
151
+
152
+ @asset_rel_path = ''
153
+ @base_dir = Pathname.pwd.expand_path
154
+ @dry_run = @options.dry_run
155
+ @file_output = true
156
+ @template_dir = Pathname.new options.template_dir
157
+ @template_cache = {}
158
+
159
+ @classes = nil
160
+ @context = nil
161
+ @files = nil
162
+ @methods = nil
163
+ @modsort = nil
164
+
165
+ @json_index = RDoc::Generator::JsonIndex.new self, options
166
+ end
167
+
168
+ ##
169
+ # Output progress information if debugging is enabled
170
+
171
+ def debug_msg(*msg)
172
+ return unless $DEBUG_RDOC
173
+ $stderr.puts(*msg)
174
+ end
175
+
176
+ ##
177
+ # Create the directories the generated docs will live in if they don't
178
+ # already exist.
179
+
180
+ def gen_sub_directories
181
+ @outputdir.mkpath
182
+ end
183
+
184
+ ##
185
+ # Copy over the stylesheet into the appropriate place in the output
186
+ # directory.
187
+
188
+ def write_style_sheet
189
+ debug_msg "Copying static files"
190
+ options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
191
+
192
+ BUILTIN_STYLE_ITEMS.each do |item|
193
+ install_rdoc_static_file @template_dir + item, "./#{item}", options
194
+ end
195
+
196
+ unless @options.template_stylesheets.empty?
197
+ FileUtils.cp @options.template_stylesheets, '.', **options
198
+ end
199
+
200
+ Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
201
+ next if File.directory? path
202
+ next if File.basename(path) =~ /^\./
203
+
204
+ dst = Pathname.new(path).relative_path_from @template_dir
205
+
206
+ install_rdoc_static_file @template_dir + path, dst, options
207
+ end
208
+ end
209
+
210
+ ##
211
+ # Build the initial indices and output objects based on an array of TopLevel
212
+ # objects containing the extracted information.
213
+
214
+ def generate
215
+ setup
216
+
217
+ write_style_sheet
218
+ generate_index
219
+ generate_class_files
220
+ generate_file_files
221
+ generate_table_of_contents
222
+ @json_index.generate
223
+ @json_index.generate_gzipped
224
+
225
+ copy_static
226
+
227
+ rescue => e
228
+ debug_msg "%s: %s\n %s" % [
229
+ e.class.name, e.message, e.backtrace.join("\n ")
230
+ ]
231
+
232
+ raise
233
+ end
234
+
235
+ ##
236
+ # Copies static files from the static_path into the output directory
237
+
238
+ def copy_static
239
+ return if @options.static_path.empty?
240
+
241
+ fu_options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
242
+
243
+ @options.static_path.each do |path|
244
+ unless File.directory? path then
245
+ FileUtils.install path, @outputdir, **fu_options.merge(:mode => 0644)
246
+ next
247
+ end
248
+
249
+ Dir.chdir path do
250
+ Dir[File.join('**', '*')].each do |entry|
251
+ dest_file = @outputdir + entry
252
+
253
+ if File.directory? entry then
254
+ FileUtils.mkdir_p entry, **fu_options
255
+ else
256
+ FileUtils.install entry, dest_file, **fu_options.merge(:mode => 0644)
257
+ end
258
+ end
259
+ end
260
+ end
261
+ end
262
+
263
+ ##
264
+ # Return a list of the documented modules sorted by salience first, then
265
+ # by name.
266
+
267
+ def get_sorted_module_list(classes)
268
+ classes.select do |klass|
269
+ klass.display?
270
+ end.sort
271
+ end
272
+
273
+ ##
274
+ # Generate an index page which lists all the classes which are documented.
275
+
276
+ def generate_index
277
+ template_file = @template_dir + 'index.rhtml'
278
+ return unless template_file.exist?
279
+
280
+ debug_msg "Rendering the index page..."
281
+
282
+ out_file = @base_dir + @options.op_dir + 'index.html'
283
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
284
+ search_index_rel_prefix = rel_prefix
285
+ search_index_rel_prefix += @asset_rel_path if @file_output
286
+
287
+ asset_rel_prefix = rel_prefix + @asset_rel_path
288
+
289
+ @title = @options.title
290
+ @main_page = @files.find { |f| f.full_name == @options.main_page }
291
+
292
+ render_template template_file, out_file do |io|
293
+ here = binding
294
+ # suppress 1.9.3 warning
295
+ here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
296
+ # some partials rely on the presence of current variable to render
297
+ here.local_variable_set(:current, @main_page) if @main_page
298
+ here
299
+ end
300
+ rescue => e
301
+ error = RDoc::Error.new \
302
+ "error generating index.html: #{e.message} (#{e.class})"
303
+ error.set_backtrace e.backtrace
304
+
305
+ raise error
306
+ end
307
+
308
+ ##
309
+ # Generates a class file for +klass+
310
+
311
+ def generate_class(klass, template_file = nil)
312
+ # This is used to auto-collapse Pages section on class/module pages
313
+ @inside_class_file = true
314
+ current = klass
315
+
316
+ template_file ||= @template_dir + 'class.rhtml'
317
+
318
+ debug_msg " working on %s (%s)" % [klass.full_name, klass.path]
319
+ out_file = @outputdir + klass.path
320
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
321
+ search_index_rel_prefix = rel_prefix
322
+ search_index_rel_prefix += @asset_rel_path if @file_output
323
+
324
+ asset_rel_prefix = rel_prefix + @asset_rel_path
325
+
326
+ breadcrumb = # used in templates
327
+ breadcrumb = generate_nesting_namespaces_breadcrumb(current, rel_prefix)
328
+
329
+ @title = "#{klass.type} #{klass.full_name} - #{@options.title}"
330
+
331
+ debug_msg " rendering #{out_file}"
332
+ render_template template_file, out_file do |io|
333
+ here = binding
334
+ # suppress 1.9.3 warning
335
+ here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
336
+ here
337
+ end
338
+ ensure
339
+ @inside_class_file = false
340
+ end
341
+
342
+ ##
343
+ # Generate a documentation file for each class and module
344
+
345
+ def generate_class_files
346
+ template_file = @template_dir + 'class.rhtml'
347
+ template_file = @template_dir + 'classpage.rhtml' unless
348
+ template_file.exist?
349
+ return unless template_file.exist?
350
+ debug_msg "Generating class documentation in #{@outputdir}"
351
+
352
+ current = nil
353
+
354
+ # Document files are generated only for non-alias classes/modules
355
+ @classes.reject(&:is_alias_for).each do |klass|
356
+
357
+ current = klass
358
+
359
+ generate_class klass, template_file
360
+ end
361
+ rescue => e
362
+ error = RDoc::Error.new \
363
+ "error generating #{current.path}: #{e.message} (#{e.class})"
364
+ error.set_backtrace e.backtrace
365
+
366
+ raise error
367
+ end
368
+
369
+ ##
370
+ # Generate a documentation file for each file
371
+
372
+ def generate_file_files
373
+ page_file = @template_dir + 'page.rhtml'
374
+ fileinfo_file = @template_dir + 'fileinfo.rhtml'
375
+
376
+ # for legacy templates
377
+ filepage_file = @template_dir + 'filepage.rhtml' unless
378
+ page_file.exist? or fileinfo_file.exist?
379
+
380
+ return unless
381
+ page_file.exist? or fileinfo_file.exist? or filepage_file.exist?
382
+
383
+ debug_msg "Generating file documentation in #{@outputdir}"
384
+
385
+ out_file = nil
386
+ current = nil
387
+
388
+ @files.each do |file|
389
+ current = file
390
+
391
+ next if file.text? && file.full_name == @options.main_page
392
+
393
+ if file.text? and page_file.exist? then
394
+ generate_page file
395
+ next
396
+ end
397
+
398
+ template_file = nil
399
+ out_file = @outputdir + file.path
400
+ debug_msg " working on %s (%s)" % [file.full_name, out_file]
401
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
402
+ search_index_rel_prefix = rel_prefix
403
+ search_index_rel_prefix += @asset_rel_path if @file_output
404
+
405
+ asset_rel_prefix = rel_prefix + @asset_rel_path
406
+
407
+ unless filepage_file then
408
+ if file.text? then
409
+ next unless page_file.exist?
410
+ template_file = page_file
411
+ @title = file.page_name
412
+ else
413
+ next unless fileinfo_file.exist?
414
+ template_file = fileinfo_file
415
+ @title = "File: #{file.base_name}"
416
+ end
417
+ end
418
+
419
+ @title += " - #{@options.title}"
420
+ template_file ||= filepage_file
421
+
422
+ render_template template_file, out_file do |io|
423
+ here = binding
424
+ # suppress 1.9.3 warning
425
+ here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
426
+ here.local_variable_set(:current, current)
427
+ here
428
+ end
429
+ end
430
+ rescue => e
431
+ error =
432
+ RDoc::Error.new "error generating #{out_file}: #{e.message} (#{e.class})"
433
+ error.set_backtrace e.backtrace
434
+
435
+ raise error
436
+ end
437
+
438
+ ##
439
+ # Generate a page file for +file+
440
+
441
+ def generate_page(file)
442
+ template_file = @template_dir + 'page.rhtml'
443
+
444
+ out_file = @outputdir + file.path
445
+ debug_msg " working on %s (%s)" % [file.full_name, out_file]
446
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
447
+ search_index_rel_prefix = rel_prefix
448
+ search_index_rel_prefix += @asset_rel_path if @file_output
449
+
450
+ current = file
451
+ asset_rel_prefix = rel_prefix + @asset_rel_path
452
+
453
+ @title = "#{file.page_name} - #{@options.title}"
454
+
455
+ debug_msg " rendering #{out_file}"
456
+ render_template template_file, out_file do |io|
457
+ here = binding
458
+ # suppress 1.9.3 warning
459
+ here.local_variable_set(:current, current)
460
+ here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
461
+ here
462
+ end
463
+ end
464
+
465
+ ##
466
+ # Generates the 404 page for the RDoc servlet
467
+
468
+ def generate_servlet_not_found(message)
469
+ template_file = @template_dir + 'servlet_not_found.rhtml'
470
+ return unless template_file.exist?
471
+
472
+ debug_msg "Rendering the servlet 404 Not Found page..."
473
+
474
+ rel_prefix = rel_prefix = ''
475
+ search_index_rel_prefix = rel_prefix
476
+ search_index_rel_prefix += @asset_rel_path if @file_output
477
+
478
+ asset_rel_prefix = ''
479
+
480
+ @title = 'Not Found'
481
+
482
+ render_template template_file do |io|
483
+ here = binding
484
+ # suppress 1.9.3 warning
485
+ here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
486
+ here
487
+ end
488
+ rescue => e
489
+ error = RDoc::Error.new \
490
+ "error generating servlet_not_found: #{e.message} (#{e.class})"
491
+ error.set_backtrace e.backtrace
492
+
493
+ raise error
494
+ end
495
+
496
+ ##
497
+ # Generates the servlet root page for the RDoc servlet
498
+
499
+ def generate_servlet_root(installed)
500
+ template_file = @template_dir + 'servlet_root.rhtml'
501
+ return unless template_file.exist?
502
+
503
+ debug_msg 'Rendering the servlet root page...'
504
+
505
+ rel_prefix = '.'
506
+ asset_rel_prefix = rel_prefix
507
+ search_index_rel_prefix = asset_rel_prefix
508
+ search_index_rel_prefix += @asset_rel_path if @file_output
509
+
510
+ @title = 'Local RDoc Documentation'
511
+
512
+ render_template template_file do |io| binding end
513
+ rescue => e
514
+ error = RDoc::Error.new \
515
+ "error generating servlet_root: #{e.message} (#{e.class})"
516
+ error.set_backtrace e.backtrace
517
+
518
+ raise error
519
+ end
520
+
521
+ ##
522
+ # Generate an index page which lists all the classes which are documented.
523
+
524
+ def generate_table_of_contents
525
+ template_file = @template_dir + 'table_of_contents.rhtml'
526
+ return unless template_file.exist?
527
+
528
+ debug_msg "Rendering the Table of Contents..."
529
+
530
+ out_file = @outputdir + 'table_of_contents.html'
531
+ rel_prefix = @outputdir.relative_path_from out_file.dirname
532
+ search_index_rel_prefix = rel_prefix
533
+ search_index_rel_prefix += @asset_rel_path if @file_output
534
+
535
+ asset_rel_prefix = rel_prefix + @asset_rel_path
536
+
537
+ @title = "Table of Contents - #{@options.title}"
538
+
539
+ render_template template_file, out_file do |io|
540
+ here = binding
541
+ # suppress 1.9.3 warning
542
+ here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
543
+ here
544
+ end
545
+ rescue => e
546
+ error = RDoc::Error.new \
547
+ "error generating table_of_contents.html: #{e.message} (#{e.class})"
548
+ error.set_backtrace e.backtrace
549
+
550
+ raise error
551
+ end
552
+
553
+ def install_rdoc_static_file(source, destination, options) # :nodoc:
554
+ return unless source.exist?
555
+
556
+ begin
557
+ FileUtils.mkdir_p File.dirname(destination), **options
558
+
559
+ begin
560
+ FileUtils.ln source, destination, **options
561
+ rescue Errno::EEXIST
562
+ FileUtils.rm destination
563
+ retry
564
+ end
565
+ rescue
566
+ FileUtils.cp source, destination, **options
567
+ end
568
+ end
569
+
570
+ ##
571
+ # Prepares for generation of output from the current directory
572
+
573
+ def setup
574
+ return if instance_variable_defined? :@outputdir
575
+
576
+ @outputdir = Pathname.new(@options.op_dir).expand_path @base_dir
577
+
578
+ return unless @store
579
+
580
+ refresh_store_data
581
+ end
582
+
583
+ ##
584
+ # Refreshes the generator's data from the store. Called by #setup and
585
+ # can be called again after the store has been updated (e.g. in server
586
+ # mode after re-parsing changed files).
587
+
588
+ def refresh_store_data
589
+ @classes = @store.all_classes_and_modules.sort
590
+ @files = @store.all_files.sort
591
+ @methods = @classes.flat_map { |m| m.method_list }.sort
592
+ @modsort = get_sorted_module_list @classes
593
+ end
594
+
595
+ ##
596
+ # Creates a template from its components and the +body_file+.
597
+ #
598
+ # For backwards compatibility, if +body_file+ contains "<html" the body is
599
+ # used directly.
600
+
601
+ def assemble_template(body_file)
602
+ body = body_file.read
603
+ return body if body =~ /<html/
604
+
605
+ head_file = @template_dir + '_head.rhtml'
606
+
607
+ <<-TEMPLATE
608
+ <!DOCTYPE html>
609
+
610
+ <html lang="#{@options.locale&.name || 'en'}">
611
+ <head>
612
+ #{head_file.read}
613
+
614
+ #{body}
615
+ TEMPLATE
616
+ end
617
+
618
+ ##
619
+ # Renders the ERb contained in +file_name+ relative to the template
620
+ # directory and returns the result based on the current context.
621
+
622
+ def render(file_name)
623
+ template_file = @template_dir + file_name
624
+
625
+ template = template_for template_file, false, RDoc::ERBPartial
626
+
627
+ template.filename = template_file.to_s
628
+
629
+ template.result @context
630
+ end
631
+
632
+ ##
633
+ # Load and render the erb template in the given +template_file+ and write
634
+ # it out to +out_file+.
635
+ #
636
+ # Both +template_file+ and +out_file+ should be Pathname-like objects.
637
+ #
638
+ # An io will be yielded which must be captured by binding in the caller.
639
+
640
+ def render_template(template_file, out_file = nil) # :yield: io
641
+ io_output = out_file && !@dry_run && @file_output
642
+ erb_klass = io_output ? RDoc::ERBIO : ERB
643
+
644
+ template = template_for template_file, true, erb_klass
645
+
646
+ if io_output then
647
+ debug_msg "Outputting to %s" % [out_file.expand_path]
648
+
649
+ out_file.dirname.mkpath
650
+ out_file.open 'w', 0644 do |io|
651
+ io.set_encoding @options.encoding
652
+
653
+ @context = yield io
654
+
655
+ template_result template, @context, template_file
656
+ end
657
+ else
658
+ @context = yield nil
659
+
660
+ output = template_result template, @context, template_file
661
+
662
+ debug_msg " would have written %d characters to %s" % [
663
+ output.length, out_file.expand_path
664
+ ] if @dry_run
665
+
666
+ output
667
+ end
668
+ end
669
+
670
+ ##
671
+ # Creates the result for +template+ with +context+. If an error is raised a
672
+ # Pathname +template_file+ will indicate the file where the error occurred.
673
+
674
+ def template_result(template, context, template_file)
675
+ template.filename = template_file.to_s
676
+ template.result context
677
+ rescue NoMethodError => e
678
+ raise RDoc::Error, "Error while evaluating %s: %s" % [
679
+ template_file.expand_path,
680
+ e.message,
681
+ ], e.backtrace
682
+ end
683
+
684
+ ##
685
+ # Retrieves a cache template for +file+, if present, or fills the cache.
686
+
687
+ def template_for(file, page = true, klass = ERB)
688
+ template = @template_cache[file]
689
+
690
+ return template if template
691
+
692
+ if page then
693
+ template = assemble_template file
694
+ erbout = 'io'
695
+ else
696
+ template = file.read
697
+ template = template.encode @options.encoding
698
+
699
+ file_var = File.basename(file).sub(/\..*/, '')
700
+
701
+ erbout = "_erbout_#{file_var}"
702
+ end
703
+
704
+ template = klass.new template, trim_mode: '-', eoutvar: erbout
705
+ @template_cache[file] = template
706
+ template
707
+ end
708
+
709
+ # :stopdoc:
710
+ ParagraphExcerptRegexpOther = %r[\b\w[^./:]++\.]
711
+ # use \p/\P{letter} instead of \w/\W in Unicode
712
+ ParagraphExcerptRegexpUnicode = %r[\b\p{letter}[^./:]++\.]
713
+ # :startdoc:
714
+
715
+ # Returns an excerpt of the comment for usage in meta description tags
716
+ def excerpt(comment)
717
+ text = case comment
718
+ when RDoc::Comment
719
+ comment.text
720
+ else
721
+ comment
722
+ end
723
+
724
+ # Match from a capital letter to the first period, discarding any links, so
725
+ # that we don't end up matching badges in the README
726
+ pattern = ParagraphExcerptRegexpUnicode
727
+ begin
728
+ first_paragraph_match = text.match(pattern)
729
+ rescue Encoding::CompatibilityError
730
+ # The doc is non-ASCII text and encoded in other than Unicode base encodings.
731
+ raise if pattern == ParagraphExcerptRegexpOther
732
+ pattern = ParagraphExcerptRegexpOther
733
+ retry
734
+ end
735
+ return text[0...150].tr_s("\n", " ").squeeze(" ") unless first_paragraph_match
736
+
737
+ extracted_text = first_paragraph_match[0]
738
+ second_paragraph = text.match(pattern, first_paragraph_match.end(0))
739
+ extracted_text << " " << second_paragraph[0] if second_paragraph
740
+
741
+ extracted_text[0...150].tr_s("\n", " ").squeeze(" ")
742
+ end
743
+
744
+ def generate_ancestor_list(ancestors, klass)
745
+ return '' if ancestors.empty?
746
+
747
+ ancestor = ancestors.shift
748
+ content = +'<ul><li>'
749
+
750
+ if ancestor.is_a?(RDoc::NormalClass)
751
+ content << "<a href=\"#{klass.aref_to ancestor.path}\">#{ancestor.full_name}</a>"
752
+ else
753
+ content << ancestor.to_s
754
+ end
755
+
756
+ # Recursively call the method for the remaining ancestors
757
+ content << generate_ancestor_list(ancestors, klass)
758
+
759
+ content << '</li></ul>'
760
+ end
761
+
762
+ def generate_class_link(klass, rel_prefix)
763
+ if klass.display?
764
+ %(<code><a href="#{rel_prefix}/#{klass.path}">#{klass.name}</a></code>)
765
+ else
766
+ %(<code>#{klass.name}</code>)
767
+ end
768
+ end
769
+
770
+ def generate_class_index_content(classes, rel_prefix)
771
+ grouped_classes = group_classes_by_namespace_for_sidebar(classes)
772
+ return '' unless top = grouped_classes[nil]
773
+
774
+ solo = top.one? { |klass| klass.display? }
775
+ traverse_classes(top, grouped_classes, rel_prefix, solo)
776
+ end
777
+
778
+ def traverse_classes(klasses, grouped_classes, rel_prefix, solo = false)
779
+ content = +'<ul class="link-list nav-list">'
780
+
781
+ klasses.each do |index_klass|
782
+ if children = grouped_classes[index_klass.full_name]
783
+ content << %(<li><details#{solo ? ' open' : ''}><summary>#{generate_class_link(index_klass, rel_prefix)}</summary>)
784
+ content << traverse_classes(children, grouped_classes, rel_prefix)
785
+ content << '</details></li>'
786
+ solo = false
787
+ elsif index_klass.display?
788
+ content << %(<li>#{generate_class_link(index_klass, rel_prefix)}</li>)
789
+ end
790
+ end
791
+
792
+ "#{content}</ul>"
793
+ end
794
+
795
+ def group_classes_by_namespace_for_sidebar(classes)
796
+ grouped_classes = classes.group_by do |klass|
797
+ klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
798
+ end.select do |_, klasses|
799
+ klasses.any?(&:display?)
800
+ end
801
+
802
+ grouped_classes.values.each(&:uniq!)
803
+ grouped_classes
804
+ end
805
+
806
+ private
807
+
808
+ def nesting_namespaces_to_class_modules(klass)
809
+ tree = {}
810
+
811
+ klass.nesting_namespaces.zip(klass.fully_qualified_nesting_namespaces) do |ns, fqns|
812
+ tree[ns] = @store.classes_hash[fqns] || @store.modules_hash[fqns]
813
+ end
814
+
815
+ tree
816
+ end
817
+
818
+ def generate_nesting_namespaces_breadcrumb(klass, rel_prefix)
819
+ nesting_namespaces_to_class_modules(klass).map do |namespace, class_module|
820
+ path = class_module ? (rel_prefix + class_module.path).to_s : ""
821
+ { name: namespace, path: path, self: klass.full_name == class_module&.full_name }
822
+ end
823
+ end
824
+ end