rdoc 5.1.0 → 6.13.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 (179) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.rdoc +5 -6
  3. data/ExampleMarkdown.md +2 -0
  4. data/ExampleRDoc.rdoc +2 -0
  5. data/History.rdoc +68 -66
  6. data/LEGAL.rdoc +1 -1
  7. data/LICENSE.rdoc +2 -0
  8. data/README.rdoc +18 -6
  9. data/RI.md +842 -0
  10. data/TODO.rdoc +8 -7
  11. data/exe/rdoc +0 -1
  12. data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -12
  13. data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +1 -2
  14. data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +83 -26
  15. data/lib/rdoc/{attr.rb → code_object/attr.rb} +5 -9
  16. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +112 -24
  17. data/lib/rdoc/{constant.rb → code_object/constant.rb} +4 -5
  18. data/lib/rdoc/{context → code_object/context}/section.rb +13 -83
  19. data/lib/rdoc/{context.rb → code_object/context.rb} +69 -70
  20. data/lib/rdoc/{extend.rb → code_object/extend.rb} +1 -2
  21. data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +1 -2
  22. data/lib/rdoc/{include.rb → code_object/include.rb} +1 -2
  23. data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +1 -2
  24. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +22 -31
  25. data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +1 -2
  26. data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +4 -5
  27. data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
  28. data/lib/rdoc/{require.rb → code_object/require.rb} +2 -3
  29. data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +6 -2
  30. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +22 -32
  31. data/lib/rdoc/code_object.rb +8 -41
  32. data/lib/rdoc/code_objects.rb +2 -3
  33. data/lib/rdoc/comment.rb +48 -41
  34. data/lib/rdoc/cross_reference.rb +77 -33
  35. data/lib/rdoc/encoding.rb +50 -38
  36. data/lib/rdoc/erb_partial.rb +2 -3
  37. data/lib/rdoc/erbio.rb +4 -5
  38. data/lib/rdoc/generator/darkfish.rb +178 -125
  39. data/lib/rdoc/generator/json_index.rb +9 -22
  40. data/lib/rdoc/generator/markup.rb +6 -17
  41. data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
  42. data/lib/rdoc/generator/pot/po.rb +3 -3
  43. data/lib/rdoc/generator/pot/po_entry.rb +12 -12
  44. data/lib/rdoc/generator/pot.rb +4 -8
  45. data/lib/rdoc/generator/ri.rb +1 -2
  46. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
  47. data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -12
  48. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
  49. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
  50. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
  51. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
  52. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +19 -10
  53. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +26 -6
  54. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
  55. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
  56. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  57. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +27 -6
  58. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  59. data/lib/rdoc/generator/template/darkfish/class.rhtml +125 -78
  60. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +430 -339
  61. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  62. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  63. data/lib/rdoc/generator/template/darkfish/index.rhtml +13 -13
  64. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +51 -92
  65. data/lib/rdoc/generator/template/darkfish/js/search.js +35 -34
  66. data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
  67. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
  68. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +20 -18
  69. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +32 -20
  70. data/lib/rdoc/generator/template/json_index/js/navigation.js +12 -49
  71. data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
  72. data/lib/rdoc/generator.rb +6 -6
  73. data/lib/rdoc/i18n/locale.rb +1 -1
  74. data/lib/rdoc/i18n/text.rb +5 -5
  75. data/lib/rdoc/i18n.rb +4 -4
  76. data/lib/rdoc/known_classes.rb +6 -5
  77. data/lib/rdoc/markdown/entities.rb +1 -2
  78. data/lib/rdoc/markdown/literals.kpeg +1 -2
  79. data/lib/rdoc/markdown/literals.rb +99 -50
  80. data/lib/rdoc/markdown.kpeg +115 -58
  81. data/lib/rdoc/markdown.rb +1584 -902
  82. data/lib/rdoc/markup/attr_changer.rb +1 -2
  83. data/lib/rdoc/markup/attr_span.rb +9 -4
  84. data/lib/rdoc/markup/attribute_manager.rb +118 -57
  85. data/lib/rdoc/markup/attributes.rb +7 -8
  86. data/lib/rdoc/markup/blank_line.rb +1 -2
  87. data/lib/rdoc/markup/block_quote.rb +1 -2
  88. data/lib/rdoc/markup/document.rb +1 -2
  89. data/lib/rdoc/markup/formatter.rb +44 -37
  90. data/lib/rdoc/markup/hard_break.rb +1 -2
  91. data/lib/rdoc/markup/heading.rb +11 -6
  92. data/lib/rdoc/markup/include.rb +1 -2
  93. data/lib/rdoc/markup/indented_paragraph.rb +1 -2
  94. data/lib/rdoc/markup/list.rb +1 -2
  95. data/lib/rdoc/markup/list_item.rb +1 -2
  96. data/lib/rdoc/markup/paragraph.rb +1 -2
  97. data/lib/rdoc/markup/parser.rb +90 -48
  98. data/lib/rdoc/markup/pre_process.rb +38 -11
  99. data/lib/rdoc/markup/raw.rb +1 -2
  100. data/lib/rdoc/markup/regexp_handling.rb +40 -0
  101. data/lib/rdoc/markup/rule.rb +1 -2
  102. data/lib/rdoc/markup/table.rb +56 -0
  103. data/lib/rdoc/markup/to_ansi.rb +1 -2
  104. data/lib/rdoc/markup/to_bs.rb +30 -5
  105. data/lib/rdoc/markup/to_html.rb +95 -40
  106. data/lib/rdoc/markup/to_html_crossref.rb +108 -43
  107. data/lib/rdoc/markup/to_html_snippet.rb +13 -11
  108. data/lib/rdoc/markup/to_joined_paragraph.rb +6 -32
  109. data/lib/rdoc/markup/to_label.rb +11 -12
  110. data/lib/rdoc/markup/to_markdown.rb +13 -14
  111. data/lib/rdoc/markup/to_rdoc.rb +49 -31
  112. data/lib/rdoc/markup/to_table_of_contents.rb +2 -2
  113. data/lib/rdoc/markup/to_test.rb +1 -2
  114. data/lib/rdoc/markup/to_tt_only.rb +3 -4
  115. data/lib/rdoc/markup/verbatim.rb +1 -2
  116. data/lib/rdoc/markup.rb +64 -694
  117. data/lib/rdoc/options.rb +226 -44
  118. data/lib/rdoc/parser/c.rb +231 -246
  119. data/lib/rdoc/parser/changelog.rb +169 -23
  120. data/lib/rdoc/parser/markdown.rb +1 -3
  121. data/lib/rdoc/parser/prism_ruby.rb +1092 -0
  122. data/lib/rdoc/parser/rd.rb +1 -2
  123. data/lib/rdoc/parser/ripper_state_lex.rb +302 -0
  124. data/lib/rdoc/parser/ruby.rb +695 -478
  125. data/lib/rdoc/parser/ruby_tools.rb +33 -36
  126. data/lib/rdoc/parser/simple.rb +4 -4
  127. data/lib/rdoc/parser/text.rb +1 -2
  128. data/lib/rdoc/parser.rb +37 -42
  129. data/lib/rdoc/rd/block_parser.rb +708 -57
  130. data/lib/rdoc/rd/block_parser.ry +15 -11
  131. data/lib/rdoc/rd/inline.rb +5 -6
  132. data/lib/rdoc/rd/inline_parser.rb +787 -140
  133. data/lib/rdoc/rd/inline_parser.ry +1 -1
  134. data/lib/rdoc/rd.rb +4 -5
  135. data/lib/rdoc/rdoc.rb +72 -87
  136. data/lib/rdoc/ri/driver.rb +236 -152
  137. data/lib/rdoc/ri/formatter.rb +1 -1
  138. data/lib/rdoc/ri/paths.rb +4 -18
  139. data/lib/rdoc/ri/store.rb +1 -2
  140. data/lib/rdoc/ri/task.rb +2 -2
  141. data/lib/rdoc/ri.rb +5 -6
  142. data/lib/rdoc/rubygems_hook.rb +98 -20
  143. data/lib/rdoc/servlet.rb +30 -20
  144. data/lib/rdoc/stats/normal.rb +24 -18
  145. data/lib/rdoc/stats/quiet.rb +1 -2
  146. data/lib/rdoc/stats/verbose.rb +1 -3
  147. data/lib/rdoc/stats.rb +6 -7
  148. data/lib/rdoc/store.rb +84 -55
  149. data/lib/rdoc/task.rb +35 -10
  150. data/lib/rdoc/text.rb +40 -27
  151. data/lib/rdoc/token_stream.rb +56 -34
  152. data/lib/rdoc/tom_doc.rb +18 -19
  153. data/lib/rdoc/version.rb +10 -0
  154. data/lib/rdoc.rb +80 -56
  155. data/lib/rubygems_plugin.rb +23 -0
  156. data/man/ri.1 +247 -0
  157. metadata +45 -99
  158. data/.document +0 -5
  159. data/.gitignore +0 -13
  160. data/.travis.yml +0 -24
  161. data/Gemfile +0 -3
  162. data/RI.rdoc +0 -57
  163. data/Rakefile +0 -133
  164. data/bin/console +0 -7
  165. data/bin/setup +0 -6
  166. data/lib/gauntlet_rdoc.rb +0 -82
  167. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  168. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  169. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  170. data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
  171. data/lib/rdoc/generator/template/json_index/.document +0 -1
  172. data/lib/rdoc/markup/formatter_test_case.rb +0 -764
  173. data/lib/rdoc/markup/inline.rb +0 -2
  174. data/lib/rdoc/markup/special.rb +0 -41
  175. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -115
  176. data/lib/rdoc/ruby_lex.rb +0 -1367
  177. data/lib/rdoc/ruby_token.rb +0 -461
  178. data/lib/rdoc/test_case.rb +0 -204
  179. data/rdoc.gemspec +0 -57
