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,77 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # This Markup outputter is used for testing purposes.
4
+
5
+ class RDoc::Markup::ToTest < RDoc::Markup::Formatter
6
+
7
+ # :stopdoc:
8
+
9
+ ##
10
+ # :section: Visitor
11
+
12
+ def start_accepting
13
+ @res = []
14
+ @list = []
15
+ end
16
+
17
+ def end_accepting
18
+ @res
19
+ end
20
+
21
+ def handle_PLAIN_TEXT(text)
22
+ @res << text
23
+ end
24
+
25
+ def handle_REGEXP_HANDLING_TEXT(text)
26
+ @res << text
27
+ end
28
+
29
+ def accept_paragraph(paragraph)
30
+ handle_inline(paragraph.text)
31
+ end
32
+
33
+ def accept_raw(raw)
34
+ @res << raw.parts.join
35
+ end
36
+
37
+ def accept_verbatim(verbatim)
38
+ @res << verbatim.text.gsub(/^(\S)/, ' \1')
39
+ end
40
+
41
+ def accept_list_start(list)
42
+ @list << case list.type
43
+ when :BULLET then
44
+ '*'
45
+ when :NUMBER then
46
+ '1'
47
+ else
48
+ list.type
49
+ end
50
+ end
51
+
52
+ def accept_list_end(list)
53
+ @list.pop
54
+ end
55
+
56
+ def accept_list_item_start(list_item)
57
+ @res << "#{' ' * (@list.size - 1)}#{@list.last}: "
58
+ end
59
+
60
+ def accept_list_item_end(list_item)
61
+ end
62
+
63
+ def accept_blank_line(blank_line)
64
+ @res << "\n"
65
+ end
66
+
67
+ def accept_heading(heading)
68
+ @res << "#{'=' * heading.level} #{heading.text}"
69
+ end
70
+
71
+ def accept_rule(rule)
72
+ @res << '-' * rule.weight
73
+ end
74
+
75
+ # :startdoc:
76
+
77
+ end
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # Extracts sections of text enclosed in plus, tt or code. Used to discover
4
+ # undocumented parameters.
5
+
6
+ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
7
+
8
+ ##
9
+ # Stack of list types
10
+
11
+ attr_reader :list_type
12
+
13
+ ##
14
+ # Output accumulator
15
+
16
+ attr_reader :res
17
+
18
+ ##
19
+ # Adds tts from +block_quote+ to the output
20
+
21
+ def accept_block_quote(block_quote)
22
+ tt_sections block_quote.text
23
+ end
24
+
25
+ ##
26
+ # Pops the list type for +list+ from #list_type
27
+
28
+ def accept_list_end(list)
29
+ @list_type.pop
30
+ end
31
+
32
+ ##
33
+ # Pushes the list type for +list+ onto #list_type
34
+
35
+ def accept_list_start(list)
36
+ @list_type << list.type
37
+ end
38
+
39
+ ##
40
+ # Prepares the visitor for consuming +list_item+
41
+
42
+ def accept_list_item_start(list_item)
43
+ case @list_type.last
44
+ when :NOTE, :LABEL then
45
+ Array(list_item.label).map do |label|
46
+ tt_sections label
47
+ end.flatten
48
+ end
49
+ end
50
+
51
+ ##
52
+ # Adds +paragraph+ to the output
53
+
54
+ def accept_paragraph(paragraph)
55
+ tt_sections(paragraph.text)
56
+ end
57
+
58
+ ##
59
+ # Does nothing to +markup_item+ because it doesn't have any user-built
60
+ # content
61
+
62
+ def do_nothing(markup_item)
63
+ end
64
+
65
+ alias accept_blank_line do_nothing # :nodoc:
66
+ alias accept_heading do_nothing # :nodoc:
67
+ alias accept_list_item_end do_nothing # :nodoc:
68
+ alias accept_raw do_nothing # :nodoc:
69
+ alias accept_rule do_nothing # :nodoc:
70
+ alias accept_verbatim do_nothing # :nodoc:
71
+
72
+ ##
73
+ # Extracts tt sections from +text+
74
+
75
+ def tt_sections(text)
76
+ parsed = RDoc::Markup::InlineParser.new(text).parse
77
+ traverse = -> node {
78
+ next if String === node
79
+ if node[:type] == :TT
80
+ res << nil
81
+ res << node[:children][0] || ''
82
+ res << nil
83
+ else
84
+ node[:children].each(&traverse)
85
+ end
86
+ }
87
+ parsed.each(&traverse)
88
+ res
89
+ end
90
+
91
+ ##
92
+ # Returns an Array of items that were wrapped in plus, tt or code.
93
+
94
+ def end_accepting
95
+ @res.compact
96
+ end
97
+
98
+ ##
99
+ # Prepares the visitor for gathering tt sections
100
+
101
+ def start_accepting
102
+ @res = []
103
+
104
+ @list_type = []
105
+ end
106
+
107
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # A section of verbatim text
4
+
5
+ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
6
+
7
+ ##
8
+ # Format of this verbatim section
9
+
10
+ attr_accessor :format
11
+
12
+ def initialize(*parts) # :nodoc:
13
+ super
14
+
15
+ @format = nil
16
+ end
17
+
18
+ def ==(other) # :nodoc:
19
+ super and @format == other.format
20
+ end
21
+
22
+ ##
23
+ # Calls #accept_verbatim on +visitor+
24
+
25
+ def accept(visitor)
26
+ visitor.accept_verbatim self
27
+ end
28
+
29
+ ##
30
+ # Collapses 3+ newlines into two newlines
31
+
32
+ def normalize
33
+ parts = []
34
+
35
+ newlines = 0
36
+
37
+ @parts.each do |part|
38
+ case part
39
+ when /^\s*\n/ then
40
+ newlines += 1
41
+ parts << part if newlines == 1
42
+ else
43
+ newlines = 0
44
+ parts << part
45
+ end
46
+ end
47
+
48
+ parts.pop if parts.last =~ /\A\r?\n\z/
49
+
50
+ @parts = parts
51
+ end
52
+
53
+ def pretty_print(q) # :nodoc:
54
+ self.class.name =~ /.*::(\w{1,4})/i
55
+
56
+ q.group 2, "[#{$1.downcase}: ", ']' do
57
+ if @format then
58
+ q.text "format: #{@format}"
59
+ q.breakable
60
+ end
61
+
62
+ q.seplist @parts do |part|
63
+ q.pp part
64
+ end
65
+ end
66
+ end
67
+
68
+ ##
69
+ # Is this verbatim section Ruby code?
70
+
71
+ def ruby?
72
+ @format ||= nil # TODO for older ri data, switch the tree to marshal_dump
73
+ @format == :ruby || @format == :rb
74
+ end
75
+
76
+ ##
77
+ # The text of the section
78
+
79
+ def text
80
+ @parts.join
81
+ end
82
+
83
+ end
@@ -0,0 +1,219 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # RDoc::Markup parses plain text documents and attempts to decompose them into
4
+ # their constituent parts. Some of these parts are high-level: paragraphs,
5
+ # chunks of verbatim text, list entries and the like. Other parts happen at
6
+ # the character level: a piece of bold text, a word in code font. This markup
7
+ # is similar in spirit to that used on WikiWiki webs, where folks create web
8
+ # pages using a simple set of formatting rules.
9
+ #
10
+ # RDoc::Markup and other markup formats do no output formatting, this is
11
+ # handled by the RDoc::Markup::Formatter subclasses.
12
+ #
13
+ # = Markup Formats
14
+ #
15
+ # +RDoc+ supports these markup formats:
16
+ #
17
+ # - +rdoc+:
18
+ # the +RDoc+ markup format;
19
+ # see {RDoc Markup Reference}[rdoc-ref:doc/markup_reference/rdoc.rdoc]
20
+ # - +markdown+:
21
+ # The +markdown+ markup format as described in
22
+ # the {Markdown Guide}[https://www.markdownguide.org];
23
+ # see RDoc::Markdown.
24
+ # - +rd+:
25
+ # the +rd+ markup format format;
26
+ # see RDoc::RD.
27
+ # - +tomdoc+:
28
+ # the TomDoc format as described in
29
+ # {TomDoc for Ruby}[http://tomdoc.org];
30
+ # see RDoc::TomDoc.
31
+ #
32
+ # You can choose a markup format using the following methods:
33
+ #
34
+ # per project::
35
+ # If you build your documentation with rake use RDoc::Task#markup.
36
+ #
37
+ # If you build your documentation by hand run:
38
+ #
39
+ # rdoc --markup your_favorite_format --write-options
40
+ #
41
+ # and commit <tt>.rdoc_options</tt> and ship it with your packaged gem.
42
+ # per file::
43
+ # At the top of the file use the <tt>:markup:</tt> directive to set the
44
+ # default format for the rest of the file.
45
+ # per comment::
46
+ # Use the <tt>:markup:</tt> directive at the top of a comment you want
47
+ # to write in a different format.
48
+ #
49
+ # = RDoc::Markup
50
+ #
51
+ # RDoc::Markup is extensible at runtime: you can add \new markup elements to
52
+ # be recognized in the documents that RDoc::Markup parses.
53
+ #
54
+ # RDoc::Markup is intended to be the basis for a family of tools which share
55
+ # the common requirement that simple, plain-text should be rendered in a
56
+ # variety of different output formats and media. It is envisaged that
57
+ # RDoc::Markup could be the basis for formatting RDoc style comment blocks,
58
+ # Wiki entries, and online FAQs.
59
+ #
60
+ # == Synopsis
61
+ #
62
+ # This code converts +input_string+ to HTML. The conversion takes place in
63
+ # the +convert+ method, so you can use the same RDoc::Markup converter to
64
+ # convert multiple input strings.
65
+ #
66
+ # require 'rdoc'
67
+ #
68
+ # h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
69
+ #
70
+ # puts h.convert(input_string)
71
+ #
72
+ # You can extend the RDoc::Markup parser to recognize new markup
73
+ # sequences, and to add regexp handling. Here we make WikiWords significant to
74
+ # the parser, and also make the sequences {word} and \<no>text...</no> signify
75
+ # strike-through text. We then subclass the HTML output class to deal
76
+ # with these:
77
+ #
78
+ # require 'rdoc'
79
+ #
80
+ # class WikiHtml < RDoc::Markup::ToHtml
81
+ # def handle_regexp_WIKIWORD(target)
82
+ # "<font color=red>" + target + "</font>"
83
+ # end
84
+ # end
85
+ #
86
+ # markup = RDoc::Markup.new
87
+ # markup.add_word_pair("{", "}", :STRIKE)
88
+ # markup.add_html("no", :STRIKE)
89
+ #
90
+ # markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
91
+ #
92
+ # wh = WikiHtml.new RDoc::Options.new, markup
93
+ # wh.add_tag(:STRIKE, "<strike>", "</strike>")
94
+ #
95
+ # puts "<body>#{wh.convert ARGF.read}</body>"
96
+ #
97
+ # == Encoding
98
+ #
99
+ # Where Encoding support is available, RDoc will automatically convert all
100
+ # documents to the same output encoding. The output encoding can be set via
101
+ # RDoc::Options#encoding and defaults to Encoding.default_external.
102
+ #
103
+ # = \RDoc Markup Reference
104
+ #
105
+ # See {RDoc Markup Reference}[rdoc-ref:doc/markup_reference/rdoc.rdoc]
106
+ #
107
+ #--
108
+ # Original Author:: Dave Thomas, dave@pragmaticprogrammer.com
109
+ # License:: Ruby license
110
+
111
+ class RDoc::Markup
112
+
113
+ # Array of regexp handling pattern and its name. A regexp handling
114
+ # sequence is something like a WikiWord
115
+
116
+ attr_reader :regexp_handlings
117
+
118
+ ##
119
+ # Parses +str+ into an RDoc::Markup::Document.
120
+
121
+ def self.parse(str)
122
+ RDoc::Markup::Parser.parse str
123
+ rescue RDoc::Markup::Parser::Error => e
124
+ $stderr.puts <<-EOF
125
+ While parsing markup, RDoc encountered a #{e.class}:
126
+
127
+ #{e}
128
+ \tfrom #{e.backtrace.join "\n\tfrom "}
129
+
130
+ ---8<---
131
+ #{text}
132
+ ---8<---
133
+
134
+ RDoc #{RDoc::VERSION}
135
+
136
+ Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
137
+
138
+ Please file a bug report with the above information at:
139
+
140
+ https://github.com/ruby/rdoc/issues
141
+
142
+ EOF
143
+ raise
144
+ end
145
+
146
+ ##
147
+ # Take a block of text and use various heuristics to determine its
148
+ # structure (paragraphs, lists, and so on). Invoke an event handler as we
149
+ # identify significant chunks.
150
+
151
+ def initialize
152
+ @regexp_handlings = []
153
+ @output = nil
154
+ end
155
+
156
+ ##
157
+ # Add to other inline sequences. For example, we could add WikiWords using
158
+ # something like:
159
+ #
160
+ # parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
161
+ #
162
+ # Each wiki word will be presented to the output formatter.
163
+
164
+ def add_regexp_handling(pattern, name)
165
+ @regexp_handlings << [pattern, name]
166
+ end
167
+
168
+ ##
169
+ # We take +input+, parse it if necessary, then invoke the output +formatter+
170
+ # using a Visitor to render the result.
171
+
172
+ def convert(input, formatter)
173
+ document = case input
174
+ when RDoc::Markup::Document then
175
+ input
176
+ else
177
+ RDoc::Markup::Parser.parse input
178
+ end
179
+
180
+ document.accept formatter
181
+ end
182
+
183
+ autoload :Parser, "#{__dir__}/markup/parser"
184
+ autoload :InlineParser, "#{__dir__}/markup/inline_parser"
185
+ autoload :PreProcess, "#{__dir__}/markup/pre_process"
186
+
187
+ # RDoc::Markup AST
188
+ autoload :BlankLine, "#{__dir__}/markup/blank_line"
189
+ autoload :BlockQuote, "#{__dir__}/markup/block_quote"
190
+ autoload :Document, "#{__dir__}/markup/document"
191
+ autoload :Element, "#{__dir__}/markup/element"
192
+ autoload :HardBreak, "#{__dir__}/markup/hard_break"
193
+ autoload :Heading, "#{__dir__}/markup/heading"
194
+ autoload :Include, "#{__dir__}/markup/include"
195
+ autoload :IndentedParagraph, "#{__dir__}/markup/indented_paragraph"
196
+ autoload :List, "#{__dir__}/markup/list"
197
+ autoload :ListItem, "#{__dir__}/markup/list_item"
198
+ autoload :Paragraph, "#{__dir__}/markup/paragraph"
199
+ autoload :Table, "#{__dir__}/markup/table"
200
+ autoload :Raw, "#{__dir__}/markup/raw"
201
+ autoload :Rule, "#{__dir__}/markup/rule"
202
+ autoload :Verbatim, "#{__dir__}/markup/verbatim"
203
+
204
+ # Formatters
205
+ autoload :Formatter, "#{__dir__}/markup/formatter"
206
+
207
+ autoload :ToAnsi, "#{__dir__}/markup/to_ansi"
208
+ autoload :ToBs, "#{__dir__}/markup/to_bs"
209
+ autoload :ToHtml, "#{__dir__}/markup/to_html"
210
+ autoload :ToHtmlCrossref, "#{__dir__}/markup/to_html_crossref"
211
+ autoload :ToHtmlSnippet, "#{__dir__}/markup/to_html_snippet"
212
+ autoload :ToLabel, "#{__dir__}/markup/to_label"
213
+ autoload :ToMarkdown, "#{__dir__}/markup/to_markdown"
214
+ autoload :ToRdoc, "#{__dir__}/markup/to_rdoc"
215
+ autoload :ToTableOfContents, "#{__dir__}/markup/to_table_of_contents"
216
+ autoload :ToTest, "#{__dir__}/markup/to_test"
217
+ autoload :ToTtOnly, "#{__dir__}/markup/to_tt_only"
218
+
219
+ end