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,284 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+ begin
4
+ require 'zlib'
5
+ rescue LoadError
6
+ end
7
+
8
+ ##
9
+ # The JsonIndex generator is designed to complement an HTML generator and
10
+ # produces a JSON search index. This generator is derived from sdoc by
11
+ # Vladimir Kolesnikov and contains verbatim code written by him.
12
+ #
13
+ # This generator is designed to be used with a regular HTML generator:
14
+ #
15
+ # class RDoc::Generator::Darkfish
16
+ # def initialize options
17
+ # # ...
18
+ # @base_dir = Pathname.pwd.expand_path
19
+ #
20
+ # @json_index = RDoc::Generator::JsonIndex.new self, options
21
+ # end
22
+ #
23
+ # def generate
24
+ # # ...
25
+ # @json_index.generate
26
+ # end
27
+ # end
28
+ #
29
+ # == Index Format
30
+ #
31
+ # The index is output as a JSON file assigned to the global variable
32
+ # +search_data+. The structure is:
33
+ #
34
+ # var search_data = {
35
+ # "index": {
36
+ # "searchIndex":
37
+ # ["a", "b", ...],
38
+ # "longSearchIndex":
39
+ # ["a", "a::b", ...],
40
+ # "info": [
41
+ # ["A", "A", "A.html", "", ""],
42
+ # ["B", "A::B", "A::B.html", "", ""],
43
+ # ...
44
+ # ]
45
+ # }
46
+ # }
47
+ #
48
+ # The same item is described across the +searchIndex+, +longSearchIndex+ and
49
+ # +info+ fields. The +searchIndex+ field contains the item's short name, the
50
+ # +longSearchIndex+ field contains the full_name (when appropriate) and the
51
+ # +info+ field contains the item's name, full_name, path, parameters and a
52
+ # snippet of the item's comment.
53
+ #
54
+ # == LICENSE
55
+ #
56
+ # Copyright (c) 2009 Vladimir Kolesnikov
57
+ #
58
+ # Permission is hereby granted, free of charge, to any person obtaining
59
+ # a copy of this software and associated documentation files (the
60
+ # "Software"), to deal in the Software without restriction, including
61
+ # without limitation the rights to use, copy, modify, merge, publish,
62
+ # distribute, sublicense, and/or sell copies of the Software, and to
63
+ # permit persons to whom the Software is furnished to do so, subject to
64
+ # the following conditions:
65
+ #
66
+ # The above copyright notice and this permission notice shall be
67
+ # included in all copies or substantial portions of the Software.
68
+ #
69
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
70
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
71
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
72
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
73
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
74
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
75
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
76
+
77
+ class RDoc::Generator::JsonIndex
78
+
79
+ include RDoc::Text
80
+
81
+ ##
82
+ # Where the search index lives in the generated output
83
+
84
+ SEARCH_INDEX_FILE = File.join 'js', 'search_index.js'
85
+
86
+ attr_reader :index # :nodoc:
87
+
88
+ ##
89
+ # Creates a new generator.
90
+ # +options+ are the same options passed to the parent generator.
91
+
92
+ def initialize(parent_generator, options)
93
+ @parent_generator = parent_generator
94
+ @store = parent_generator.store
95
+ @options = options
96
+
97
+ @template_dir = File.expand_path '../template/json_index', __FILE__
98
+ @base_dir = @parent_generator.base_dir
99
+
100
+ @classes = nil
101
+ @files = nil
102
+ @index = nil
103
+ end
104
+
105
+ ##
106
+ # Builds the JSON index as a Hash.
107
+
108
+ def build_index
109
+ reset @store.all_files.sort, @store.all_classes_and_modules.sort
110
+
111
+ index_classes
112
+ index_methods
113
+ index_pages
114
+
115
+ { :index => @index }
116
+ end
117
+
118
+ ##
119
+ # Output progress information if debugging is enabled
120
+
121
+ def debug_msg(*msg)
122
+ return unless $DEBUG_RDOC
123
+ $stderr.puts(*msg)
124
+ end
125
+
126
+ ##
127
+ # Writes the JSON index to disk
128
+
129
+ def generate
130
+ debug_msg "Generating JSON index"
131
+
132
+ debug_msg " writing search index to %s" % SEARCH_INDEX_FILE
133
+ data = build_index
134
+
135
+ return if @options.dry_run
136
+
137
+ out_dir = @base_dir + @options.op_dir
138
+ index_file = out_dir + SEARCH_INDEX_FILE
139
+
140
+ FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC
141
+
142
+ index_file.open 'w', 0644 do |io|
143
+ io.set_encoding Encoding::UTF_8
144
+ io.write 'var search_data = '
145
+
146
+ JSON.dump data, io, 0
147
+ end
148
+ unless ENV['SOURCE_DATE_EPOCH'].nil?
149
+ index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime
150
+ end
151
+
152
+ Dir.chdir @template_dir do
153
+ Dir['**/*.js'].each do |source|
154
+ dest = File.join out_dir, source
155
+
156
+ FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC
157
+ end
158
+ end
159
+ end
160
+
161
+ ##
162
+ # Compress the search_index.js file using gzip
163
+
164
+ def generate_gzipped
165
+ return if @options.dry_run or not defined?(Zlib)
166
+
167
+ debug_msg "Compressing generated JSON index"
168
+ out_dir = @base_dir + @options.op_dir
169
+
170
+ search_index_file = out_dir + SEARCH_INDEX_FILE
171
+ outfile = out_dir + "#{search_index_file}.gz"
172
+
173
+ debug_msg "Reading the JSON index file from %s" % search_index_file
174
+ search_index = search_index_file.read(mode: 'r:utf-8')
175
+
176
+ debug_msg "Writing gzipped search index to %s" % outfile
177
+
178
+ Zlib::GzipWriter.open(outfile) do |gz|
179
+ gz.mtime = File.mtime(search_index_file)
180
+ gz.orig_name = search_index_file.basename.to_s
181
+ gz.write search_index
182
+ gz.close
183
+ end
184
+
185
+ # GZip the rest of the js files
186
+ Dir.chdir @template_dir do
187
+ Dir['**/*.js'].each do |source|
188
+ dest = out_dir + source
189
+ outfile = out_dir + "#{dest}.gz"
190
+
191
+ debug_msg "Reading the original js file from %s" % dest
192
+ data = dest.read
193
+
194
+ debug_msg "Writing gzipped file to %s" % outfile
195
+
196
+ Zlib::GzipWriter.open(outfile) do |gz|
197
+ gz.mtime = File.mtime(dest)
198
+ gz.orig_name = dest.basename.to_s
199
+ gz.write data
200
+ gz.close
201
+ end
202
+ end
203
+ end
204
+ end
205
+
206
+ ##
207
+ # Adds classes and modules to the index
208
+
209
+ def index_classes
210
+ debug_msg " generating class search index"
211
+
212
+ documented = @classes.uniq.select do |klass|
213
+ klass.document_self_or_methods
214
+ end
215
+
216
+ documented.each do |klass|
217
+ debug_msg " #{klass.full_name}"
218
+ record = klass.search_record
219
+ @index[:searchIndex] << search_string(record.shift)
220
+ @index[:longSearchIndex] << search_string(record.shift)
221
+ @index[:info] << record
222
+ end
223
+ end
224
+
225
+ ##
226
+ # Adds methods to the index
227
+
228
+ def index_methods
229
+ debug_msg " generating method search index"
230
+
231
+ list = @classes.uniq.flat_map do |klass|
232
+ klass.method_list
233
+ end.sort_by do |method|
234
+ [method.name, method.parent.full_name]
235
+ end
236
+
237
+ list.each do |method|
238
+ debug_msg " #{method.full_name}"
239
+ record = method.search_record
240
+ @index[:searchIndex] << "#{search_string record.shift}()"
241
+ @index[:longSearchIndex] << "#{search_string record.shift}()"
242
+ @index[:info] << record
243
+ end
244
+ end
245
+
246
+ ##
247
+ # Adds pages to the index
248
+
249
+ def index_pages
250
+ debug_msg " generating pages search index"
251
+
252
+ pages = @files.select do |file|
253
+ file.text? && file.full_name != @options.main_page
254
+ end
255
+
256
+ pages.each do |page|
257
+ debug_msg " #{page.page_name}"
258
+ record = page.search_record
259
+ @index[:searchIndex] << search_string(record.shift)
260
+ @index[:longSearchIndex] << ''
261
+ record.shift
262
+ @index[:info] << record
263
+ end
264
+ end
265
+
266
+ def reset(files, classes) # :nodoc:
267
+ @files = files
268
+ @classes = classes
269
+
270
+ @index = {
271
+ :searchIndex => [],
272
+ :longSearchIndex => [],
273
+ :info => []
274
+ }
275
+ end
276
+
277
+ ##
278
+ # Removes whitespace and downcases +string+
279
+
280
+ def search_string(string)
281
+ string.downcase.gsub(/\s/, '')
282
+ end
283
+
284
+ end
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Handle common RDoc::Markup tasks for various CodeObjects
4
+ #
5
+ # This module is loaded by generators. It allows RDoc's CodeObject tree to
6
+ # avoid loading generator code to improve startup time for +ri+.
7
+
8
+ module RDoc::Generator::Markup
9
+
10
+ ##
11
+ # Generates a relative URL from this object's path to +target_path+
12
+
13
+ def aref_to(target_path)
14
+ RDoc::Markup::ToHtml.gen_relative_url path, target_path
15
+ end
16
+
17
+ ##
18
+ # Generates a relative URL from +from_path+ to this object's path
19
+
20
+ def as_href(from_path)
21
+ RDoc::Markup::ToHtml.gen_relative_url from_path, path
22
+ end
23
+
24
+ ##
25
+ # Handy wrapper for marking up this object's comment
26
+
27
+ def description
28
+ markup @comment
29
+ end
30
+
31
+ ##
32
+ # Creates an RDoc::Markup::ToHtmlCrossref formatter
33
+
34
+ def formatter
35
+ return @formatter if defined? @formatter
36
+
37
+ options = @store.options
38
+ this = RDoc::Context === self ? self : @parent
39
+
40
+ @formatter = RDoc::Markup::ToHtmlCrossref.new(
41
+ this.path, this,
42
+ pipe: options.pipe,
43
+ output_decoration: options.output_decoration,
44
+ hyperlink_all: options.hyperlink_all,
45
+ show_hash: options.show_hash,
46
+ autolink_excluded_words: options.autolink_excluded_words || [],
47
+ warn_missing_rdoc_ref: options.warn_missing_rdoc_ref
48
+ )
49
+ @formatter.code_object = self
50
+ @formatter
51
+ end
52
+
53
+ ##
54
+ # Build a webcvs URL starting for the given +url+ with +full_path+ appended
55
+ # as the destination path. If +url+ contains '%s' +full_path+ will be
56
+ # will replace the %s using sprintf on the +url+.
57
+
58
+ def cvs_url(url, full_path)
59
+ if /%s/ =~ url then
60
+ sprintf url, full_path
61
+ else
62
+ url + full_path
63
+ end
64
+ end
65
+
66
+ ##
67
+ # The preferred URL for this object.
68
+
69
+ def canonical_url
70
+ options = @store.options
71
+ if path
72
+ File.join(options.canonical_root, path.to_s)
73
+ else
74
+ options.canonical_root
75
+ end
76
+ end
77
+
78
+ end
79
+
80
+ class RDoc::CodeObject
81
+
82
+ include RDoc::Generator::Markup
83
+
84
+ end
85
+
86
+ class RDoc::AnyMethod
87
+
88
+ ##
89
+ # Creates an HTML link to the superclass method called by this method.
90
+
91
+ def superclass_method_link
92
+ target = superclass_method
93
+ return unless target
94
+
95
+ html_formatter = formatter
96
+ name = target.full_name
97
+
98
+ html_formatter.link name, html_formatter.convert_string(name)
99
+ end
100
+
101
+ end
102
+
103
+ class RDoc::MethodAttr
104
+
105
+ ##
106
+ # Prepend +src+ with line numbers.
107
+
108
+ def add_line_numbers(src)
109
+ return if src.empty? || !line
110
+ start_line = line
111
+ end_line = start_line + src.count("\n")
112
+ number_digits = end_line.to_s.length
113
+
114
+ current_line = start_line
115
+ src.gsub!(/^/) do
116
+ res = "<span class=\"line-num\">#{current_line.to_s.rjust(number_digits)}</span> "
117
+
118
+ current_line += 1
119
+ res
120
+ end
121
+ end
122
+
123
+ ##
124
+ # Prepend +src+ with a comment that declares its location in the source.
125
+
126
+ def add_location_comment(src)
127
+ path = CGI.escapeHTML(file.relative_name)
128
+ if options.line_numbers && !src.empty?
129
+ src.prepend("<span class=\"ruby-comment\"># File #{path}</span>\n")
130
+ else
131
+ src.prepend("<span class=\"ruby-comment\"># File #{path}, line #{line}</span>\n")
132
+ end
133
+ end
134
+
135
+ ##
136
+ # Turns the method's token stream into HTML.
137
+ #
138
+ # Prepends line numbers if +options.line_numbers+ is true.
139
+
140
+ def markup_code
141
+ return '' if !@token_stream
142
+
143
+ src = RDoc::TokenStream.to_html @token_stream
144
+
145
+ # dedent the source
146
+ common_indent = src.length
147
+ src.scan(/^ *(?=\S)/) do |whitespace|
148
+ common_indent = whitespace.length if whitespace.length < common_indent
149
+ break if common_indent == 0
150
+ end
151
+ src.gsub!(/^#{' ' * common_indent}/, '') if common_indent > 0
152
+
153
+ if source_language == 'ruby'
154
+ add_line_numbers(src) if options.line_numbers
155
+ add_location_comment(src)
156
+ end
157
+
158
+ src
159
+ end
160
+
161
+ end
162
+
163
+ class RDoc::ClassModule
164
+
165
+ ##
166
+ # Handy wrapper for marking up this class or module's comment
167
+
168
+ def description
169
+ markup @comment_location
170
+ end
171
+
172
+ end
173
+
174
+ class RDoc::Context::Section
175
+
176
+ include RDoc::Generator::Markup
177
+
178
+ end
179
+
180
+ class RDoc::TopLevel
181
+
182
+ ##
183
+ # Returns a URL for this source file on some web repository. Use the -W
184
+ # command line option to set.
185
+
186
+ def cvs_url
187
+ url = @store.options.webcvs
188
+
189
+ if /%s/ =~ url then
190
+ url % @relative_name
191
+ else
192
+ url + @relative_name
193
+ end
194
+ end
195
+
196
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Extracts message from RDoc::Store
4
+
5
+ class RDoc::Generator::POT::MessageExtractor
6
+
7
+ ##
8
+ # Creates a message extractor for +store+.
9
+
10
+ def initialize(store)
11
+ @store = store
12
+ @po = RDoc::Generator::POT::PO.new
13
+ end
14
+
15
+ ##
16
+ # Extracts messages from +store+, stores them into
17
+ # RDoc::Generator::POT::PO and returns it.
18
+
19
+ def extract
20
+ @store.all_classes_and_modules.each do |klass|
21
+ extract_from_klass(klass)
22
+ end
23
+ @po
24
+ end
25
+
26
+ private
27
+
28
+ def extract_from_klass(klass)
29
+ extract_text(klass.comment_location, klass.full_name)
30
+
31
+ klass.each_section do |section, constants, attributes|
32
+ extract_text(section.title, "#{klass.full_name}: section title")
33
+ section.comments.each do |comment|
34
+ extract_text(comment, "#{klass.full_name}: #{section.title}")
35
+ end
36
+ end
37
+
38
+ klass.constants.each do |constant|
39
+ extract_text(constant.comment, constant.full_name)
40
+ end
41
+
42
+ klass.attributes.each do |attribute|
43
+ extract_text(attribute.comment, attribute.full_name)
44
+ end
45
+
46
+ klass.each_method do |method|
47
+ extract_text(method.comment, method.full_name)
48
+ end
49
+ end
50
+
51
+ def extract_text(text, comment, location = nil)
52
+ return if text.nil?
53
+
54
+ options = {
55
+ :extracted_comment => comment,
56
+ :references => [location].compact,
57
+ }
58
+ i18n_text = RDoc::I18n::Text.new(text)
59
+ i18n_text.extract_messages do |part|
60
+ @po.add(entry(part[:paragraph], options))
61
+ end
62
+ end
63
+
64
+ def entry(msgid, options)
65
+ RDoc::Generator::POT::POEntry.new(msgid, options)
66
+ end
67
+
68
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Generates a PO format text
4
+
5
+ class RDoc::Generator::POT::PO
6
+
7
+ ##
8
+ # Creates an object that represents PO format.
9
+
10
+ def initialize
11
+ @entries = {}
12
+ add_header
13
+ end
14
+
15
+ ##
16
+ # Adds a PO entry to the PO.
17
+
18
+ def add(entry)
19
+ existing_entry = @entries[entry.msgid]
20
+ if existing_entry
21
+ entry = existing_entry.merge(entry)
22
+ end
23
+ @entries[entry.msgid] = entry
24
+ end
25
+
26
+ ##
27
+ # Returns PO format text for the PO.
28
+
29
+ def to_s
30
+ po = ''
31
+ sort_entries.each do |entry|
32
+ po += "\n" unless po.empty?
33
+ po += entry.to_s
34
+ end
35
+ po
36
+ end
37
+
38
+ private
39
+
40
+ def add_header
41
+ add(header_entry)
42
+ end
43
+
44
+ def header_entry
45
+ comment = <<-COMMENT
46
+ SOME DESCRIPTIVE TITLE.
47
+ Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
48
+ This file is distributed under the same license as the PACKAGE package.
49
+ FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
50
+ COMMENT
51
+
52
+ content = <<-CONTENT
53
+ Project-Id-Version: PACKAGE VERSEION
54
+ Report-Msgid-Bugs-To:
55
+ PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE
56
+ Last-Translator: FULL NAME <EMAIL@ADDRESS>
57
+ Language-Team: LANGUAGE <LL@li.org>
58
+ Language:
59
+ MIME-Version: 1.0
60
+ Content-Type: text/plain; charset=CHARSET
61
+ Content-Transfer-Encoding: 8bit
62
+ Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;
63
+ CONTENT
64
+
65
+ options = {
66
+ :msgstr => content,
67
+ :translator_comment => comment,
68
+ :flags => ['fuzzy'],
69
+ }
70
+ RDoc::Generator::POT::POEntry.new('', options)
71
+ end
72
+
73
+ def sort_entries
74
+ headers, messages = @entries.values.partition do |entry|
75
+ entry.msgid.empty?
76
+ end
77
+ # TODO: sort by location
78
+ sorted_messages = messages.sort_by do |entry|
79
+ entry.msgid
80
+ end
81
+ headers + sorted_messages
82
+ end
83
+
84
+ end