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,379 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # A ChangeLog file parser.
5
+ #
6
+ # This parser converts a ChangeLog into an RDoc::Markup::Document. When
7
+ # viewed as HTML a ChangeLog page will have an entry for each day's entries in
8
+ # the sidebar table of contents.
9
+ #
10
+ # This parser is meant to parse the MRI ChangeLog, but can be used to parse any
11
+ # {GNU style Change
12
+ # Log}[http://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html].
13
+
14
+ class RDoc::Parser::ChangeLog < RDoc::Parser
15
+
16
+ include RDoc::Parser::Text
17
+
18
+ parse_files_matching(/(\/|\\|\A)ChangeLog[^\/\\]*\z/)
19
+
20
+ ##
21
+ # Attaches the +continuation+ of the previous line to the +entry_body+.
22
+ #
23
+ # Continued function listings are joined together as a single entry.
24
+ # Continued descriptions are joined to make a single paragraph.
25
+
26
+ def continue_entry_body(entry_body, continuation)
27
+ return unless last = entry_body.last
28
+
29
+ if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
30
+ last.sub!(/\)\s*\z/, ',')
31
+ continuation = continuation.sub(/\A\(/, '')
32
+ end
33
+
34
+ if last =~ /\s\z/ then
35
+ last << continuation
36
+ else
37
+ last << ' ' + continuation
38
+ end
39
+ end
40
+
41
+ ##
42
+ # Creates an RDoc::Markup::Document given the +groups+ of ChangeLog entries.
43
+
44
+ def create_document(groups)
45
+ doc = RDoc::Markup::Document.new
46
+ doc.omit_headings_below = 2
47
+ doc.file = @top_level
48
+
49
+ doc << RDoc::Markup::Heading.new(1, File.basename(@file_name))
50
+ doc << RDoc::Markup::BlankLine.new
51
+
52
+ groups.sort_by do |day,| day end.reverse_each do |day, entries|
53
+ doc << RDoc::Markup::Heading.new(2, day.dup)
54
+ doc << RDoc::Markup::BlankLine.new
55
+
56
+ doc.concat create_entries entries
57
+ end
58
+
59
+ doc
60
+ end
61
+
62
+ ##
63
+ # Returns a list of ChangeLog entries an RDoc::Markup nodes for the given
64
+ # +entries+.
65
+
66
+ def create_entries(entries)
67
+ out = []
68
+
69
+ entries.each do |entry, items|
70
+ out << RDoc::Markup::Heading.new(3, entry)
71
+ out << RDoc::Markup::BlankLine.new
72
+
73
+ out << create_items(items)
74
+ end
75
+
76
+ out
77
+ end
78
+
79
+ ##
80
+ # Returns an RDoc::Markup::List containing the given +items+ in the
81
+ # ChangeLog
82
+
83
+ def create_items(items)
84
+ list = RDoc::Markup::List.new :NOTE
85
+
86
+ items.each do |item|
87
+ item =~ /\A(.*?(?:\([^)]+\))?):\s*/
88
+
89
+ title = $1
90
+ body = $'
91
+
92
+ paragraph = RDoc::Markup::Paragraph.new body
93
+ list_item = RDoc::Markup::ListItem.new title, paragraph
94
+ list << list_item
95
+ end
96
+
97
+ list
98
+ end
99
+
100
+ ##
101
+ # Groups +entries+ by date.
102
+
103
+ def group_entries(entries)
104
+ @time_cache ||= {}
105
+ entries.group_by do |title, _|
106
+ begin
107
+ time = @time_cache[title]
108
+ (time || parse_date(title)).strftime '%Y-%m-%d'
109
+ rescue NoMethodError, ArgumentError
110
+ time, = title.split ' ', 2
111
+ parse_date(time).strftime '%Y-%m-%d'
112
+ end
113
+ end
114
+ end
115
+
116
+ ##
117
+ # Parse date in ISO-8601, RFC-2822, or default of Git
118
+
119
+ def parse_date(date)
120
+ case date
121
+ when /\A\s*(\d+)-(\d+)-(\d+)(?:[ T](\d+):(\d+):(\d+) *([-+]\d\d):?(\d\d))?\b/
122
+ Time.new($1, $2, $3, $4, $5, $6, ("#{$7}:#{$8}" if $7))
123
+ when /\A\s*\w{3}, +(\d+) (\w{3}) (\d+) (\d+):(\d+):(\d+) *(?:([-+]\d\d):?(\d\d))\b/
124
+ Time.new($3, $2, $1, $4, $5, $6, ("#{$7}:#{$8}" if $7))
125
+ when /\A\s*\w{3} (\w{3}) +(\d+) (\d+) (\d+):(\d+):(\d+) *(?:([-+]\d\d):?(\d\d))\b/
126
+ Time.new($3, $1, $2, $4, $5, $6, ("#{$7}:#{$8}" if $7))
127
+ when /\A\s*\w{3} (\w{3}) +(\d+) (\d+):(\d+):(\d+) (\d+)\b/
128
+ Time.new($6, $1, $2, $3, $4, $5)
129
+ else
130
+ raise ArgumentError, "bad date: #{date}"
131
+ end
132
+ end
133
+
134
+ ##
135
+ # Parses the entries in the ChangeLog.
136
+ #
137
+ # Returns an Array of each ChangeLog entry in order of parsing.
138
+ #
139
+ # A ChangeLog entry is an Array containing the ChangeLog title (date and
140
+ # committer) and an Array of ChangeLog items (file and function changed with
141
+ # description).
142
+ #
143
+ # An example result would be:
144
+ #
145
+ # [ 'Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>',
146
+ # [ 'README.EXT: Converted to RDoc format',
147
+ # 'README.EXT.ja: ditto']]
148
+
149
+ def parse_entries
150
+ @time_cache ||= {}
151
+
152
+ if /\A((?:.*\n){,3})commit\s/ =~ @content
153
+ class << self; prepend Git; end
154
+ parse_info($1)
155
+ return parse_entries
156
+ end
157
+
158
+ entries = []
159
+ entry_name = nil
160
+ entry_body = []
161
+
162
+ @content.each_line do |line|
163
+ case line
164
+ when /^\s*$/ then
165
+ next
166
+ when /^\w.*/ then
167
+ entries << [entry_name, entry_body] if entry_name
168
+
169
+ entry_name = $&
170
+
171
+ begin
172
+ time = parse_date entry_name
173
+ @time_cache[entry_name] = time
174
+ rescue ArgumentError
175
+ entry_name = nil
176
+ end
177
+
178
+ entry_body = []
179
+ when /^(\t| {8})?\*\s*(.*)/ then # "\t* file.c (func): ..."
180
+ entry_body << $2.dup
181
+ when /^(\t| {8})?\s*(\(.*)/ then # "\t(func): ..."
182
+ entry = $2
183
+
184
+ if entry_body.last =~ /:/ then
185
+ entry_body << entry.dup
186
+ else
187
+ continue_entry_body entry_body, entry
188
+ end
189
+ when /^(\t| {8})?\s*(.*)/ then
190
+ continue_entry_body entry_body, $2
191
+ end
192
+ end
193
+
194
+ entries << [entry_name, entry_body] if entry_name
195
+
196
+ entries.reject! do |(entry, _)|
197
+ entry == nil
198
+ end
199
+
200
+ entries
201
+ end
202
+
203
+ ##
204
+ # Converts the ChangeLog into an RDoc::Markup::Document
205
+
206
+ def scan
207
+ @time_cache = {}
208
+
209
+ entries = parse_entries
210
+ grouped_entries = group_entries entries
211
+
212
+ doc = create_document grouped_entries
213
+ comment = RDoc::Comment.new(@content)
214
+ comment.document = doc
215
+ @top_level.comment = comment
216
+
217
+ @top_level
218
+ end
219
+
220
+ ##
221
+ # The extension for Git commit log
222
+
223
+ module Git
224
+ ##
225
+ # Parses auxiliary info. Currently `base-url` to expand
226
+ # references is effective.
227
+
228
+ def parse_info(info)
229
+ /^\s*base-url\s*=\s*(.*\S)/ =~ info
230
+ @base_url = $1
231
+ end
232
+
233
+ ##
234
+ # Parses the entries in the Git commit logs
235
+
236
+ def parse_entries
237
+ entries = []
238
+
239
+ @content.scan(/^commit\s+(\h{20})\h*\n((?:.+\n)*)\n((?: {4}.*\n+)*)/) do
240
+ entry_name, header, entry_body = $1, $2, $3.gsub(/^ {4}/, '')
241
+ # header = header.scan(/^ *(\S+?): +(.*)/).to_h
242
+ # date = header["CommitDate"] || header["Date"]
243
+ date = header[/^ *(?:Author)?Date: +(.*)/, 1]
244
+ author = header[/^ *Author: +(.*)/, 1]
245
+ begin
246
+ time = parse_date(header[/^ *CommitDate: +(.*)/, 1] || date)
247
+ @time_cache[entry_name] = time
248
+ author.sub!(/\s*<(.*)>/, '')
249
+ email = $1
250
+ entries << [entry_name, [author, email, date, entry_body]]
251
+ rescue ArgumentError
252
+ end
253
+ end
254
+
255
+ entries
256
+ end
257
+
258
+ ##
259
+ # Returns a list of ChangeLog entries as
260
+ # RDoc::Parser::ChangeLog::Git::LogEntry list for the given
261
+ # +entries+.
262
+
263
+ def create_entries(entries)
264
+ # git log entries have no strictly itemized style like the old
265
+ # style, just assume Markdown.
266
+ entries.map do |commit, entry|
267
+ LogEntry.new(@base_url, commit, *entry)
268
+ end
269
+ end
270
+
271
+ LogEntry = Struct.new(:base, :commit, :author, :email, :date, :contents) do
272
+ HEADING_LEVEL = 3
273
+
274
+ def initialize(base, commit, author, email, date, contents)
275
+ case contents
276
+ when String
277
+ if base&.match(%r[\A([^:/]+:/+[^/]+/)[^/]+/[^/]+/])
278
+ repo, host = $&, $1
279
+ contents = contents.dup
280
+ # base: https://github.com/ruby/ruby/
281
+ # Fix #15791 -> Fix [#15791](https://github.com/ruby/ruby/pull/15791)
282
+ # GH-15791 -> [GH-15791](https://github.com/ruby/ruby/pull/15791)
283
+ # (#15791) -> ([#15791](https://github.com/ruby/ruby/pull/15791))
284
+ contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K\#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do
285
+ "[#{$&}](#{repo}pull/#{$1 || $2 || $3})"
286
+ end
287
+ # repo#PR, repo@HASH
288
+ # ruby/ruby#15791 -> [ruby/ruby#15791](https://github.com/ruby/ruby/pull/15791)
289
+ # ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/ruby/commit/a8a989b6)
290
+ # ref in branckets is not extended
291
+ # [ruby/net-imap#543][ruby/ruby#15791] -> [ruby/net-imap#543][ruby/ruby#15791]
292
+ contents.gsub!(%r[(?<![-\w#/@]|\]\[)([-\w]+/[-\w]+)(?:@(\h{8,40})|\#(\d+))(?![-\w#/@]|\]\[)]) do
293
+ path = defined?($2) ? "commit/#{$2}" : "pull/#{$3}"
294
+ "[#{$&}](#{host}#{$1}/#{path})"
295
+ end
296
+ end
297
+
298
+ contents = RDoc::Markdown.parse(contents).parts.each do |body|
299
+ case body
300
+ when RDoc::Markup::Heading
301
+ body.level += HEADING_LEVEL + 1
302
+ end
303
+ end
304
+ case first = contents[0]
305
+ when RDoc::Markup::Paragraph
306
+ contents[0] = RDoc::Markup::Heading.new(HEADING_LEVEL + 1, first.text)
307
+ end
308
+ end
309
+ super
310
+ end
311
+
312
+ def level
313
+ HEADING_LEVEL
314
+ end
315
+
316
+ def aref
317
+ commit
318
+ end
319
+
320
+ def legacy_aref
321
+ "label-#{commit}"
322
+ end
323
+
324
+ def label(context = nil)
325
+ aref
326
+ end
327
+
328
+ def legacy_label(context = nil)
329
+ legacy_aref
330
+ end
331
+
332
+ def text
333
+ case base
334
+ when nil
335
+ "#{date}"
336
+ when /%s/
337
+ "{#{date}}[#{base % commit}]"
338
+ else
339
+ "{#{date}}[#{base}#{commit}]"
340
+ end + " {#{author}}[mailto:#{email}]"
341
+ end
342
+
343
+ def accept(visitor)
344
+ visitor.accept_heading self
345
+ begin
346
+ if visitor.respond_to?(:code_object=)
347
+ code_object = visitor.code_object
348
+ visitor.code_object = self
349
+ end
350
+ contents.each do |body|
351
+ body.accept visitor
352
+ end
353
+ ensure
354
+ if visitor.respond_to?(:code_object)
355
+ visitor.code_object = code_object
356
+ end
357
+ end
358
+ end
359
+
360
+ def pretty_print(q) # :nodoc:
361
+ q.group(2, '[log_entry: ', ']') do
362
+ q.text commit
363
+ q.text ','
364
+ q.breakable
365
+ q.group(2, '[date: ', ']') { q.text date }
366
+ q.text ','
367
+ q.breakable
368
+ q.group(2, '[author: ', ']') { q.text author }
369
+ q.text ','
370
+ q.breakable
371
+ q.group(2, '[email: ', ']') { q.text email }
372
+ q.text ','
373
+ q.breakable
374
+ q.pp contents
375
+ end
376
+ end
377
+ end
378
+ end
379
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Parse a Markdown format file. The parsed RDoc::Markup::Document is attached
4
+ # as a file comment.
5
+
6
+ class RDoc::Parser::Markdown < RDoc::Parser
7
+
8
+ include RDoc::Parser::Text
9
+
10
+ parse_files_matching(/\.(md|markdown)(?:\.[^.]+)?$/)
11
+
12
+ ##
13
+ # Creates an Markdown-format TopLevel for the given file.
14
+
15
+ def scan
16
+ comment = RDoc::Comment.new @content, @top_level
17
+ comment.format = 'markdown'
18
+
19
+ @top_level.comment = comment
20
+ end
21
+
22
+ end
@@ -0,0 +1,275 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rbs'
4
+
5
+ ##
6
+ # Parse RBS signature files as first-class RDoc input.
7
+
8
+ class RDoc::Parser::RBS < RDoc::Parser
9
+ RBS_FILE_EXTENSION = /\.rbs$/
10
+
11
+ parse_files_matching RBS_FILE_EXTENSION
12
+
13
+ def scan
14
+ _, _, decls = ::RBS::Parser.parse_signature(@content)
15
+ decls.each do |decl|
16
+ parse_decl decl, @top_level
17
+ end
18
+ @top_level
19
+ end
20
+
21
+ private
22
+
23
+ def record_object_location(object, location)
24
+ object.line = location.start_line if location
25
+
26
+ if RDoc::ClassModule === object
27
+ @top_level.add_to_classes_or_modules object unless
28
+ @top_level.classes_or_modules.include? object
29
+ end
30
+
31
+ object.record_location @top_level
32
+ object
33
+ end
34
+
35
+ def rdoc_comment_for(decl)
36
+ rbs_comment = decl.comment if decl.respond_to?(:comment)
37
+ return unless rbs_comment
38
+
39
+ # TODO: Run RBS comments through RDoc's directive preprocessor so
40
+ # directives like :nodoc: affect the documented object.
41
+ comment = RDoc::Comment.new rbs_comment.string, @top_level
42
+ comment.format = 'markdown'
43
+ comment
44
+ end
45
+
46
+ def local_module_name(type_name, context)
47
+ name = type_name.to_s
48
+ return name if name.start_with?('::')
49
+
50
+ namespace_names = context == @top_level ? [] : context.full_name.split('::')
51
+
52
+ namespace_names.length.downto(1) do |length|
53
+ qualified_name = namespace_names.take(length).join('::')
54
+ if module_name = @top_level.find_module_named("#{qualified_name}::#{name}")
55
+ return module_name.full_name
56
+ end
57
+ end
58
+
59
+ name
60
+ end
61
+
62
+ def merge_documentation(object, comment, type_signature_lines)
63
+ if comment
64
+ object.comment = if object.comment.empty?
65
+ comment
66
+ else
67
+ merge_comments object, comment
68
+ end
69
+ end
70
+
71
+ # TODO: Track RBS-owned documentation overlays so incremental reparsing can
72
+ # replace stale comments and signatures from the previous RBS parse.
73
+ object.type_signature_lines ||= type_signature_lines
74
+ end
75
+
76
+ def merge_comments(object, comment)
77
+ document = RDoc::Markup::Document.new
78
+ document.concat object.parse(object.comment).parts
79
+ document << RDoc::Markup::Rule.new(1)
80
+ document.concat comment.parse.parts
81
+
82
+ # Keep this text separator in sync with the Rule node above.
83
+ merged_comment = RDoc::Comment.new "#{object.comment}\n---\n#{comment}", comment.location
84
+ merged_comment.format = 'markdown'
85
+ merged_comment.document = document
86
+ merged_comment
87
+ end
88
+
89
+ def attr_rw_matches?(existing_rw, new_rw)
90
+ existing_rw.each_char.any? { |rw| new_rw.include? rw }
91
+ end
92
+
93
+ def merge_attribute_methods(context, name, rw, singleton, comment, type_signature_lines)
94
+ method_names = []
95
+ method_names << name if rw.include?('R')
96
+ method_names << "#{name}=" if rw.include?('W')
97
+
98
+ methods = method_names.map { |method_name| context.find_method(method_name, singleton) }
99
+ methods.compact.each do |method|
100
+ merge_documentation method, comment, type_signature_lines
101
+ end
102
+
103
+ methods.any?
104
+ end
105
+
106
+ def rdoc_method_name(decl)
107
+ rbs_constructor_decl?(decl) ? 'new' : decl.name.to_s
108
+ end
109
+
110
+ def rdoc_method_singleton?(decl)
111
+ # TODO: RBS `self?` methods are :singleton_instance and should add both a
112
+ # singleton method and a private instance method.
113
+ rbs_constructor_decl?(decl) || decl.singleton?
114
+ end
115
+
116
+ def rdoc_method_visibility(decl)
117
+ rbs_constructor_decl?(decl) ? :public : decl.visibility
118
+ end
119
+
120
+ def rbs_constructor_decl?(decl)
121
+ decl.kind == :instance && decl.name == :initialize
122
+ end
123
+
124
+ def parse_attr_decl(decl, context)
125
+ rw = case decl
126
+ when ::RBS::AST::Members::AttrReader
127
+ 'R'
128
+ when ::RBS::AST::Members::AttrWriter
129
+ 'W'
130
+ when ::RBS::AST::Members::AttrAccessor
131
+ 'RW'
132
+ end
133
+
134
+ comment = rdoc_comment_for decl
135
+ type_signature_lines = [decl.type.to_s]
136
+ name = decl.name.to_s
137
+ singleton = decl.kind == :singleton
138
+ if attribute = context.find_attribute(name, singleton)
139
+ merge_documentation attribute, comment, type_signature_lines if
140
+ attr_rw_matches? attribute.rw, rw
141
+ return
142
+ end
143
+
144
+ if merge_attribute_methods(context, name, rw, singleton, comment, type_signature_lines)
145
+ return
146
+ end
147
+
148
+ attribute = RDoc::Attr.new(
149
+ name,
150
+ rw,
151
+ comment,
152
+ singleton: singleton
153
+ )
154
+ record_object_location attribute, decl.location
155
+ attribute.type_signature_lines = type_signature_lines
156
+ context.add_attribute attribute
157
+ attribute.visibility = decl.visibility if decl.visibility
158
+ end
159
+
160
+ def parse_class_decl(decl, context)
161
+ owner, name = context.find_or_create_constant_owner_for_path decl.name
162
+ superclass = decl.super_class&.name&.to_s || '::Object'
163
+ klass = owner.add_class RDoc::NormalClass, name, superclass
164
+ record_object_location klass, decl.location
165
+ comment = rdoc_comment_for decl
166
+ klass.add_comment comment, @top_level if comment
167
+
168
+ decl.members.each { |member| parse_decl member, klass }
169
+ end
170
+
171
+ def parse_constant_decl(decl, context)
172
+ constant = RDoc::Constant.new decl.name.to_s, decl.type.to_s,
173
+ rdoc_comment_for(decl)
174
+ record_object_location constant, decl.location
175
+ context.add_constant constant
176
+ end
177
+
178
+ def parse_decl(decl, context)
179
+ case decl
180
+ when ::RBS::AST::Declarations::Class
181
+ parse_class_decl decl, context
182
+ when ::RBS::AST::Declarations::Module, ::RBS::AST::Declarations::Interface
183
+ parse_module_decl decl, context
184
+ when ::RBS::AST::Declarations::ClassAlias,
185
+ ::RBS::AST::Declarations::ModuleAlias
186
+ # TODO: Add RBS class and module aliases to the RDoc store.
187
+ nil
188
+ else
189
+ parse_member_decl decl, context
190
+ end
191
+ end
192
+
193
+ def parse_extend_decl(decl, context)
194
+ extend_decl = RDoc::Extend.new local_module_name(decl.name, context),
195
+ rdoc_comment_for(decl)
196
+ record_object_location extend_decl, decl.location
197
+ context.add_extend extend_decl
198
+ end
199
+
200
+ def parse_include_decl(decl, context)
201
+ include_decl = RDoc::Include.new local_module_name(decl.name, context),
202
+ rdoc_comment_for(decl)
203
+ record_object_location include_decl, decl.location
204
+ context.add_include include_decl
205
+ end
206
+
207
+ def parse_member_decl(decl, context)
208
+ case decl
209
+ when ::RBS::AST::Declarations::Constant
210
+ parse_constant_decl decl, context
211
+ when ::RBS::AST::Members::MethodDefinition
212
+ parse_method_decl decl, context
213
+ when ::RBS::AST::Members::Alias
214
+ parse_method_alias_decl decl, context
215
+ when ::RBS::AST::Members::AttrReader,
216
+ ::RBS::AST::Members::AttrWriter,
217
+ ::RBS::AST::Members::AttrAccessor
218
+ parse_attr_decl decl, context
219
+ when ::RBS::AST::Members::Include
220
+ parse_include_decl decl, context
221
+ when ::RBS::AST::Members::Extend
222
+ parse_extend_decl decl, context
223
+ when ::RBS::AST::Members::Private,
224
+ ::RBS::AST::Members::Public
225
+ # TODO: Track standalone RBS visibility members.
226
+ nil
227
+ end
228
+ end
229
+
230
+ def parse_method_alias_decl(decl, context)
231
+ alias_def = RDoc::Alias.new(
232
+ decl.old_name.to_s,
233
+ decl.new_name.to_s,
234
+ rdoc_comment_for(decl),
235
+ singleton: decl.kind == :singleton
236
+ )
237
+ record_object_location alias_def, decl.location
238
+ context.add_alias alias_def
239
+ end
240
+
241
+ def parse_method_decl(decl, context)
242
+ comment = rdoc_comment_for decl
243
+ type_signature_lines = decl.overloads.map { |overload| overload.method_type.to_s }
244
+ method_name = rdoc_method_name(decl)
245
+ singleton = rdoc_method_singleton?(decl)
246
+ visibility = rdoc_method_visibility(decl)
247
+
248
+ if method = context.find_method(method_name, singleton)
249
+ merge_documentation method, comment, type_signature_lines
250
+ return
251
+ end
252
+
253
+ method = RDoc::AnyMethod.new method_name, singleton: singleton
254
+ record_object_location method, decl.location
255
+ method.type_signature_lines = type_signature_lines
256
+
257
+ if loc = decl.location
258
+ method.start_collecting_tokens :ruby
259
+ method.add_token line_no: loc.start_line, char_no: 1, text: loc.source
260
+ end
261
+
262
+ method.comment = comment if comment
263
+ context.add_method method
264
+ method.visibility = visibility if visibility
265
+ end
266
+
267
+ def parse_module_decl(decl, context)
268
+ mod = context.add_module RDoc::NormalModule, decl.name.to_s
269
+ record_object_location mod, decl.location
270
+ comment = rdoc_comment_for decl
271
+ mod.add_comment comment, @top_level if comment
272
+
273
+ decl.members.each { |member| parse_decl member, mod }
274
+ end
275
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Parse a RD format file. The parsed RDoc::Markup::Document is attached as a
4
+ # file comment.
5
+
6
+ class RDoc::Parser::RD < RDoc::Parser
7
+
8
+ include RDoc::Parser::Text
9
+
10
+ parse_files_matching(/\.rd(?:\.[^.]+)?$/)
11
+
12
+ ##
13
+ # Creates an rd-format TopLevel for the given file.
14
+
15
+ def scan
16
+ comment = RDoc::Comment.new @content, @top_level
17
+ comment.format = 'rd'
18
+
19
+ @top_level.comment = comment
20
+ end
21
+
22
+ end