|
29 | 29 | # see <tt>:nodoc:</tt>, <tt>:doc:</tt>, and <tt>:notnew</tt>. |
30 | 30 | # - \RDoc directives in single-line comments; |
31 | 31 | # see other {Directives}[rdoc-ref:RDoc::MarkupReference@Directives]. |
32 | | -# - The Ruby code itself; |
33 | | -# see {Documentation Derived from Ruby Code}[rdoc-ref:RDoc::MarkupReference@Documentation+Derived+from+Ruby+Code] |
| 32 | +# - The Ruby code itself (but not from C code); |
| 33 | +# see {Documentation Derived from Ruby Code}[rdoc-ref:RDoc::MarkupReference@Documentation+Derived+from+Ruby+Code]. |
34 | 34 | # |
35 | 35 | # == Markup in Comments |
36 | 36 | # |
37 | | -# A single-line or multi-line comment that immediately precedes |
38 | | -# the definition of a class, module, method, alias, constant, or attribute |
39 | | -# becomes the documentation for that defined object. |
| 37 | +# The treatment of markup in comments varies according to the type of file: |
40 | 38 | # |
41 | | -# (\RDoc ignores other such comments that do not precede definitions.) |
| 39 | +# - <tt>.rb</tt> (Ruby code file): markup is parsed from Ruby comments. |
| 40 | +# - <tt>.c</tt> (C code file): markup is parsed from C comments. |
| 41 | +# - <tt>.rdoc</tt> (RDoc text file): markup is parsed from the entire file. |
| 42 | +# |
| 43 | +# The comment associated with |
| 44 | +# a Ruby class, module, method, alias, constant, or attribute |
| 45 | +# becomes the documentation for that defined object: |
| 46 | +# |
| 47 | +# - In a Ruby file, that comment immediately precedes |
| 48 | +# the definition of the object. |
| 49 | +# - In a C file, that comment immediately precedes |
| 50 | +# the function that implements a method, |
| 51 | +# or otherwise immediately precedes the definition of the object. |
| 52 | +# |
| 53 | +# In either a Ruby or a C file, |
| 54 | +# \RDoc ignores comments that do not precede object definitions. |
| 55 | +# |
| 56 | +# In an \RDoc file, the text is not associated with any code object, |
| 57 | +# but may (depending on how the documentation is built), |
| 58 | +# become a separate page. |
| 59 | +# |
| 60 | +# Almost all examples on this page are all RDoc-like; |
| 61 | +# that is, they have no comment markers like Ruby <tt>#</tt> |
| 62 | +# or C <tt>/* ... */</tt>. |
42 | 63 | # |
43 | 64 | # === Margins |
44 | 65 | # |
|
96 | 117 | # |
97 | 118 | # Example input: |
98 | 119 | # |
99 | | -# # \RDoc produces HTML and command-line documentation for Ruby projects. |
100 | | -# # \RDoc includes the rdoc and ri tools for generating and displaying |
101 | | -# # documentation from the command-line. |
102 | | -# # |
103 | | -# # You'll love it. |
| 120 | +# \RDoc produces HTML and command-line documentation for Ruby projects. |
| 121 | +# \RDoc includes the rdoc and ri tools for generating and displaying |
| 122 | +# documentation from the command-line. |
| 123 | +# |
| 124 | +# You'll love it. |
104 | 125 | # |
105 | 126 | # Rendered HTML: |
106 | 127 | # >>> |
|
133 | 154 | # |
134 | 155 | # Example input: |
135 | 156 | # |
136 | | -# # This is not verbatim text. |
137 | | -# # |
138 | | -# # This is verbatim text. |
139 | | -# # Whitespace is honored. # See? |
140 | | -# # Whitespace is honored. # See? |
141 | | -# # |
142 | | -# # This is still the same verbatim text block. |
143 | | -# # |
144 | | -# # This is not verbatim text. |
| 157 | +# This is not verbatim text. |
| 158 | +# |
| 159 | +# This is verbatim text. |
| 160 | +# Whitespace is honored. # See? |
| 161 | +# Whitespace is honored. # See? |
| 162 | +# |
| 163 | +# This is still the same verbatim text block. |
| 164 | +# |
| 165 | +# This is not verbatim text. |
145 | 166 | # |
146 | 167 | # Rendered HTML: |
147 | 168 | # >>> |
|
279 | 300 | # |
280 | 301 | # Example input: |
281 | 302 | # |
282 | | -# # - An item. |
283 | | -# # - Another. |
284 | | -# # - An item spanning |
285 | | -# # multiple lines. |
286 | | -# # |
287 | | -# # * Yet another. |
288 | | -# # - Last one. |
| 303 | +# - An item. |
| 304 | +# - Another. |
| 305 | +# - An item spanning |
| 306 | +# multiple lines. |
| 307 | +# |
| 308 | +# * Yet another. |
| 309 | +# - Last one. |
289 | 310 | # |
290 | 311 | # Rendered HTML: |
291 | 312 | # >>> |
|
305 | 326 | # |
306 | 327 | # Example input: |
307 | 328 | # |
308 | | -# # 100. An item. |
309 | | -# # 10. Another. |
310 | | -# # 1. An item spanning |
311 | | -# # multiple lines. |
312 | | -# # |
313 | | -# # 1. Yet another. |
314 | | -# # 1000. Last one. |
| 329 | +# 100. An item. |
| 330 | +# 10. Another. |
| 331 | +# 1. An item spanning |
| 332 | +# multiple lines. |
| 333 | +# |
| 334 | +# 1. Yet another. |
| 335 | +# 1000. Last one. |
315 | 336 | # |
316 | 337 | # Rendered HTML: |
317 | 338 | # >>> |
|
331 | 352 | # |
332 | 353 | # Example input: |
333 | 354 | # |
334 | | -# # z. An item. |
335 | | -# # y. Another. |
336 | | -# # x. An item spanning |
337 | | -# # multiple lines. |
338 | | -# # |
339 | | -# # x. Yet another. |
340 | | -# # a. Last one. |
| 355 | +# z. An item. |
| 356 | +# y. Another. |
| 357 | +# x. An item spanning |
| 358 | +# multiple lines. |
| 359 | +# |
| 360 | +# x. Yet another. |
| 361 | +# a. Last one. |
341 | 362 | # |
342 | 363 | # Rendered HTML: |
343 | 364 | # >>> |
|
356 | 377 | # |
357 | 378 | # Example input: |
358 | 379 | # |
359 | | -# # [foo] An item. |
360 | | -# # bat:: Another. |
361 | | -# # [bag] An item spanning |
362 | | -# # multiple lines. |
363 | | -# # |
364 | | -# # [bar baz] Yet another. |
365 | | -# # bam:: Last one. |
| 380 | +# [foo] An item. |
| 381 | +# bat:: Another. |
| 382 | +# [bag] An item spanning |
| 383 | +# multiple lines. |
| 384 | +# |
| 385 | +# [bar baz] Yet another. |
| 386 | +# bam:: Last one. |
366 | 387 | # |
367 | 388 | # Rendered HTML: |
368 | 389 | # >>> |
|
381 | 402 | # |
382 | 403 | # Examples: |
383 | 404 | # |
384 | | -# # = Section 1 |
385 | | -# # == Section 1.1 |
386 | | -# # === Section 1.1.1 |
387 | | -# # === Section 1.1.2 |
388 | | -# # == Section 1.2 |
389 | | -# # = Section 2 |
390 | | -# # = Foo |
391 | | -# # == Bar |
392 | | -# # === Baz |
393 | | -# # ==== Bam |
394 | | -# # ===== Bat |
395 | | -# # ====== Bad |
396 | | -# # ============Still a Heading (Level 6) |
397 | | -# # \== Not a Heading |
| 405 | +# = Section 1 |
| 406 | +# == Section 1.1 |
| 407 | +# === Section 1.1.1 |
| 408 | +# === Section 1.1.2 |
| 409 | +# == Section 1.2 |
| 410 | +# = Section 2 |
| 411 | +# = Foo |
| 412 | +# == Bar |
| 413 | +# === Baz |
| 414 | +# ==== Bam |
| 415 | +# ===== Bat |
| 416 | +# ====== Bad |
| 417 | +# ============Still a Heading (Level 6) |
| 418 | +# \== Not a Heading |
398 | 419 | # |
399 | 420 | # A heading may contain only one type of nested block: |
400 | 421 | # |
@@ -1147,10 +1168,10 @@ def dummy_instance_method(foo, bar); end; |
1147 | 1168 | # |
1148 | 1169 | # Here is the <tt>:call-seq:</tt> directive given for the method: |
1149 | 1170 | # |
1150 | | - # # :call-seq: |
1151 | | - # # call_seq_directive(foo, bar) |
1152 | | - # # Can be anything -> bar |
1153 | | - # # Also anything more -> baz or bat |
| 1171 | + # :call-seq: |
| 1172 | + # call_seq_directive(foo, bar) |
| 1173 | + # Can be anything -> bar |
| 1174 | + # Also anything more -> baz or bat |
1154 | 1175 | # |
1155 | 1176 | def call_seq_directive |
1156 | 1177 | nil |
|
0 commit comments