data/lib/rdoc/markup.rb CHANGED
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # RDoc::Markup parses plain text documents and attempts to decompose them into
4
4
  # their constituent parts. Some of these parts are high-level: paragraphs,
@@ -10,19 +10,24 @@
10
10
  # RDoc::Markup and other markup formats do no output formatting, this is
11
11
  # handled by the RDoc::Markup::Formatter subclasses.
12
12
  #
13
- # = Supported Formats
14
- #
15
- # Besides the RDoc::Markup format, the following formats are built in to RDoc:
16
- #
17
- # markdown::
18
- # The markdown format as described by
19
- # http://daringfireball.net/projects/markdown/. See RDoc::Markdown for
20
- # details on the parser and supported extensions.
21
- # rd::
22
- # The rdtool format. See RDoc::RD for details on the parser and format.
23
- # tomdoc::
24
- # The TomDoc format as described by http://tomdoc.org/. See RDoc::TomDoc
25
- # for details on the parser and supported extensions.
13
+ # = Markup Formats
14
+ #
15
+ # +RDoc+ supports these markup formats:
16
+ #
17
+ # - +rdoc+:
18
+ # the +RDoc+ markup format;
19
+ # see RDoc::MarkupReference.
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.
26
31
  #
27
32
  # You can choose a markup format using the following methods:
