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,353 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # A comment holds the text comment for a RDoc::CodeObject and provides a
4
+ # unified way of cleaning it up and parsing it into an RDoc::Markup::Document.
5
+ #
6
+ # Each comment may have a different markup format set by #format=. By default
7
+ # 'rdoc' is used. The :markup: directive tells RDoc which format to use.
8
+ #
9
+ # See {RDoc Markup Reference}[rdoc-ref:doc/markup_reference/rdoc.rdoc@Directive+for+Specifying+RDoc+Source+Format].
10
+
11
+
12
+ class RDoc::Comment
13
+
14
+ include RDoc::Text
15
+
16
+ ##
17
+ # The format of this comment. Defaults to RDoc::Markup
18
+
19
+ attr_reader :format
20
+
21
+ ##
22
+ # The RDoc::TopLevel this comment was found in
23
+
24
+ attr_accessor :location
25
+
26
+ ##
27
+ # Line where this Comment was written
28
+
29
+ attr_accessor :line
30
+
31
+ ##
32
+ # For duck-typing when merging classes at load time
33
+
34
+ alias file location # :nodoc:
35
+
36
+ ##
37
+ # The text for this comment
38
+
39
+ attr_reader :text
40
+
41
+ ##
42
+ # Alias for text
43
+
44
+ alias to_s text
45
+
46
+ ##
47
+ # Overrides the content returned by #parse. Use when there is no #text
48
+ # source for this comment
49
+
50
+ attr_writer :document
51
+
52
+ ##
53
+ # Creates a new comment with +text+ that is found in the RDoc::TopLevel
54
+ # +location+.
55
+
56
+ def initialize(text = nil, location = nil, language = nil)
57
+ @location = location
58
+ @text = text.nil? ? nil : text.dup
59
+ @language = language
60
+
61
+ @document = nil
62
+ @format = 'rdoc'
63
+ @normalized = false
64
+ end
65
+
66
+ ##
67
+ #--
68
+ # TODO deep copy @document
69
+
70
+ def initialize_copy(copy) # :nodoc:
71
+ @text = copy.text.dup
72
+ end
73
+
74
+ def ==(other) # :nodoc:
75
+ self.class === other and
76
+ other.text == @text and other.location == @location
77
+ end
78
+
79
+ ##
80
+ # A comment is empty if its text String is empty.
81
+
82
+ def empty?
83
+ @text.empty? && (@document.nil? || @document.empty?)
84
+ end
85
+
86
+ ##
87
+ # HACK dubious
88
+
89
+ def encode!(encoding)
90
+ @text = String.new @text, encoding: encoding
91
+ self
92
+ end
93
+
94
+ ##
95
+ # Sets the format of this comment and resets any parsed document
96
+
97
+ def format=(format)
98
+ @format = format
99
+ @document = nil
100
+ end
101
+
102
+ def inspect # :nodoc:
103
+ location = @location ? @location.relative_name : '(unknown)'
104
+
105
+ "#<%s:%x %s %p>" % [self.class, object_id, location, @text]
106
+ end
107
+
108
+ ##
109
+ # Normalizes the text. See RDoc::Text#normalize_comment for details
110
+
111
+ def normalize
112
+ return self unless @text
113
+ return self if @normalized # TODO eliminate duplicate normalization
114
+
115
+ @text = normalize_comment @text
116
+
117
+ @normalized = true
118
+
119
+ self
120
+ end
121
+
122
+ # Change normalized, when creating already normalized comment.
123
+
124
+ def normalized=(value)
125
+ @normalized = value
126
+ end
127
+
128
+ ##
129
+ # Was this text normalized?
130
+
131
+ def normalized? # :nodoc:
132
+ @normalized
133
+ end
134
+
135
+ ##
136
+ # Parses the comment into an RDoc::Markup::Document. The parsed document is
137
+ # cached until the text is changed.
138
+
139
+ def parse
140
+ return @document if @document
141
+
142
+ @document = super @text, @format
143
+ @document.file = @location
144
+ @document
145
+ end
146
+
147
+ ##
148
+ # Replaces this comment's text with +text+ and resets the parsed document.
149
+ #
150
+ # An error is raised if the comment contains a document but no text.
151
+
152
+ def text=(text)
153
+ raise RDoc::Error, 'replacing document-only comment is not allowed' if
154
+ @text.nil? and @document
155
+
156
+ @document = nil
157
+ @text = text.nil? ? nil : text.dup
158
+ end
159
+
160
+ ##
161
+ # Returns true if this comment is in TomDoc format.
162
+
163
+ def tomdoc?
164
+ @format == 'tomdoc'
165
+ end
166
+
167
+ MULTILINE_DIRECTIVES = %w[call-seq].freeze # :nodoc:
168
+
169
+ # There are more, but already handled by RDoc::Parser::C
170
+ COLON_LESS_DIRECTIVES = %w[call-seq Document-method].freeze # :nodoc:
171
+
172
+ DIRECTIVE_OR_ESCAPED_DIRECTIV_REGEXP = /\A(?<colon>\\?:|:?)(?<directive>[\w-]+):(?<param>.*)/
173
+
174
+ private_constant :MULTILINE_DIRECTIVES, :COLON_LESS_DIRECTIVES, :DIRECTIVE_OR_ESCAPED_DIRECTIV_REGEXP
175
+
176
+ class << self
177
+
178
+ ##
179
+ # Create a new parsed comment from a document
180
+
181
+ def from_document(document) # :nodoc:
182
+ comment = RDoc::Comment.new('')
183
+ comment.document = document
184
+ comment.location = RDoc::TopLevel.new(document.file) if document.file
185
+ comment
186
+ end
187
+
188
+ # Parse comment, collect directives as an attribute and return [normalized_comment_text, directives_hash]
189
+ # This method expands include and removes everything not needed in the document text, such as
190
+ # private section, directive line, comment characters `# /* * */` and indent spaces.
191
+ #
192
+ # RDoc comment consists of include, directive, multiline directive, private section and comment text.
193
+ #
194
+ # Include
195
+ # # :include: filename
196
+ #
197
+ # Directive
198
+ # # :directive-without-value:
199
+ # # :directive-with-value: value
200
+ #
201
+ # Multiline directive (only :call-seq:)
202
+ # # :multiline-directive:
203
+ # # value1
204
+ # # value2
205
+ #
206
+ # Private section
207
+ # #--
208
+ # # private comment
209
+ # #++
210
+
211
+ def parse(text, filename, line_no, type, &include_callback)
212
+ case type
213
+ when :ruby
214
+ text = text.gsub(/^#+/, '') if text.start_with?('#')
215
+ private_start_regexp = /^-{2,}$/
216
+ private_end_regexp = /^\+{2}$/
217
+ indent_regexp = /^\s*/
218
+ when :c
219
+ private_start_regexp = /^(\s*\*)?-{2,}$/
220
+ private_end_regexp = /^(\s*\*)?\+{2}$/
221
+ indent_regexp = /^\s*(\/\*+|\*)?\s*/
222
+ text = text.gsub(/\s*\*+\/\s*\z/, '')
223
+ when :simple
224
+ # Unlike other types, this implementation only looks for two dashes at
225
+ # the beginning of the line. Three or more dashes are considered to be
226
+ # a rule and ignored.
227
+ private_start_regexp = /^-{2}$/
228
+ private_end_regexp = /^\+{2}$/
229
+ indent_regexp = /^\s*/
230
+ end
231
+
232
+ directives = {}
233
+ lines = text.split("\n")
234
+ in_private = false
235
+ comment_lines = []
236
+ until lines.empty?
237
+ line = lines.shift
238
+ read_lines = 1
239
+ if in_private
240
+ # If `++` appears in a private section that starts with `--`, private section ends.
241
+ in_private = false if line.match?(private_end_regexp)
242
+ line_no += read_lines
243
+ next
244
+ elsif line.match?(private_start_regexp)
245
+ # If `--` appears in a line, private section starts.
246
+ in_private = true
247
+ line_no += read_lines
248
+ next
249
+ end
250
+
251
+ prefix = line[indent_regexp]
252
+ prefix_indent = ' ' * prefix.size
253
+ line = line.byteslice(prefix.bytesize..)
254
+
255
+ if (directive_match = DIRECTIVE_OR_ESCAPED_DIRECTIV_REGEXP.match(line))
256
+ colon = directive_match[:colon]
257
+ directive = directive_match[:directive]
258
+ raw_param = directive_match[:param]
259
+ param = raw_param.strip
260
+ else
261
+ colon = directive = raw_param = param = nil
262
+ end
263
+
264
+ if !directive
265
+ comment_lines << prefix_indent + line
266
+ elsif colon == '\\:'
267
+ # If directive is escaped, unescape it
268
+ comment_lines << prefix_indent + line.sub('\\:', ':')
269
+ elsif raw_param.start_with?(':') || (colon.empty? && !COLON_LESS_DIRECTIVES.include?(directive))
270
+ # Something like `:toto::` is not a directive
271
+ # Only few directives allows to start without a colon
272
+ comment_lines << prefix_indent + line
273
+ elsif directive == 'include'
274
+ filename_to_include = param
275
+ include_callback.call(filename_to_include, prefix_indent).lines.each { |l| comment_lines << l.chomp }
276
+ elsif MULTILINE_DIRECTIVES.include?(directive)
277
+ value_lines = take_multiline_directive_value_lines(directive, filename, line_no, lines, prefix_indent.size, indent_regexp, !param.empty?)
278
+ read_lines += value_lines.size
279
+ lines.shift(value_lines.size)
280
+ unless param.empty?
281
+ # Accept `:call-seq: first-line\n second-line` for now
282
+ value_lines.unshift(param)
283
+ end
284
+ value = value_lines.join("\n")
285
+ directives[directive] = [value.empty? ? nil : value, line_no]
286
+ else
287
+ directives[directive] = [param.empty? ? nil : param, line_no]
288
+ end
289
+ line_no += read_lines
290
+ end
291
+
292
+ normalized_comment = String.new(encoding: text.encoding) << normalize_comment_lines(comment_lines).join("\n")
293
+ [normalized_comment, directives]
294
+ end
295
+
296
+ # Remove preceding indent spaces and blank lines from the comment lines
297
+
298
+ private def normalize_comment_lines(lines)
299
+ blank_line_regexp = /\A\s*\z/
300
+ lines = lines.dup
301
+ lines.shift while lines.first&.match?(blank_line_regexp)
302
+ lines.pop while lines.last&.match?(blank_line_regexp)
303
+
304
+ min_spaces = lines.map do |l|
305
+ l.match(/\A *(?=\S)/)&.end(0)
306
+ end.compact.min
307
+ if min_spaces && min_spaces > 0
308
+ lines.map { |l| l[min_spaces..] || '' }
309
+ else
310
+ lines
311
+ end
312
+ end
313
+
314
+ # Take value lines of multiline directive
315
+
316
+ private def take_multiline_directive_value_lines(directive, filename, line_no, lines, base_indent_size, indent_regexp, has_param)
317
+ return [] if lines.empty?
318
+
319
+ first_indent_size = lines.first.match(indent_regexp).end(0)
320
+
321
+ # Blank line or unindented line is not part of multiline-directive value
322
+ return [] if first_indent_size <= base_indent_size
323
+
324
+ if has_param
325
+ # :multiline-directive: line1
326
+ # line2
327
+ # line3
328
+ #
329
+ value_lines = lines.take_while do |l|
330
+ l.rstrip.match(indent_regexp).end(0) > base_indent_size
331
+ end
332
+ min_indent = value_lines.map { |l| l.match(indent_regexp).end(0) }.min
333
+ value_lines.map { |l| l[min_indent..] }
334
+ else
335
+ # Take indented lines accepting blank lines between them
336
+ value_lines = lines.take_while do |l|
337
+ l = l.rstrip
338
+ indent = l[indent_regexp]
339
+ if indent == l || indent.size >= first_indent_size
340
+ true
341
+ end
342
+ end
343
+ value_lines.map! { |l| (l[first_indent_size..] || '').chomp }
344
+
345
+ if value_lines.size != lines.size && !value_lines.last.empty?
346
+ warn "#{filename}:#{line_no} Multiline directive :#{directive}: should end with a blank line."
347
+ end
348
+ value_lines.pop while value_lines.last&.empty?
349
+ value_lines
350
+ end
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,215 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # RDoc::CrossReference is a reusable way to create cross references for names.
5
+
6
+ class RDoc::CrossReference
7
+
8
+ ##
9
+ # Regular expression to match class references
10
+ #
11
+ # 1. There can be a '\\' in front of text to suppress the cross-reference
12
+ # 2. There can be a '::' in front of class names to reference from the
13
+ # top-level namespace.
14
+ # 3. The method can be followed by parenthesis (not recommended)
15
+
16
+ CLASS_REGEXP_STR = '\\\\?((?:\:{2})?[A-Z]\w*(?:\:\:\w+)*)'
17
+
18
+ ##
19
+ # Regular expression to match a single method argument.
20
+
21
+ METHOD_ARG_REGEXP_STR = '[\w.+*/=<>-]+'
22
+
23
+ ##
24
+ # Regular expression to match method arguments.
25
+
26
+ METHOD_ARGS_REGEXP_STR = /(?:\((?:#{METHOD_ARG_REGEXP_STR}(?:,\s*#{METHOD_ARG_REGEXP_STR})*)?\))?/.source
27
+
28
+ ##
29
+ # Regular expression to match method references.
30
+ #
31
+ # See CLASS_REGEXP_STR
32
+
33
+ METHOD_REGEXP_STR = /(
34
+ (?!\d)[\w]+[!?=]?|
35
+ %|=(?:==?|~)|![=~]|\[\]=?|<(?:<|=>?)?|>[>=]?|[-+!]@?|\*\*?|[\/%\`|&^~]
36
+ )#{METHOD_ARGS_REGEXP_STR}/.source.delete("\n ").freeze
37
+
38
+ ##
39
+ # Regular expressions matching text that should potentially have
40
+ # cross-reference links generated are passed to add_regexp_handling. Note
41
+ # that these expressions are meant to pick up text for which cross-references
42
+ # have been suppressed, since the suppression characters are removed by the
43
+ # code that is triggered.
44
+
45
+ CROSSREF_REGEXP = /(?:^|[\s()])
46
+ (
47
+ (?:
48
+ # A::B::C.meth
49
+ #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
50
+
51
+ # A::B::C
52
+ # The stuff after CLASS_REGEXP_STR is a
53
+ # nasty hack. CLASS_REGEXP_STR unfortunately matches
54
+ # words like dog and cat (these are legal "class"
55
+ # names in Fortran 95). When a word is flagged as a
56
+ # potential cross-reference, limitations in the markup
57
+ # engine suppress other processing, such as typesetting.
58
+ # This is particularly noticeable for contractions.
59
+ # In order that words like "can't" not
60
+ # be flagged as potential cross-references, only
61
+ # flag potential class cross-references if the character
62
+ # after the cross-reference is a space, sentence
63
+ # punctuation, tag start character, or attribute
64
+ # marker.
65
+ | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
66
+
67
+ # Stand-alone method (preceded by a #)
68
+ | \\?\##{METHOD_REGEXP_STR}
69
+
70
+ # Stand-alone method (preceded by ::)
71
+ | ::#{METHOD_REGEXP_STR}
72
+
73
+ # Things that look like filenames
74
+ # The key thing is that there must be at least
75
+ # one special character (period, slash, or
76
+ # underscore).
77
+ | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
78
+
79
+ # Things that have markup suppressed
80
+ # Don't process things like '\<' in \<tt>, though.
81
+ # TODO: including < is a hack, not very satisfying.
82
+ | \\[^\s<]
83
+ )
84
+
85
+ # labels for headings
86
+ (?:@[\w+%-]+(?:\.[\w|%-]+)?)?
87
+ )/x
88
+
89
+ ##
90
+ # Version of CROSSREF_REGEXP used when <tt>--hyperlink-all</tt> is specified.
91
+
92
+ ALL_CROSSREF_REGEXP = /
93
+ (?:^|[\s()])
94
+ (
95
+ (?:
96
+ # A::B::C.meth
97
+ #{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
98
+
99
+ # A::B::C
100
+ | #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
101
+
102
+ # Stand-alone method
103
+ | \\?#{METHOD_REGEXP_STR}
104
+
105
+ # Things that look like filenames
106
+ | (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
107
+
108
+ # Things that have markup suppressed
109
+ | \\[^\s<]
110
+ )
111
+
112
+ # labels for headings
113
+ (?:@[\w+%-]+)?
114
+ )/x
115
+
116
+ ##
117
+ # Hash of references that have been looked-up to their replacements
118
+
119
+ attr_accessor :seen
120
+
121
+ ##
122
+ # Allows cross-references to be created based on the given +context+
123
+ # (RDoc::Context).
124
+
125
+ def initialize(context)
126
+ @context = context
127
+ @store = context.store
128
+
129
+ @seen = {}
130
+ end
131
+
132
+ ##
133
+ # Returns a method, attribute or constant reference to +name+
134
+ # if it exists in the containing context object. It returns
135
+ # nil otherwise.
136
+ #
137
+ # For example, this method would decompose name = 'A::CONSTANT' into a
138
+ # container object A and a symbol 'CONSTANT', and it would try to find
139
+ # 'CONSTANT' in A.
140
+
141
+ def resolve_local_symbol(name)
142
+ ref = nil
143
+ type = nil
144
+ container = nil
145
+
146
+ case name
147
+ when /#{CLASS_REGEXP_STR}::([A-Z]\w*)\z/o then
148
+ symbol = $2
149
+ container = @context.find_symbol_module($1)
150
+ when /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o then
151
+ type = $2
152
+ if '.' == type # will find either #method or ::method
153
+ symbol = $3
154
+ else
155
+ symbol = "#{type}#{$3}"
156
+ end
157
+ container = @context.find_symbol_module($1)
158
+ when /^([.#]|::)#{METHOD_REGEXP_STR}/o then
159
+ type = $1
160
+ if '.' == type
161
+ symbol = $2
162
+ else
163
+ symbol = "#{type}#{$2}"
164
+ end
165
+ container = @context
166
+ end
167
+
168
+ if container then
169
+ unless RDoc::TopLevel === container then
170
+ if '.' == type then
171
+ if 'new' == symbol then # AnyClassName.new will be class method
172
+ ref = container.find_local_symbol symbol
173
+ ref = container.find_ancestor_local_symbol symbol unless ref
174
+ else
175
+ ref = container.find_local_symbol "::#{symbol}"
176
+ ref = container.find_ancestor_local_symbol "::#{symbol}" unless ref
177
+ ref = container.find_local_symbol "##{symbol}" unless ref
178
+ ref = container.find_ancestor_local_symbol "##{symbol}" unless ref
179
+ end
180
+ else
181
+ ref = container.find_local_symbol symbol
182
+ ref = container.find_ancestor_local_symbol symbol unless ref
183
+ end
184
+ end
185
+ end
186
+
187
+ ref
188
+ end
189
+
190
+ ##
191
+ # Returns a reference to +name+.
192
+ #
193
+ # If the reference is found and +name+ is not documented +nil+ will be
194
+ # returned. If +name+ is not found +nil+ is returned.
195
+
196
+ def resolve(name)
197
+ return @seen[name] if @seen.include? name
198
+
199
+ ref = @context.find_symbol name
200
+
201
+ ref = resolve_local_symbol name unless ref
202
+
203
+ # Try a page name
204
+ ref = @store.page name if not ref and name =~ /^[\w.\/]+$/
205
+
206
+ ref = nil if RDoc::Alias === ref # external alias, can't link to it
207
+
208
+ ref = nil unless ref&.display?
209
+
210
+ @seen[name] = ref
211
+
212
+ ref
213
+ end
214
+
215
+ end
@@ -0,0 +1,120 @@
1
+ # coding: US-ASCII
2
+ # frozen_string_literal: true
3
+
4
+ ##
5
+ # This class is a wrapper around File IO and Encoding that helps RDoc load
6
+ # files and convert them to the correct encoding.
7
+
8
+ module RDoc::Encoding
9
+
10
+ HEADER_REGEXP = /\A
11
+ (?:
12
+ \#!.*\n
13
+ |
14
+ ^\#\s+frozen[-_]string[-_]literal[=:].+\n
15
+ |
16
+ ^\#\s*(?:-\*-\s*(?:[^;\n]*;\s*)*)?(?:en)?coding[=:]\s*(?<name>[^:\s;]+).*\n
17
+ |
18
+ <\?xml[^?]*encoding=(?<quote>["'])(?<name>.*?)\k<quote>.*\n
19
+ )+
20
+ /xi # :nodoc:
21
+
22
+ ##
23
+ # Reads the contents of +filename+ and handles any encoding directives in
24
+ # the file.
25
+ #
26
+ # The content will be converted to the +encoding+. If the file cannot be
27
+ # converted a warning will be printed and nil will be returned.
28
+ #
29
+ # If +force_transcode+ is true the document will be transcoded and any
30
+ # unknown character in the target encoding will be replaced with '?'
31
+
32
+ def self.read_file(filename, encoding, force_transcode = false)
33
+ content = File.open filename, "rb" do |f| f.read end
34
+ content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
35
+
36
+ utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
37
+
38
+ enc = RDoc::Encoding.detect_encoding content
39
+ content = RDoc::Encoding.change_encoding content, enc if enc
40
+
41
+ begin
42
+ encoding ||= Encoding.default_external
43
+ orig_encoding = content.encoding
44
+
45
+ if not orig_encoding.ascii_compatible? then
46
+ content = content.encode encoding
47
+ elsif utf8 then
48
+ content = RDoc::Encoding.change_encoding content, Encoding::UTF_8
49
+ content = content.encode encoding
50
+ else
51
+ # assume the content is in our output encoding
52
+ content = RDoc::Encoding.change_encoding content, encoding
53
+ end
54
+
55
+ unless content.valid_encoding? then
56
+ # revert and try to transcode
57
+ content = RDoc::Encoding.change_encoding content, orig_encoding
58
+ content = content.encode encoding
59
+ end
60
+
61
+ unless content.valid_encoding? then
62
+ warn "unable to convert #{filename} to #{encoding}, skipping"
63
+ content = nil
64
+ end
65
+ rescue Encoding::InvalidByteSequenceError,
66
+ Encoding::UndefinedConversionError => e
67
+ if force_transcode then
68
+ content = RDoc::Encoding.change_encoding content, orig_encoding
69
+ content = content.encode(encoding,
70
+ :invalid => :replace,
71
+ :undef => :replace,
72
+ :replace => '?')
73
+ return content
74
+ else
75
+ warn "unable to convert #{e.message} for #{filename}, skipping"
76
+ return nil
77
+ end
78
+ end
79
+
80
+ content
81
+ rescue ArgumentError => e
82
+ raise unless e.message =~ /unknown encoding name - (.*)/
83
+ warn "unknown encoding name \"#{$1}\" for #{filename}, skipping"
84
+ nil
85
+ rescue Errno::EISDIR, Errno::ENOENT
86
+ nil
87
+ end
88
+
89
+ ##
90
+ # Detects the encoding of +string+ based on the magic comment
91
+
92
+ def self.detect_encoding(string)
93
+ result = HEADER_REGEXP.match string
94
+ name = result && result[:name]
95
+
96
+ name ? Encoding.find(name) : nil
97
+ end
98
+
99
+ ##
100
+ # Removes magic comments and shebang
101
+
102
+ def self.remove_magic_comment(string)
103
+ string.sub HEADER_REGEXP do |s|
104
+ s.gsub(/[^\n]/, '')
105
+ end
106
+ end
107
+
108
+ ##
109
+ # Changes encoding based on +encoding+ without converting and returns new
110
+ # string
111
+
112
+ def self.change_encoding(text, encoding)
113
+ if text.kind_of? RDoc::Comment
114
+ text.encode! encoding
115
+ else
116
+ String.new text, encoding: encoding
117
+ end
118
+ end
119
+
120
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Allows an ERB template to be rendered in the context (binding) of an
4
+ # existing ERB template evaluation.
5
+
6
+ class RDoc::ERBPartial < ERB
7
+
8
+ ##
9
+ # Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
10
+ # if it isn't already set.
11
+
12
+ def set_eoutvar(compiler, eoutvar = '_erbout')
13
+ super
14
+
15
+ compiler.pre_cmd = ["#{eoutvar} ||= +''"]
16
+ end
17
+
18
+ end