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,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RDoc
4
+ class Markup
5
+ # An empty line
6
+ class BlankLine < Element
7
+ @instance = new
8
+
9
+ # RDoc::Markup::BlankLine is a singleton
10
+ #: () -> BlankLine
11
+ def self.new
12
+ @instance
13
+ end
14
+
15
+ # Calls #accept_blank_line on +visitor+
16
+ # @override
17
+ #: (untyped) -> void
18
+ def accept(visitor)
19
+ visitor.accept_blank_line(self)
20
+ end
21
+
22
+ # @override
23
+ #: (PP) -> void
24
+ def pretty_print(q) # :nodoc:
25
+ q.text("blankline")
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # A quoted section which contains markup items.
4
+
5
+ class RDoc::Markup::BlockQuote < RDoc::Markup::Raw
6
+
7
+ ##
8
+ # Calls #accept_block_quote on +visitor+
9
+
10
+ def accept(visitor)
11
+ visitor.accept_block_quote self
12
+ end
13
+
14
+ end
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # A Document containing lists, headings, paragraphs, etc.
4
+
5
+ class RDoc::Markup::Document
6
+
7
+ include Enumerable
8
+
9
+ ##
10
+ # The file this document was created from. See also
11
+ # RDoc::ClassModule#add_comment
12
+
13
+ attr_reader :file
14
+
15
+ ##
16
+ # If a heading is below the given level it will be omitted from the
17
+ # table_of_contents
18
+
19
+ attr_accessor :omit_headings_below
20
+
21
+ ##
22
+ # The parts of the Document
23
+
24
+ attr_reader :parts
25
+
26
+ ##
27
+ # Creates a new Document with +parts+
28
+
29
+ def initialize(*parts)
30
+ @parts = []
31
+ @parts.concat parts
32
+
33
+ @file = nil
34
+ @omit_headings_from_table_of_contents_below = nil
35
+ end
36
+
37
+ ##
38
+ # Appends +part+ to the document
39
+
40
+ def <<(part)
41
+ case part
42
+ when RDoc::Markup::Document then
43
+ unless part.empty? then
44
+ parts.concat part.parts
45
+ parts << RDoc::Markup::BlankLine.new
46
+ end
47
+ when String then
48
+ raise ArgumentError,
49
+ "expected RDoc::Markup::Document and friends, got String" unless
50
+ part.empty?
51
+ else
52
+ parts << part
53
+ end
54
+ end
55
+
56
+ def ==(other) # :nodoc:
57
+ self.class == other.class and
58
+ @file == other.file and
59
+ @parts == other.parts
60
+ end
61
+
62
+ ##
63
+ # Runs this document and all its #items through +visitor+
64
+
65
+ def accept(visitor)
66
+ visitor.start_accepting
67
+
68
+ visitor.accept_document self
69
+
70
+ visitor.end_accepting
71
+ end
72
+
73
+ ##
74
+ # Concatenates the given +parts+ onto the document
75
+
76
+ def concat(parts)
77
+ self.parts.concat parts
78
+ end
79
+
80
+ ##
81
+ # Enumerator for the parts of this document
82
+
83
+ def each(&block)
84
+ @parts.each(&block)
85
+ end
86
+
87
+ ##
88
+ # Does this document have no parts?
89
+
90
+ def empty?
91
+ @parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)
92
+ end
93
+
94
+ ##
95
+ # The file this Document was created from.
96
+
97
+ def file=(location)
98
+ @file = case location
99
+ when RDoc::TopLevel then
100
+ location.relative_name
101
+ else
102
+ location
103
+ end
104
+ end
105
+
106
+ ##
107
+ # When this is a collection of documents (#file is not set and this document
108
+ # contains only other documents as its direct children) #merge replaces
109
+ # documents in this class with documents from +other+ when the file matches
110
+ # and adds documents from +other+ when the files do not.
111
+ #
112
+ # The information in +other+ is preferred over the receiver
113
+
114
+ def merge(other)
115
+ if empty? then
116
+ @parts = other.parts
117
+ return self
118
+ end
119
+
120
+ other.parts.each do |other_part|
121
+ self.parts.delete_if do |self_part|
122
+ self_part.file and self_part.file == other_part.file
123
+ end
124
+
125
+ self.parts << other_part
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ ##
132
+ # Does this Document contain other Documents?
133
+
134
+ def merged?
135
+ RDoc::Markup::Document === @parts.first
136
+ end
137
+
138
+ def pretty_print(q) # :nodoc:
139
+ start = @file ? "[doc (#{@file}): " : '[doc: '
140
+
141
+ q.group 2, start, ']' do
142
+ q.seplist @parts do |part|
143
+ q.pp part
144
+ end
145
+ end
146
+ end
147
+
148
+ ##
149
+ # Appends +parts+ to the document
150
+
151
+ def push(*parts)
152
+ self.parts.concat parts
153
+ end
154
+
155
+ ##
156
+ # Returns an Array of headings in the document.
157
+ #
158
+ # Require 'rdoc/markup/formatter' before calling this method.
159
+
160
+ def table_of_contents
161
+ accept RDoc::Markup::ToTableOfContents.to_toc
162
+ end
163
+
164
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RDoc
4
+ class Markup
5
+ # Base class defining the interface for all markup elements found in documentation
6
+ # @abstract
7
+ class Element
8
+ # @abstract
9
+ #: (untyped) -> void
10
+ def accept(visitor)
11
+ raise NotImplementedError, "#{self.class} must implement the accept method"
12
+ end
13
+
14
+ # @abstract
15
+ #: (PP) -> void
16
+ def pretty_print(q)
17
+ raise NotImplementedError, "#{self.class} must implement the pretty_print method"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,285 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Base class for RDoc markup formatters
4
+ #
5
+ # Formatters are a visitor that converts an RDoc::Markup tree (from a comment)
6
+ # into some kind of output. RDoc ships with formatters for converting back to
7
+ # rdoc, ANSI text, HTML, a Table of Contents and other formats.
8
+ #
9
+ # If you'd like to write your own Formatter use
10
+ # RDoc::Markup::FormatterTestCase. If you're writing a text-output formatter
11
+ # use RDoc::Markup::TextFormatterTestCase which provides extra test cases.
12
+
13
+ require 'rdoc/markup/inline_parser'
14
+
15
+ class RDoc::Markup::Formatter
16
+
17
+ ##
18
+ # Converts a target url to one that is relative to a given path
19
+
20
+ def self.gen_relative_url(path, target)
21
+ from = File.dirname path
22
+ to, to_file = File.split target
23
+
24
+ from = from.split "/"
25
+ to = to.split "/"
26
+
27
+ from.delete '.'
28
+ to.delete '.'
29
+
30
+ while from.size > 0 and to.size > 0 and from[0] == to[0] do
31
+ from.shift
32
+ to.shift
33
+ end
34
+
35
+ from.fill ".."
36
+ from.concat to
37
+ from << to_file
38
+ File.join(*from)
39
+ end
40
+
41
+ ##
42
+ # Creates a new Formatter
43
+
44
+ def initialize
45
+ @markup = RDoc::Markup.new
46
+
47
+ @from_path = '.'
48
+ end
49
+
50
+ ##
51
+ # Adds +document+ to the output
52
+
53
+ def accept_document(document)
54
+ document.parts.each do |item|
55
+ case item
56
+ when RDoc::Markup::Document then # HACK
57
+ accept_document item
58
+ else
59
+ item.accept self
60
+ end
61
+ end
62
+ end
63
+
64
+ ##
65
+ # Adds a regexp handling for links of the form rdoc-...:
66
+
67
+ def add_regexp_handling_RDOCLINK
68
+ @markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
69
+ end
70
+
71
+ ##
72
+ # Allows +tag+ to be decorated with additional information.
73
+
74
+ def annotate(tag)
75
+ tag
76
+ end
77
+
78
+ ##
79
+ # Marks up +content+
80
+
81
+ def convert(content)
82
+ @markup.convert content, self
83
+ end
84
+
85
+ # Applies regexp handling to +text+ and returns an array of [text, converted?] pairs.
86
+
87
+ def apply_regexp_handling(text)
88
+ matched = []
89
+ @markup.regexp_handlings.each_with_index do |(pattern, name), priority|
90
+ text.scan(pattern) do
91
+ m = Regexp.last_match
92
+ idx = m[1] ? 1 : 0
93
+ matched << [m.begin(idx), m.end(idx), m[idx], name, priority]
94
+ end
95
+ end
96
+ # If the start positions are the same, prefer the earlier-registered one
97
+ # (lower numeric priority from each_with_index).
98
+ matched.sort_by! {|beg_pos, _, _, _, priority| [beg_pos, priority] }
99
+
100
+ pos = 0
101
+ output = []
102
+ matched.each do |beg_pos, end_pos, s, name|
103
+ next if beg_pos < pos
104
+
105
+ output << [text[pos...beg_pos], false] if beg_pos != pos
106
+ handled = public_send(:"handle_regexp_#{name}", s)
107
+ output << [handled, true]
108
+ pos = end_pos
109
+ end
110
+
111
+ output << [text[pos..], false] if pos < text.size
112
+ output
113
+ end
114
+
115
+ # Called when processing plain text while traversing inline nodes from handle_inline.
116
+ # +text+ may need proper escaping.
117
+
118
+ def handle_PLAIN_TEXT(text)
119
+ end
120
+
121
+ # Called when processing regexp-handling-processed text while traversing inline nodes from handle_inline.
122
+ # +text+ may contain markup tags.
123
+
124
+ def handle_REGEXP_HANDLING_TEXT(text)
125
+ end
126
+
127
+ # Called when processing text node while traversing inline nodes from handle_inline.
128
+ # Apply regexp handling and dispatch to the appropriate handler: handle_REGEXP_HANDLING_TEXT or handle_PLAIN_TEXT.
129
+
130
+ def handle_TEXT(text)
131
+ apply_regexp_handling(text).each do |part, converted|
132
+ if converted
133
+ handle_REGEXP_HANDLING_TEXT(part)
134
+ else
135
+ handle_PLAIN_TEXT(part)
136
+ end
137
+ end
138
+ end
139
+
140
+ # Called when processing a hard break while traversing inline nodes from handle_inline.
141
+
142
+ def handle_HARD_BREAK
143
+ end
144
+
145
+ # Called when processing bold nodes while traversing inline nodes from handle_inline.
146
+ # Traverse the children nodes and dispatch to the appropriate handlers.
147
+
148
+ def handle_BOLD(nodes)
149
+ traverse_inline_nodes(nodes)
150
+ end
151
+
152
+ # Called when processing emphasis nodes while traversing inline nodes from handle_inline.
153
+ # Traverse the children nodes and dispatch to the appropriate handlers.
154
+
155
+ def handle_EM(nodes)
156
+ traverse_inline_nodes(nodes)
157
+ end
158
+
159
+ # Called when processing bold word nodes while traversing inline nodes from handle_inline.
160
+ # +word+ may need proper escaping.
161
+
162
+ def handle_BOLD_WORD(word)
163
+ handle_PLAIN_TEXT(word)
164
+ end
165
+
166
+ # Called when processing emphasis word nodes while traversing inline nodes from handle_inline.
167
+ # +word+ may need proper escaping.
168
+
169
+ def handle_EM_WORD(word)
170
+ handle_PLAIN_TEXT(word)
171
+ end
172
+
173
+ # Called when processing tt nodes while traversing inline nodes from handle_inline.
174
+ # +code+ may need proper escaping.
175
+
176
+ def handle_TT(code)
177
+ handle_PLAIN_TEXT(code)
178
+ end
179
+
180
+ # Called when processing strike nodes while traversing inline nodes from handle_inline.
181
+ # Traverse the children nodes and dispatch to the appropriate handlers.
182
+
183
+ def handle_STRIKE(nodes)
184
+ traverse_inline_nodes(nodes)
185
+ end
186
+
187
+ # Called when processing tidylink nodes while traversing inline nodes from handle_inline.
188
+ # +label_part+ is an array of strings or nodes representing the link label.
189
+ # +url+ is the link URL.
190
+ # Traverse the label_part nodes and dispatch to the appropriate handlers.
191
+
192
+ def handle_TIDYLINK(label_part, url)
193
+ traverse_inline_nodes(label_part)
194
+ end
195
+
196
+ # Parses inline +text+, traverse the resulting nodes, and calls the appropriate handler methods.
197
+
198
+ def handle_inline(text)
199
+ nodes = RDoc::Markup::InlineParser.new(text).parse
200
+ traverse_inline_nodes(nodes)
201
+ end
202
+
203
+ # Traverses +nodes+ and calls the appropriate handler methods
204
+ # Nodes formats are described in RDoc::Markup::InlineParser#parse
205
+
206
+ def traverse_inline_nodes(nodes)
207
+ nodes.each do |node|
208
+ next handle_TEXT(node) if String === node
209
+ case node[:type]
210
+ when :TIDYLINK
211
+ handle_TIDYLINK(node[:children], node[:url])
212
+ when :HARD_BREAK
213
+ handle_HARD_BREAK
214
+ when :BOLD
215
+ handle_BOLD(node[:children])
216
+ when :BOLD_WORD
217
+ handle_BOLD_WORD(node[:children][0] || '')
218
+ when :EM
219
+ handle_EM(node[:children])
220
+ when :EM_WORD
221
+ handle_EM_WORD(node[:children][0] || '')
222
+ when :TT
223
+ handle_TT(node[:children][0] || '')
224
+ when :STRIKE
225
+ handle_STRIKE(node[:children])
226
+ end
227
+ end
228
+ end
229
+
230
+ ##
231
+ # Converts a string to be fancier if desired
232
+
233
+ def convert_string(string)
234
+ string
235
+ end
236
+
237
+ ##
238
+ # Use ignore in your subclass to ignore the content of a node.
239
+ #
240
+ # ##
241
+ # # We don't support raw nodes in ToNoRaw
242
+ #
243
+ # alias accept_raw ignore
244
+
245
+ def ignore(*node)
246
+ end
247
+
248
+ ##
249
+ # Extracts and a scheme, url and an anchor id from +url+ and returns them.
250
+
251
+ def parse_url(url)
252
+ case url
253
+ when /^rdoc-label:([^:]*)(?::(.*))?/ then
254
+ scheme = 'link'
255
+ path = "##{$1}"
256
+ id = " id=\"#{$2}\"" if $2
257
+ when /([A-Za-z]+):(.*)/ then
258
+ scheme = $1.downcase
259
+ path = $2
260
+ when /^#/ then
261
+ else
262
+ scheme = 'http'
263
+ path = url
264
+ url = url
265
+ end
266
+
267
+ if scheme == 'link' then
268
+ url = if path[0, 1] == '#' then # is this meaningful?
269
+ path
270
+ else
271
+ self.class.gen_relative_url @from_path, path
272
+ end
273
+ end
274
+
275
+ [scheme, url, id]
276
+ end
277
+
278
+ ##
279
+ # Is +tag+ a tt tag?
280
+
281
+ def tt?(tag)
282
+ tag.bit == @tt_bit
283
+ end
284
+
285
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RDoc
4
+ class Markup
5
+ # A hard-break in the middle of a paragraph.
6
+ class HardBreak < Element
7
+ @instance = new
8
+
9
+ # RDoc::Markup::HardBreak is a singleton
10
+ #: () -> HardBreak
11
+ def self.new
12
+ @instance
13
+ end
14
+
15
+ # Calls #accept_hard_break on +visitor+
16
+ # @override
17
+ #: (untyped) -> void
18
+ def accept(visitor)
19
+ visitor.accept_hard_break(self)
20
+ end
21
+
22
+ #: (top) -> bool
23
+ def ==(other) # :nodoc:
24
+ self.class === other
25
+ end
26
+
27
+ # @override
28
+ #: (PP) -> void
29
+ def pretty_print(q) # :nodoc:
30
+ q.text("[break]")
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,170 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RDoc
4
+ class Markup
5
+ # IMPORTANT! This weird workaround is required to ensure that RDoc can correctly deserializing Marshal data from
6
+ # older rubies. Older rubies have `Heading` as a struct, so if we change it to a class, deserialization fails
7
+ if RUBY_VERSION.start_with?("4.")
8
+ class Heading < Element
9
+ #: String
10
+ attr_reader :text
11
+
12
+ #: Integer
13
+ attr_accessor :level
14
+
15
+ #: (Integer, String) -> void
16
+ def initialize(level, text)
17
+ super()
18
+
19
+ @level = level
20
+ @text = text
21
+ end
22
+
23
+ #: (Object) -> bool
24
+ def ==(other)
25
+ other.is_a?(Heading) && other.level == @level && other.text == @text
26
+ end
27
+ end
28
+ else
29
+ Heading = Struct.new(:level, :text)
30
+ end
31
+
32
+ # A heading with a level (1-6) and text
33
+ #
34
+ # RDoc syntax:
35
+ # = Heading 1
36
+ # == Heading 2
37
+ # === Heading 3
38
+ #
39
+ # Markdown syntax:
40
+ # # Heading 1
41
+ # ## Heading 2
42
+ # ### Heading 3
43
+ #
44
+ class Heading
45
+ # A singleton RDoc::Markup::ToLabel formatter for headings.
46
+ #: () -> RDoc::Markup::ToLabel
47
+ def self.to_label
48
+ @to_label ||= Markup::ToLabel.new
49
+ end
50
+
51
+ # A singleton plain HTML formatter for headings. Used for creating labels for the Table of Contents
52
+ #: () -> RDoc::Markup::ToHtml
53
+ def self.to_html
54
+ @to_html ||= begin
55
+ to_html = Markup::ToHtml.new
56
+
57
+ def to_html.handle_regexp_CROSSREF(text)
58
+ text.sub(/^\\/, '')
59
+ end
60
+
61
+ to_html
62
+ end
63
+ end
64
+
65
+ # @override
66
+ #: (untyped) -> void
67
+ def accept(visitor)
68
+ visitor.accept_heading(self)
69
+ end
70
+
71
+ # An HTML-safe anchor reference for this header using GitHub-style formatting:
72
+ # - Lowercase
73
+ # - Spaces converted to hyphens
74
+ # - Special characters removed (except hyphens)
75
+ #
76
+ # Examples:
77
+ # "Hello" -> "hello"
78
+ # "Hello World" -> "hello-world"
79
+ # "Foo Bar Baz" -> "foo-bar-baz"
80
+ #
81
+ #: () -> String
82
+ def aref
83
+ self.class.to_label.convert text.dup
84
+ end
85
+
86
+ # An HTML-safe anchor reference using legacy RDoc formatting:
87
+ # - Prefixed with "label-"
88
+ # - Original case preserved
89
+ # - Spaces converted to + (URL encoding style)
90
+ # - Special characters percent-encoded
91
+ #
92
+ # Returns nil if it would be the same as the GitHub-style aref (no alias needed).
93
+ #
94
+ # Examples:
95
+ # "hello" -> "label-hello" (different due to label- prefix)
96
+ # "Hello" -> "label-Hello"
97
+ # "Hello World" -> "label-Hello+World"
98
+ # "Foo Bar Baz" -> "label-Foo+Bar+Baz"
99
+ #
100
+ #: () -> String?
101
+ def legacy_aref
102
+ "label-#{self.class.to_label.convert_legacy text.dup}"
103
+ end
104
+
105
+ # Creates a fully-qualified label (GitHub-style) which includes the context's aref prefix.
106
+ # This helps keep IDs unique in HTML when headings appear within class/method documentation.
107
+ #
108
+ # Examples (without context):
109
+ # "Hello World" -> "hello-world"
110
+ #
111
+ # Examples (with context being class Foo):
112
+ # "Hello World" -> "class-foo-hello-world"
113
+ #
114
+ # Examples (with context being method #bar):
115
+ # "Hello World" -> "method-i-bar-hello-world"
116
+ #
117
+ #: (RDoc::Context?) -> String
118
+ def label(context = nil)
119
+ result = +""
120
+ result << "#{context.aref}-" if context&.respond_to?(:aref)
121
+ result << aref
122
+ result
123
+ end
124
+
125
+ # Creates a fully-qualified legacy label for backward compatibility.
126
+ # This is used to generate a secondary ID attribute on the heading's inner anchor,
127
+ # allowing old-style links (e.g., #label-Hello+World) to continue working.
128
+ #
129
+ # Examples (without context):
130
+ # "hello" -> "label-hello"
131
+ # "Hello World" -> "label-Hello+World"
132
+ #
133
+ # Examples (with context being class Foo):
134
+ # "hello" -> "class-Foo-label-hello"
135
+ # "Hello World" -> "class-Foo-label-Hello+World"
136
+ #
137
+ #: (RDoc::Context?) -> String
138
+ def legacy_label(context = nil)
139
+ result = +""
140
+ if context&.respond_to?(:legacy_aref)
141
+ result << "#{context.legacy_aref}-"
142
+ elsif context&.respond_to?(:aref)
143
+ result << "#{context.aref}-"
144
+ end
145
+ result << legacy_aref
146
+ result
147
+ end
148
+
149
+ # HTML markup of the text of this label without the surrounding header element.
150
+ #: () -> String
151
+ def plain_html
152
+ no_image_text = text
153
+
154
+ if matched = no_image_text.match(/rdoc-image:[^:]+:(.*)/)
155
+ no_image_text = matched[1]
156
+ end
157
+
158
+ self.class.to_html.to_html(no_image_text)
159
+ end
160
+
161
+ # @override
162
+ #: (PP) -> void
163
+ def pretty_print(q)
164
+ q.group 2, "[head: #{level} ", ']' do
165
+ q.pp text
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end