28
33
  #
@@ -65,17 +70,16 @@
65
70
  # puts h.convert(input_string)
66
71
  #
67
72
  # You can extend the RDoc::Markup parser to recognize new markup
68
- # sequences, and to add special processing for text that matches a
69
- # regular expression. Here we make WikiWords significant to the parser,
70
- # and also make the sequences {word} and \<no>text...</no> signify
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
71
75
  # strike-through text. We then subclass the HTML output class to deal
72
76
  # with these:
73
77
  #
74
78
  # require 'rdoc'
75
79
  #
76
80
  # class WikiHtml < RDoc::Markup::ToHtml
77
- # def handle_special_WIKIWORD(special)
78
- # "<font color=red>" + special.text + "</font>"
81
+ # def handle_regexp_WIKIWORD(target)
82
+ # "<font color=red>" + target.text + "</font>"
79
83
  # end
80
84
  # end
81
85
  #
@@ -83,7 +87,7 @@
83
87
  # markup.add_word_pair("{", "}", :STRIKE)
84
88
  # markup.add_html("no", :STRIKE)
85
89
  #
86
- # markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
90
+ # markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
87
91
  #
88
92
  # wh = WikiHtml.new RDoc::Options.new, markup
89
93
  # wh.add_tag(:STRIKE, "<strike>", "</strike>")
@@ -98,638 +102,7 @@
98
102
  #
99
103
  # = \RDoc Markup Reference
100
104
  #
