Skip to content

Commit b00978b

Browse files
[DOC] Clarifications for directives (#903)
- Former section "Directives in Trailing Comments" is reworked. The important thing about a directive is what it does, not whether it's trailing or stand-alone. Therefore I've worked the directives in the former section into the appropriate sections, based on function. - Each directive is now explicitly marked as trailing or stand-alone. - C-code directives are mentioned only for those directives that actually appear in our ruby/ruby C files, which are :startdoc:, :stopdoc:, :enddoc:, :include:, and :call-seq:. What effect, if any, other directives have in C, I'm not sure about.
1 parent 4288882 commit b00978b

File tree

1 file changed

+117
-91
lines changed

1 file changed

+117
-91
lines changed

doc/rdoc/markup_reference.rb

Lines changed: 117 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -327,65 +327,120 @@
327327
#
328328
# ===== Directives for Allowing or Suppressing Documentation
329329
#
330-
# Each directive described in this section must appear on a line by itself.
330+
# - <tt># :stopdoc:</tt>:
331331
#
332-
# - [<tt>:stopdoc:</tt>]
333-
# Specifies that \RDoc should ignore markup
334-
# until next <tt>:startdoc:</tt> directive or end-of-file.
335-
# - [<tt>:startdoc:</tt>]
336-
# Specifies that \RDoc should resume parsing markup.
337-
# - [<tt>:enddoc:</tt>]
338-
# Specifies that \RDoc should ignore markup to end-of-file
339-
# regardless of other directives.
332+
# - Appears on a line by itself.
333+
# - Specifies that \RDoc should ignore markup
334+
# until next <tt>:startdoc:</tt> directive or end-of-file.
335+
#
336+
# - <tt># :startdoc:</tt>:
337+
#
338+
# - Appears on a line by itself.
339+
# - Specifies that \RDoc should resume parsing markup.
340+
#
341+
# - <tt># :enddoc:</tt>:
342+
#
343+
# - Appears on a line by itself.
344+
# - Specifies that \RDoc should ignore markup to end-of-file
345+
# regardless of other directives.
346+
#
347+
# - <tt># :nodoc:</tt>:
348+
#
349+
# - Appended to a line of code
350+
# that defines a class, module, method, alias, constant, or attribute.
351+
# - Specifies that the defined object should not be documented.
352+
#
353+
# - <tt># :nodoc: all</tt>:
354+
#
355+
# - Appended to a line of code
356+
# that defines a class or module.
357+
# - Specifies that the class or module should not be documented.
358+
# By default, however, a nested class or module _will_ be documented.
359+
#
360+
# - <tt># :doc:</tt>:
361+
#
362+
# - Appended to a line of code
363+
# that defines a class, module, method, alias, constant, or attribute.
364+
# - Specifies the defined object should be documented, even if otherwise
365+
# would not be documented.
366+
#
367+
# - <tt># :notnew:</tt> (aliased as <tt>:not_new:</tt> and <tt>:not-new:</tt>):
368+
#
369+
# - Appended to a line of code
370+
# that defines instance method +initialize+.
371+
# - Specifies that singleton method +new+ should not be documented.
372+
# By default, Ruby fakes a corresponding singleton method +new+,
373+
# which \RDoc includes in the documentation.
374+
# Note that instance method +initialize+ is private, and so by default
375+
# is not documented.
340376
#
341377
# For Ruby code, but not for other \RDoc sources,
342-
# there is a shorthand for [<tt>:stopdoc:</tt>] and [<tt>:startdoc:</tt>]:
378+
# there is a shorthand for <tt>:stopdoc:</tt> and <tt>:startdoc:</tt>:
343379
#
344380
# # Documented.
345381
# #--
346382
# # Not documented.
347383
# #++
348384
# # Documented.
349385
#
386+
# For C code, any of directives <tt>:startdoc:</tt>, <tt>:enddoc:</tt>,
387+
# and <tt>:nodoc:</tt> may appear in a stand-alone comment:
388+
#
389+
# /* :startdoc: */
390+
# /* :stopdoc: */
391+
# /* :enddoc: */
392+
#
350393
# ===== Directive for Specifying \RDoc Source Format
351394
#
352-
# This directive described must appear on a line by itself.
395+
# - <tt># :markup: _type_</tt>:
353396
#
354-
# - [<tt>:markup: _type_</tt>]
355-
# Specifies the format for the \RDoc input.
356-
# Parameter +type+ is one of +markdown+, +rd+, +rdoc+, +tomdoc+.
397+
# - Appears on a line by itself.
398+
# - Specifies the format for the \RDoc input;
399+
# parameter +type+ is one of +markdown+, +rd+, +rdoc+, +tomdoc+.
357400
#
358401
# ===== Directives for HTML Output
359402
#
360-
# Each directive described in this section must appear on a line by itself.
403+
# - <tt># :title: _text_</tt>:
361404
#
362-
# - [<tt>:title: _text_</tt>]
363-
# Specifies the title for the HTML output.
364-
# - [<tt>:main: _file_name_</tt>]
365-
# Specifies the HTML file to be displayed first.
405+
# - Appears on a line by itself.
406+
# - Specifies the title for the HTML output.
407+
#
408+
# - <tt># :main: _filename_</tt>:
409+
# - Appears on a line by itself.
410+
# - Specifies the HTML file to be displayed first.
366411
#
367412
# ===== Directives for Method Documentation
368413
#
369-
# - [<tt>:call-seq:</tt>]
370-
# For the given method, specifies the calling sequence to be reported in the HTML,
371-
# overriding the actual calling sequence in the Ruby code.
372-
# See method #call_seq_directive.
373-
# - [<tt>:args: _arg_names_</tt> (aliased as <tt>:arg</tt>)]
374-
# For the given method, specifies the arguments to be reported in the HTML,
375-
# overriding the actual arguments in the Ruby code.
376-
# See method #args_directive.
377-
# - [<tt>:yields: _arg_names_</tt> (aliased as <tt>:yield:</tt>)]
378-
# For the given method, specifies the yield arguments to be reported in the HTML,
379-
# overriding the actual yield in the Ruby code.
380-
# See method #yields_directive.
381-
#
382-
# Note that \RDoc can build the calling sequence for a Ruby-coded method,
383-
# but not for other languages.
384-
# You may want to override that by explicitly giving a <tt>:call-seq:</tt>
385-
# directive if you want to include:
386-
#
387-
# - A return type, which is not automatically inferred.
388-
# - Multiple calling sequences.
414+
# - <tt># :call-seq:</tt>:
415+
#
416+
# - Appears on a line by itself.
417+
# - Specifies the calling sequence to be reported in the HTML,
418+
# overriding the actual calling sequence in the code.
419+
# See method #call_seq_directive.
420+
#
421+
# Note that \RDoc can build the calling sequence for a Ruby-coded method,
422+
# but not for other languages.
423+
# You may want to override that by explicitly giving a <tt>:call-seq:</tt>
424+
# directive if you want to include:
425+
#
426+
# - A return type, which is not automatically inferred.
427+
# - Multiple calling sequences.
428+
#
429+
# For C code, the directive may appear in a stand-alone comment.
430+
#
431+
# - <tt># :args: _arg_names_</tt> (aliased as <tt>:arg:</tt>):
432+
#
433+
# - Appears on a line by itself.
434+
# - Specifies the arguments to be reported in the HTML,
435+
# overriding the actual arguments in the code.
436+
# See method #args_directive.
437+
#
438+
# - <tt># :yields: _arg_names_</tt> (aliased as <tt>:yield:</tt>):
439+
#
440+
# - Appears on a line by itself.
441+
# - Specifies the yield arguments to be reported in the HTML,
442+
# overriding the actual yield in the code.
443+
# See method #yields_directive.
389444
#
390445
# ===== Directives for Organizing Documentation
391446
#
@@ -397,16 +452,15 @@
397452
#
398453
# You can use directives to modify those behaviors.
399454
#
400-
# - [<tt>:section: _section_title_</tt>]
401-
#
402-
# Directive <tt>:section: <em>section_title</em></tt> specifies that
403-
# following methods are to be grouped into a section
404-
# with the given <em>section_title</em> as its heading.
405-
# This directive remains in effect until another such directive is given,
406-
# but may be temporarily overridden by directive <tt>:category:</tt>.
407-
# See below.
455+
# - <tt># :section: _section_title_</tt>:
408456
#
409-
# Directive <tt>:section:</tt> with no title reverts to the default section.
457+
# - Appears on a line by itself.
458+
# - Specifies that following methods are to be grouped into the section
459+
# with the given <em>section_title</em>,
460+
# or into the default section if no title is given.
461+
# The directive remains in effect until another such directive is given,
462+
# but may be temporarily overridden by directive <tt>:category:</tt>.
463+
# See below.
410464
#
411465
# The comment block containing this directive:
412466
#
@@ -434,56 +488,28 @@
434488
# You can use directive <tt>:category:</tt> to temporarily
435489
# override the current section.
436490
#
437-
# - [<tt>:category: _section_title_</tt>]
491+
# - <tt># :category: _section_title_</tt>:
438492
#
439-
# Directive <tt>:category: <em>section_title</em></tt> specifies that
440-
# just one following method is to be included in the given section.
441-
# Subsequent methods are to be grouped into the current section.
442-
#
443-
# Directive <tt>:category:</tt> with no title specifies that just one
444-
# following method is to be included in the default section.
493+
# - Appears on a line by itself.
494+
# - Specifies that just one following method is to be included
495+
# in the given section, or in the default section if no title is given.
496+
# Subsequent methods are to be grouped into the current section.
445497
#
446498
# ===== Directive for Including a File
447499
#
448-
# - [<tt>:include: _filename_</tt>]
449-
#
450-
# Include the contents of the named file at this point.
451-
# This directive must appear alone on one line, possibly preceded by spaces.
452-
# In this position, it can be escaped with a backslash in front of the first colon.
453-
#
454-
# The file is searched for in the directories
455-
# given with the <tt>--include</tt> command-line option,
456-
# or in the current directory by default.
457-
# The file content is shifted to have the same indentation as the colon
458-
# at the start of the directive.
500+
# - <tt># :include: _filepath_</tt>:
459501
#
460-
# ===== Directives in Trailing Comments
502+
# - Appears on a line by itself.
503+
# - Specifies that the contents of the given file
504+
# are to be included at this point.
505+
# The file content is shifted to have the same indentation as the colon
506+
# at the start of the directive.
461507
#
462-
# Each \RDoc directive in this section appears in a trailing
463-
# comment in a line of code.
508+
# The file is searched for in the directories
509+
# given with the <tt>--include</tt> command-line option,
510+
# or by default in the current directory.
464511
#
465-
# - [<tt>:nodoc:</tt>]
466-
# - Appears in a trailing comment on a line of code
467-
# that defines a class, module, method, alias, constant, or attribute.
468-
# - Specifies that the defined object should not be documented.
469-
# - [<tt>:nodoc: all</tt>]
470-
# - Appears in a trailing comment on a line of code
471-
# that defines a class or module.
472-
# - Specifies that the class or module should not be documented.
473-
# By default, however, a nested class or module _will_ be documented
474-
# - [<tt>:doc:</tt>]
475-
# - Appears in a trailing comment on a line of code
476-
# that defines a class, module, method, alias, constant, or attribute.
477-
# - Specifies the defined object should be documented, even if otherwise
478-
# would not be documented.
479-
# - [<tt>:notnew:</tt> (aliased as <tt>:not_new</tt> and <tt>:not-new:</tt>)]
480-
# - Appears in a trailing comment on a line of code
481-
# that defines instance method +initialize+.
482-
# - Specifies that singleton method +new+ should not be documented.
483-
# By default, Ruby fakes a corresponding singleton method +new+,
484-
# which \RDoc includes in the documentaton.
485-
# Note that instance method +initialize+ is private, and so by default
486-
# is not documented.
512+
# For C code, the directive may appear in a stand-alone comment
487513
#
488514
# === Text Markup
489515
#

0 commit comments

Comments
 (0)