101
- # == Block Markup
102
- #
103
- # === Paragraphs and Verbatim
104
- #
105
- # The markup engine looks for a document's natural left margin. This is
106
- # used as the initial margin for the document.
107
- #
108
- # Consecutive lines starting at this margin are considered to be a
109
- # paragraph. Empty lines separate paragraphs.
110
- #
111
- # Any line that starts to the right of the current margin is treated
112
- # as verbatim text. This is useful for code listings:
113
- #
114
- # 3.times { puts "Ruby" }
115
- #
116
- # In verbatim text, two or more blank lines are collapsed into one,
117
- # and trailing blank lines are removed:
118
- #
119
- # This is the first line
120
- #
121
- #
122
- # This is the second non-blank line,
123
- # after 2 blank lines in the source markup.
124
- #
125
- #
126
- # There were two trailing blank lines right above this paragraph, that
127
- # have been removed. In addition, the verbatim text has been shifted
128
- # left, so the amount of indentation of verbatim text is unimportant.
129
- #
130
- # For HTML output RDoc makes a small effort to determine if a verbatim section
131
- # contains Ruby source code. If so, the verbatim block will be marked up as
132
- # HTML. Triggers include "def", "class", "module", "require", the "hash
133
- # rocket"# (=>) or a block call with a parameter.
134
- #
135
- # === Headers
136
- #
137
- # A line starting with an equal sign (=) is treated as a
138
- # heading. Level one headings have one equals sign, level two headings
139
- # have two, and so on until level six, which is the maximum
140
- # (seven hyphens or more result in a level six heading).
141
- #
142
- # For example, the above header was obtained with:
143
- #
144
- # === Headers
145
- #
146
- # In HTML output headers have an id matching their name. The above example's
147
- # HTML is:
148
- #
149
- # <h3 id="label-Headers">Headers</h3>
150
- #
151
- # If a heading is inside a method body the id will be prefixed with the
152
- # method's id. If the above header where in the documentation for a method
153
- # such as:
154
- #
155
- # ##
156
- # # This method does fun things
157
- # #
158
- # # = Example
159
- # #
160
- # # Example of fun things goes here ...
161
- #
162
- # def do_fun_things
163
- # end
164
- #
165
- # The header's id would be:
166
- #
167
- # <h1 id="method-i-do_fun_things-label-Example">Example</h1>
168
- #
169
- # The label can be linked-to using <tt>SomeClass@Headers</tt>. See
170
- # {Links}[RDoc::Markup@Links] for further details.
171
- #
172
- # === Rules
173
- #
174
- # A line starting with three or more hyphens (at the current indent)
175
- # generates a horizontal rule.
176
- #
177
- # ---
178
- #
179
- # produces:
180
- #
181
- # ---
182
- #
183
- # === Simple Lists
184
- #
185
- # If a paragraph starts with a "*", "-", "<digit>." or "<letter>.",
186
- # then it is taken to be the start of a list. The margin is increased to be
187
- # the first non-space following the list start flag. Subsequent lines
188
- # should be indented to this new margin until the list ends. For example:
189
- #
190
- # * this is a list with three paragraphs in
191
- # the first item. This is the first paragraph.
192
- #
193
- # And this is the second paragraph.
194
- #
195
- # 1. This is an indented, numbered list.
196
- # 2. This is the second item in that list
197
- #
198
- # This is the third conventional paragraph in the
199
- # first list item.
200
- #
201
- # * This is the second item in the original list
202
- #
203
- # produces:
204
- #
205
- # * this is a list with three paragraphs in
206
- # the first item. This is the first paragraph.
207
- #
208
- # And this is the second paragraph.
209
- #
210
- # 1. This is an indented, numbered list.
211
- # 2. This is the second item in that list
212
- #
213
- # This is the third conventional paragraph in the
214
- # first list item.
215
- #
216
- # * This is the second item in the original list
217
- #
218
- # === Labeled Lists
219
- #
220
- # You can also construct labeled lists, sometimes called description
221
- # or definition lists. Do this by putting the label in square brackets
222
- # and indenting the list body:
223
- #
224
- # [cat] a small furry mammal
225
- # that seems to sleep a lot
226
- #
227
- # [ant] a little insect that is known
228
- # to enjoy picnics
229
- #
230
- # produces:
231
- #
232
- # [cat] a small furry mammal
233
- # that seems to sleep a lot
234
- #
235
- # [ant] a little insect that is known
236
- # to enjoy picnics
237
- #
238
- # If you want the list bodies to line up to the left of the labels,
239
- # use two colons:
240
- #
241
- # cat:: a small furry mammal
242
- # that seems to sleep a lot
243
- #
244
- # ant:: a little insect that is known
245
- # to enjoy picnics
246
- #
247
- # produces:
248
- #
249
- # cat:: a small furry mammal
250
- # that seems to sleep a lot
251
- #
252
- # ant:: a little insect that is known
253
- # to enjoy picnics
254
- #
255
- # Notice that blank lines right after the label are ignored in labeled lists:
256
- #
257
- # [one]
258
- #
259
- # definition 1
260
- #
261
- # [two]
262
- #
263
- # definition 2
264
- #
265
- # produces the same output as
266
- #
267
- # [one] definition 1
268
- # [two] definition 2
269
- #
270
- #
271
- # === Lists and Verbatim
272
- #
273
- # If you want to introduce a verbatim section right after a list, it has to be
274
- # less indented than the list item bodies, but more indented than the list
275
- # label, letter, digit or bullet. For instance:
276
- #
277
- # * point 1
278
- #
279
- # * point 2, first paragraph
280
- #
281
- # point 2, second paragraph
282
- # verbatim text inside point 2
283
- # point 2, third paragraph
284
- # verbatim text outside of the list (the list is therefore closed)
285
- # regular paragraph after the list
286
- #
287
- # produces:
288
- #
289
- # * point 1
290
- #
291
- # * point 2, first paragraph
292
- #
293
- # point 2, second paragraph
294
- # verbatim text inside point 2
295
- # point 2, third paragraph
296
- # verbatim text outside of the list (the list is therefore closed)
297
- # regular paragraph after the list
298
- #
299
- # == Text Markup
300
- #
301
- # === Bold, Italic, Typewriter Text
302
- #
303
- # You can use markup within text (except verbatim) to change the
304
- # appearance of parts of that text. Out of the box, RDoc::Markup
305
- # supports word-based and general markup.
306
- #
307
- # Word-based markup uses flag characters around individual words:
308
- #
309
- # <tt>\*_word_\*</tt>:: displays _word_ in a *bold* font
310
- # <tt>\__word_\_</tt>:: displays _word_ in an _emphasized_ font
311
- # <tt>\+_word_\+</tt>:: displays _word_ in a +code+ font
312
- #
313
- # General markup affects text between a start delimiter and an end
314
- # delimiter. Not surprisingly, these delimiters look like HTML markup.
315
- #
316
- # <tt>\<b>_text_</b></tt>:: displays _text_ in a *bold* font
317
- # <tt>\<em>_text_</em></tt>:: displays _text_ in an _emphasized_ font
318
- # (alternate tag: <tt>\<i></tt>)
319
- # <tt>\<tt>_text_\</tt></tt>:: displays _text_ in a +code+ font
320
- # (alternate tag: <tt>\<code></tt>)
321
- #
322
- # Unlike conventional Wiki markup, general markup can cross line
323
- # boundaries. You can turn off the interpretation of markup by
324
- # preceding the first character with a backslash (see <i>Escaping
325
- # Text Markup</i>, below).
326
- #
327
- # === Links
328
- #
329
- # Links to starting with +http:+, +https:+, +mailto:+, +ftp:+ or +www.+
330
- # are recognized. An HTTP url that references an external image is converted
331
- # into an inline image element.
332
- #
333
- # Classes and methods will be automatically linked to their definition. For
334
- # example, <tt>RDoc::Markup</tt> will link to this documentation. By default
335
- # methods will only be automatically linked if they contain an <tt>_</tt> (all
336
- # methods can be automatically linked through the <tt>--hyperlink-all</tt>
337
- # command line option).
338
- #
339
- # Single-word methods can be linked by using the <tt>#</tt> character for
340
- # instance methods or <tt>::</tt> for class methods. For example,
341
- # <tt>#convert</tt> links to #convert. A class or method may be combined like
342
- # <tt>RDoc::Markup#convert</tt>.
343
- #
344
- # A heading inside the documentation can be linked by following the class
345
- # or method by an <tt>@</tt> then the heading name.
346
- # <tt>RDoc::Markup@Links</tt> will link to this section like this:
347
- # RDoc::Markup@Links. Spaces in headings with multiple words must be escaped
348
- # with <tt>+</tt> like <tt>RDoc::Markup@Escaping+Text+Markup</tt>.
349
- # Punctuation and other special characters must be escaped like CGI.escape.
350
- #
351
- # The <tt>@</tt> can also be used to link to sections. If a section and a
352
- # heading share the same name the section is preferred for the link.
353
- #
354
- # Links can also be of the form <tt>label[url]</tt>, in which case +label+ is
355
- # used in the displayed text, and +url+ is used as the target. If +label+
356
- # contains multiple words, put it in braces: <tt>{multi word label}[url]</tt>.
357
- # The +url+ may be an +http:+-type link or a cross-reference to a class,
358
- # module or method with a label.
359
- #
360
- # Links with the <code>rdoc-image:</code> scheme will create an image tag for
361
- # HTML output. Only fully-qualified URLs are supported.
362
- #
363
- # Links with the <tt>rdoc-ref:</tt> scheme will link to the referenced class,
364
- # module, method, file, etc. If the referenced item is does not exist
365
- # no link will be generated and <tt>rdoc-ref:</tt> will be removed from the
366
- # resulting text.
367
- #
368
- # Links starting with <tt>rdoc-label:label_name</tt> will link to the
369
- # +label_name+. You can create a label for the current link (for
370
- # bidirectional links) by supplying a name for the current link like
371
- # <tt>rdoc-label:label-other:label-mine</tt>.
372
- #
373
- # Links starting with +link:+ refer to local files whose path is relative to
374
- # the <tt>--op</tt> directory. Use <tt>rdoc-ref:</tt> instead of
375
- # <tt>link:</tt> to link to files generated by RDoc as the link target may
376
- # be different across RDoc generators.
377
- #
378
- # Example links:
379
- #
380
- # https://github.com/rdoc/rdoc
381
- # mailto:user@example.com
382
- # {RDoc Documentation}[http://rdoc.rubyforge.org]
383
- # {RDoc Markup}[rdoc-ref:RDoc::Markup]
384
- #
385
- # === Escaping Text Markup
386
- #
387
- # Text markup can be escaped with a backslash, as in \<tt>, which was obtained
388
- # with <tt>\\<tt></tt>. Except in verbatim sections and between \<tt> tags,
389
- # to produce a backslash you have to double it unless it is followed by a
390
- # space, tab or newline. Otherwise, the HTML formatter will discard it, as it
391
- # is used to escape potential links:
392
- #
393
- # * The \ must be doubled if not followed by white space: \\.
394
- # * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
395
- # * This is a link to {ruby-lang}[www.ruby-lang.org].
396
- # * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org].
397
- # * This will not be linked to \RDoc::RDoc#document
398
- #
399
- # generates:
400
- #
401
- # * The \ must be doubled if not followed by white space: \\.
402
- # * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
403
- # * This is a link to {ruby-lang}[www.ruby-lang.org]
404
- # * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org]
405
- # * This will not be linked to \RDoc::RDoc#document
406
- #
407
- # Inside \<tt> tags, more precisely, leading backslashes are removed only if
408
- # followed by a markup character (<tt><*_+</tt>), a backslash, or a known link
409
- # reference (a known class or method). So in the example above, the backslash
410
- # of <tt>\S</tt> would be removed if there was a class or module named +S+ in
411
- # the current context.
412
- #
413
- # This behavior is inherited from RDoc version 1, and has been kept for
414
- # compatibility with existing RDoc documentation.
415
- #
416
- # === Conversion of characters
417
- #
418
- # HTML will convert two/three dashes to an em-dash. Other common characters are
419
- # converted as well:
420
- #
421
- # em-dash:: -- or ---
422
- # ellipsis:: ...
423
- #
424
- # single quotes:: 'text' or `text'
425
- # double quotes:: "text" or ``text''
426
- #
427
- # copyright:: (c)
428
- # registered trademark:: (r)
429
- #
430
- # produces:
431
- #
432
- # em-dash:: -- or ---
433
- # ellipsis:: ...
434
- #
435
- # single quotes:: 'text' or `text'
436
- # double quotes:: "text" or ``text''
437
- #
438
- # copyright:: (c)
439
- # registered trademark:: (r)
440
- #
441
- #
442
- # == Documenting Source Code
443
- #
444
- # Comment blocks can be written fairly naturally, either using <tt>#</tt> on
445
- # successive lines of the comment, or by including the comment in
446
- # a <tt>=begin</tt>/<tt>=end</tt> block. If you use the latter form,
447
- # the <tt>=begin</tt> line _must_ be flagged with an +rdoc+ tag:
448
- #
449
- # =begin rdoc
450
- # Documentation to be processed by RDoc.
451
- #
452
- # ...
453
- # =end
454
- #
455
- # RDoc stops processing comments if it finds a comment line starting
456
- # with <tt>--</tt> right after the <tt>#</tt> character (otherwise,
457
- # it will be treated as a rule if it has three dashes or more).
458
- # This can be used to separate external from internal comments,
459
- # or to stop a comment being associated with a method, class, or module.
460
- # Commenting can be turned back on with a line that starts with <tt>++</tt>.
461
- #
462
- # ##
463
- # # Extract the age and calculate the date-of-birth.
464
- # #--
465
- # # FIXME: fails if the birthday falls on February 29th
466
- # #++
467
- # # The DOB is returned as a Time object.
468
- #
469
- # def get_dob(person)
470
- # # ...
471
- # end
472
- #
473
- # Names of classes, files, and any method names containing an underscore or
474
- # preceded by a hash character are automatically linked from comment text to
475
- # their description. This linking works inside the current class or module,
476
- # and with ancestor methods (in included modules or in the superclass).
477
- #
478
- # Method parameter lists are extracted and displayed with the method
479
- # description. If a method calls +yield+, then the parameters passed to yield
480
- # will also be displayed:
481
- #
482
- # def fred
483
- # ...
484
- # yield line, address
485
- #
486
- # This will get documented as:
487
- #
488
- # fred() { |line, address| ... }
489
- #
490
- # You can override this using a comment containing ':yields: ...' immediately
491
- # after the method definition
492
- #
493
- # def fred # :yields: index, position
494
- # # ...
495
- #
496
- # yield line, address
497
- #
498
- # which will get documented as
499
- #
500
- # fred() { |index, position| ... }
501
- #
502
- # +:yields:+ is an example of a documentation directive. These appear
503
- # immediately after the start of the document element they are modifying.
504
- #
505
- # RDoc automatically cross-references words with underscores or camel-case.
506
- # To suppress cross-references, prefix the word with a \ character. To
507
- # include special characters like "<tt>\n</tt>", you'll need to use
508
- # two \ characters in normal text, but only one in \<tt> text:
509
- #
510
- # "\\n" or "<tt>\n</tt>"
511
- #
512
- # produces:
513
- #
514
- # "\\n" or "<tt>\n</tt>"
515
- #
516
- # == Directives
517
- #
518
- # Directives are keywords surrounded by ":" characters.
519
- #
520
- # === Controlling what is documented
521
- #
522
- # [+:nodoc:+ / <tt>:nodoc: all</tt>]
523
- # This directive prevents documentation for the element from
524
- # being generated. For classes and modules, methods, aliases,
525
- # constants, and attributes directly within the affected class or
526
- # module also will be omitted. By default, though, modules and
527
- # classes within that class or module _will_ be documented. This is
528
- # turned off by adding the +all+ modifier.
529
- #
530
- # module MyModule # :nodoc:
531
- # class Input
532
- # end
533
- # end
534
- #
535
- # module OtherModule # :nodoc: all
536
- # class Output
537
- # end
538
- # end
539
- #
540
- # In the above code, only class <tt>MyModule::Input</tt> will be documented.
541
- #
542
- # The +:nodoc:+ directive, like +:enddoc:+, +:stopdoc:+ and +:startdoc:+
543
- # presented below, is local to the current file: if you do not want to
544
- # document a module that appears in several files, specify +:nodoc:+ on each
545
- # appearance, at least once per file.
546
- #
547
- # [+:stopdoc:+ / +:startdoc:+]
548
- # Stop and start adding new documentation elements to the current container.
549
- # For example, if a class has a number of constants that you don't want to
550
- # document, put a +:stopdoc:+ before the first, and a +:startdoc:+ after the
551
- # last. If you don't specify a +:startdoc:+ by the end of the container,
552
- # disables documentation for the rest of the current file.
553
- #
554
- # [+:doc:+]
555
- # Forces a method or attribute to be documented even if it wouldn't be
556
- # otherwise. Useful if, for example, you want to include documentation of a
557
- # particular private method.
558
- #
559
- # [+:enddoc:+]
560
- # Document nothing further at the current level: directives +:startdoc:+ and
561
- # +:doc:+ that appear after this will not be honored for the current container
562
- # (file, class or module), in the current file.
563
- #
564
- # [+:notnew:+ / +:not_new:+ / +:not-new:+ ]
565
- # Only applicable to the +initialize+ instance method. Normally RDoc
566
- # assumes that the documentation and parameters for +initialize+ are
567
- # actually for the +new+ method, and so fakes out a +new+ for the class.
568
- # The +:notnew:+ directive stops this. Remember that +initialize+ is private,
569
- # so you won't see the documentation unless you use the +-a+ command line
570
- # option.
571
- #
572
- # === Method arguments
573
- #
574
- # [+:arg:+ or +:args:+ _parameters_]
575
- # Overrides the default argument handling with exactly these parameters.
576
- #
577
- # ##
578
- # # :args: a, b
579
- #
580
- # def some_method(*a)
581
- # end
582
- #
583
- # [+:yield:+ or +:yields:+ _parameters_]
584
- # Overrides the default yield discovery with these parameters.
585
- #
586
- # ##
587
- # # :yields: key, value
588
- #
589
- # def each_thing &block
590
- # @things.each(&block)
591
- # end
592
- #
593
- # [+:call-seq:+]
594
- # Lines up to the next blank line or lines with a common prefix in the
595
- # comment are treated as the method's calling sequence, overriding the
596
- # default parsing of method parameters and yield arguments.
597
- #
598
- # Multiple lines may be used.
599
- #
600
- # # :call-seq:
601
- # # ARGF.readlines(sep=$/) -> array
602
- # # ARGF.readlines(limit) -> array
603
- # # ARGF.readlines(sep, limit) -> array
604
- # #
605
- # # ARGF.to_a(sep=$/) -> array
606
- # # ARGF.to_a(limit) -> array
607
- # # ARGF.to_a(sep, limit) -> array
608
- # #
609
- # # The remaining lines are documentation ...
610
- #
611
- # === Sections
612
- #
613
- # Sections allow you to group methods in a class into sensible containers. If
614
- # you use the sections 'Public', 'Internal' and 'Deprecated' (the three
615
- # allowed method statuses from TomDoc) the sections will be displayed in that
616
- # order placing the most useful methods at the top. Otherwise, sections will
617
- # be displayed in alphabetical order.
618
- #
619
- # [+:category:+ _section_]
620
- # Adds this item to the named +section+ overriding the current section. Use
621
- # this to group methods by section in RDoc output while maintaining a
622
- # sensible ordering (like alphabetical).
623
- #
624
- # # :category: Utility Methods
625
- # #
626
- # # CGI escapes +text+
627
- #
628
- # def convert_string text
629
- # CGI.escapeHTML text
630
- # end
631
- #
632
- # An empty category will place the item in the default category:
633
- #
634
- # # :category:
635
- # #
636
- # # This method is in the default category
637
- #
638
- # def some_method
639
- # # ...
640
- # end
641
- #
642
- # Unlike the :section: directive, :category: is not sticky. The category
643
- # only applies to the item immediately following the comment.
644
- #
645
- # Use the :section: directive to provide introductory text for a section of
646
- # documentation.
647
- #
648
- # [+:section:+ _title_]
649
- # Provides section introductory text in RDoc output. The title following
650
- # +:section:+ is used as the section name and the remainder of the comment
651
- # containing the section is used as introductory text. A section's comment
652
- # block must be separated from following comment blocks. Use an empty title
653
- # to switch to the default section.
654
- #
655
- # The :section: directive is sticky, so subsequent methods, aliases,
656
- # attributes, and classes will be contained in this section until the
657
- # section is changed. The :category: directive will override the :section:
658
- # directive.
659
- #
660
- # A :section: comment block may have one or more lines before the :section:
661
- # directive. These will be removed, and any identical lines at the end of
662
- # the block are also removed. This allows you to add visual cues to the
663
- # section.
664
- #
665
- # Example:
666
- #
667
- # # ----------------------------------------
668
- # # :section: My Section
669
- # # This is the section that I wrote.
670
- # # See it glisten in the noon-day sun.
671
- # # ----------------------------------------
672
- #
673
- # ##
674
- # # Comment for some_method
675
- #
676
- # def some_method
677
- # # ...
678
- # end
679
- #
680
- # === Other directives
681
- #
682
- # [+:markup:+ _type_]
683
- # Overrides the default markup type for this comment with the specified
684
- # markup type. For Ruby files, if the first comment contains this directive
685
- # it is applied automatically to all comments in the file.
686
- #
687
- # Unless you are converting between markup formats you should use a
688
- # <code>.rdoc_options</code> file to specify the default documentation
689
- # format for your entire project. See RDoc::Options@Saved+Options for
690
- # instructions.
691
- #
692
- # At the top of a file the +:markup:+ directive applies to the entire file:
693
- #
694
- # # coding: UTF-8
695
- # # :markup: TomDoc
696
- #
697
- # # TomDoc comment here ...
698
- #
699
- # class MyClass
700
- # # ...
701
- #
702
- # For just one comment:
703
- #
704
- # # ...
705
- # end
706
- #
707
- # # :markup: RDoc
708
- # #
709
- # # This is a comment in RDoc markup format ...
710
- #
711
- # def some_method
712
- # # ...
713
- #
714
- # See Markup@CONTRIBUTING for instructions on adding a new markup format.
715
- #
716
- # [+:include:+ _filename_]
717
- # Include the contents of the named file at this point. This directive
718
- # must appear alone on one line, possibly preceded by spaces. In this
719
- # position, it can be escaped with a \ in front of the first colon.
720
- #
721
- # The file will be searched for in the directories listed by the +--include+
722
- # option, or in the current directory by default. The contents of the file
723
- # will be shifted to have the same indentation as the ':' at the start of
724
- # the +:include:+ directive.
725
- #
726
- # [+:title:+ _text_]
727
- # Sets the title for the document. Equivalent to the <tt>--title</tt>
728
- # command line parameter. (The command line parameter overrides any :title:
729
- # directive in the source).
730
- #
731
- # [+:main:+ _name_]
732
- # Equivalent to the <tt>--main</tt> command line parameter.
105
+ # See RDoc::MarkupReference.
733
106
  #
734
107
  #--
735
108
  # Original Author:: Dave Thomas, dave@pragmaticprogrammer.com
@@ -764,7 +137,7 @@ Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
764
137
 
765
138
  Please file a bug report with the above information at:
766
139
 
767
- https://github.com/rdoc/rdoc/issues
140
+ https://github.com/ruby/rdoc/issues
768
141
 
769
142
  EOF
770
143
  raise
@@ -800,13 +173,12 @@ https://github.com/rdoc/rdoc/issues
800
173
  # Add to other inline sequences. For example, we could add WikiWords using
801
174
  # something like:
802
175
  #
803
- # parser.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
176
+ # parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
804
177
  #
805
- # Each wiki word will be presented to the output formatter via the
806
- # accept_special method.
178
+ # Each wiki word will be presented to the output formatter.
807
179
 
808
- def add_special(pattern, name)
809
- @attribute_manager.add_special(pattern, name)
180
+ def add_regexp_handling(pattern, name)
181
+ @attribute_manager.add_regexp_handling(pattern, name)
810
182
  end
811
183
 
812
184
  ##
@@ -824,47 +196,45 @@ https://github.com/rdoc/rdoc/issues
824
196
  document.accept formatter
825
197
  end
826
198
 
827
- autoload :Parser, 'rdoc/markup/parser'
828
- autoload :PreProcess, 'rdoc/markup/pre_process'
199
+ autoload :Parser, "#{__dir__}/markup/parser"
200
+ autoload :PreProcess, "#{__dir__}/markup/pre_process"
829
201
 
830
202
  # Inline markup classes
831
- autoload :AttrChanger, 'rdoc/markup/attr_changer'
832
- autoload :AttrSpan, 'rdoc/markup/attr_span'
833
- autoload :Attributes, 'rdoc/markup/attributes'
834
- autoload :AttributeManager, 'rdoc/markup/attribute_manager'
835
- autoload :Special, 'rdoc/markup/special'
203
+ autoload :AttrChanger, "#{__dir__}/markup/attr_changer"
204
+ autoload :AttrSpan, "#{__dir__}/markup/attr_span"
205
+ autoload :Attributes, "#{__dir__}/markup/attributes"
206
+ autoload :AttributeManager, "#{__dir__}/markup/attribute_manager"
207
+ autoload :RegexpHandling, "#{__dir__}/markup/regexp_handling"
836
208
 
837
209
  # RDoc::Markup AST
838
- autoload :BlankLine, 'rdoc/markup/blank_line'
839
- autoload :BlockQuote, 'rdoc/markup/block_quote'
840
- autoload :Document, 'rdoc/markup/document'
841
- autoload :HardBreak, 'rdoc/markup/hard_break'
842
- autoload :Heading, 'rdoc/markup/heading'
843
- autoload :Include, 'rdoc/markup/include'
844
- autoload :IndentedParagraph, 'rdoc/markup/indented_paragraph'
845
- autoload :List, 'rdoc/markup/list'
846
- autoload :ListItem, 'rdoc/markup/list_item'
847
- autoload :Paragraph, 'rdoc/markup/paragraph'
848
- autoload :Raw, 'rdoc/markup/raw'
849
- autoload :Rule, 'rdoc/markup/rule'
850
- autoload :Verbatim, 'rdoc/markup/verbatim'
210
+ autoload :BlankLine, "#{__dir__}/markup/blank_line"
211
+ autoload :BlockQuote, "#{__dir__}/markup/block_quote"
212
+ autoload :Document, "#{__dir__}/markup/document"
213
+ autoload :HardBreak, "#{__dir__}/markup/hard_break"
214
+ autoload :Heading, "#{__dir__}/markup/heading"
215
+ autoload :Include, "#{__dir__}/markup/include"
216
+ autoload :IndentedParagraph, "#{__dir__}/markup/indented_paragraph"
217
+ autoload :List, "#{__dir__}/markup/list"
218
+ autoload :ListItem, "#{__dir__}/markup/list_item"
219
+ autoload :Paragraph, "#{__dir__}/markup/paragraph"
220
+ autoload :Table, "#{__dir__}/markup/table"
221
+ autoload :Raw, "#{__dir__}/markup/raw"
222
+ autoload :Rule, "#{__dir__}/markup/rule"
223
+ autoload :Verbatim, "#{__dir__}/markup/verbatim"
851
224
 
852
225
  # Formatters
853
- autoload :Formatter, 'rdoc/markup/formatter'
854
- autoload :FormatterTestCase, 'rdoc/markup/formatter_test_case'
855
- autoload :TextFormatterTestCase, 'rdoc/markup/text_formatter_test_case'
856
-
857
- autoload :ToAnsi, 'rdoc/markup/to_ansi'
858
- autoload :ToBs, 'rdoc/markup/to_bs'
859
- autoload :ToHtml, 'rdoc/markup/to_html'
860
- autoload :ToHtmlCrossref, 'rdoc/markup/to_html_crossref'
861
- autoload :ToHtmlSnippet, 'rdoc/markup/to_html_snippet'
862
- autoload :ToLabel, 'rdoc/markup/to_label'
863
- autoload :ToMarkdown, 'rdoc/markup/to_markdown'
864
- autoload :ToRdoc, 'rdoc/markup/to_rdoc'
865
- autoload :ToTableOfContents, 'rdoc/markup/to_table_of_contents'
866
- autoload :ToTest, 'rdoc/markup/to_test'
867
- autoload :ToTtOnly, 'rdoc/markup/to_tt_only'
226
+ autoload :Formatter, "#{__dir__}/markup/formatter"
227
+
228
+ autoload :ToAnsi, "#{__dir__}/markup/to_ansi"
229
+ autoload :ToBs, "#{__dir__}/markup/to_bs"
230
+ autoload :ToHtml, "#{__dir__}/markup/to_html"
231
+ autoload :ToHtmlCrossref, "#{__dir__}/markup/to_html_crossref"
232
+ autoload :ToHtmlSnippet, "#{__dir__}/markup/to_html_snippet"
233
+ autoload :ToLabel, "#{__dir__}/markup/to_label"
234
+ autoload :ToMarkdown, "#{__dir__}/markup/to_markdown"
235
+ autoload :ToRdoc, "#{__dir__}/markup/to_rdoc"
236
+ autoload :ToTableOfContents, "#{__dir__}/markup/to_table_of_contents"
237
+ autoload :ToTest, "#{__dir__}/markup/to_test"
238
+ autoload :ToTtOnly, "#{__dir__}/markup/to_tt_only"
868
239
 
869
240
  end
870
-