Skip to content

Commit e2dec09

Browse files
[DOC] Re-format section Directives (#1418)
1 parent f2fefe0 commit e2dec09

File tree

1 file changed

+131
-127
lines changed

1 file changed

+131
-127
lines changed

doc/rdoc/markup_reference.rb

Lines changed: 131 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -451,76 +451,75 @@
451451
#
452452
# ==== Directives for Allowing or Suppressing Documentation
453453
#
454-
# - <tt># :stopdoc:</tt>:
454+
# ====== <tt>:stopdoc:</tt>
455455
#
456-
# - Appears on a line by itself.
457-
# - Specifies that \RDoc should ignore markup
458-
# until next <tt>:startdoc:</tt> directive or end-of-file.
456+
# - Appears on a line by itself.
457+
# - Specifies that \RDoc should ignore markup
458+
# until next <tt>:startdoc:</tt> directive or end-of-file.
459459
#
460-
# - <tt># :startdoc:</tt>:
460+
# ====== <tt>:startdoc:</tt>
461461
#
462-
# - Appears on a line by itself.
463-
# - Specifies that \RDoc should resume parsing markup.
462+
# - Appears on a line by itself.
463+
# - Specifies that \RDoc should resume parsing markup.
464464
#
465-
# - <tt># :enddoc:</tt>:
465+
# ====== <tt>:enddoc:</tt>
466466
#
467-
# - Appears on a line by itself.
468-
# - Specifies that \RDoc should ignore markup to end-of-file
469-
# regardless of other directives.
467+
# - Appears on a line by itself.
468+
# - Specifies that \RDoc should ignore markup to end-of-file
469+
# regardless of other directives.
470470
#
471-
# - <tt># :nodoc:</tt>:
471+
# ====== <tt>:nodoc:</tt>
472472
#
473-
# - Appended to a line of code
474-
# that defines a class, module, method, alias, constant, or attribute.
473+
# - Appended to a line of code
474+
# that defines a class, module, method, alias, constant, or attribute;
475+
# takes optional argument +all+ (<tt>:nodoc: all</tt>).
476+
# - Specifies that the defined object should not be documented.
475477
#
476-
# - Specifies that the defined object should not be documented.
478+
# For a method definition in C code, it the directive must be in the comment line
479+
# immediately preceding the definition:
477480
#
478-
# - For a method definition in C code, it the directive must be in the comment line
479-
# immediately preceding the definition:
481+
# /* :nodoc: */
482+
# static VALUE
483+
# some_method(VALUE self)
484+
# {
485+
# return self;
486+
# }
480487
#
481-
# /* :nodoc: */
482-
# static VALUE
483-
# some_method(VALUE self)
484-
# {
485-
# return self;
486-
# }
488+
# Note that this directive has <em>no effect at all</em>
489+
# when placed at the method declaration:
487490
#
488-
# Note that this directive has <em>no effect at all</em>
489-
# when placed at the method declaration:
491+
# /* :nodoc: */
492+
# rb_define_method(cMyClass, "do_something", something_func, 0);
490493
#
491-
# /* :nodoc: */
492-
# rb_define_method(cMyClass, "do_something", something_func, 0);
494+
# The above comment is just a comment and has nothing to do with \RDoc.
495+
# Therefore, +do_something+ method will be reported as "undocumented"
496+
# unless that method or function is documented elsewhere.
493497
#
494-
# The above comment is just a comment and has nothing to do with \RDoc.
495-
# Therefore, +do_something+ method will be reported as "undocumented"
496-
# unless that method or function is documented elsewhere.
498+
# For a constant definition in C code, this directive <em>can not work</em>
499+
# because there is no "implementation" place for a constant.
497500
#
498-
# - For a constant definition in C code, this directive <em>can not work</em>
499-
# because there is no "implementation" place for a constant.
501+
# With argument +all+ (<tt>:nodoc: all</tt>),
502+
# specifies that the class or module should not be documented.
503+
# By default, however, a nested class or module _will_ be documented.
500504
#
501-
# - <tt># :nodoc: all</tt>:
505+
# ====== <tt>:doc:</tt>
502506
#
503-
# - Appended to a line of code
504-
# that defines a class or module.
505-
# - Specifies that the class or module should not be documented.
506-
# By default, however, a nested class or module _will_ be documented.
507+
# - Appended to a line of code
508+
# that defines a class, module, method, alias, constant, or attribute.
509+
# - Specifies the defined object should be documented, even if it otherwise
510+
# would not be documented.
507511
#
508-
# - <tt># :doc:</tt>:
512+
# ====== <tt>:notnew:</tt>
509513
#
510-
# - Appended to a line of code
511-
# that defines a class, module, method, alias, constant, or attribute.
512-
# - Specifies the defined object should be documented, even if it otherwise
513-
# would not be documented.
514+
# - Appended to a line of code
515+
# that defines instance method +initialize+.
516+
# - Specifies that singleton method +new+ should not be documented.
517+
# By default, Ruby fakes a corresponding singleton method +new+,
518+
# which \RDoc includes in the documentation.
519+
# Note that instance method +initialize+ is private, and so by default
520+
# is not documented.
514521
#
515-
# - <tt># :notnew:</tt> (aliased as <tt>:not_new:</tt> and <tt>:not-new:</tt>):
516-
#
517-
# - Appended to a line of code
518-
# that defines instance method +initialize+.
519-
# - Specifies that singleton method +new+ should not be documented.
520-
# By default, Ruby fakes a corresponding singleton method +new+,
521-
# which \RDoc includes in the documentation.
522-
# Note that instance method +initialize+ is private, and so by default
523-
# is not documented.
522+
# Aliased as <tt>:not_new:</tt> and <tt>:not-new:</tt>.
524523
#
525524
# For Ruby code, but not for other \RDoc sources,
526525
# there is a shorthand for <tt>:stopdoc:</tt> and <tt>:startdoc:</tt>:
@@ -540,45 +539,49 @@
540539
#
541540
# ==== Directive for Specifying \RDoc Source Format
542541
#
543-
# - <tt># :markup: _type_</tt>:
542+
# ====== <tt>:markup:</tt>
544543
#
545-
# - Appears on a line by itself.
546-
# - Specifies the format for the \RDoc input;
547-
# parameter +type+ is one of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
548-
# See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
544+
# - Appears on a line by itself; takes argument +format+ (<tt>:markup: _format_</tt>).
545+
# - Specifies the format for the \RDoc input;
546+
# argument +format+ is one of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
547+
# See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
549548
#
550549
# ==== Directives for Method Documentation
551550
#
552-
# - <tt># :call-seq:</tt>:
551+
# ====== <tt>:call-seq:</tt>
552+
#
553+
# - Appears on a line by itself.
554+
# - Specifies the calling sequence to be reported in the HTML,
555+
# overriding the actual calling sequence in the code.
556+
# See method #call_seq_directive.
557+
#
558+
# Note that \RDoc can build the calling sequence for a Ruby-coded method,
559+
# but not for other languages.
560+
# You may want to override that by explicitly giving a <tt>:call-seq:</tt>
561+
# directive if you want to include:
553562
#
554-
# - Appears on a line by itself.
555-
# - Specifies the calling sequence to be reported in the HTML,
556-
# overriding the actual calling sequence in the code.
557-
# See method #call_seq_directive.
563+
# - A return type, which is not automatically inferred.
564+
# - Multiple calling sequences.
558565
#
559-
# Note that \RDoc can build the calling sequence for a Ruby-coded method,
560-
# but not for other languages.
561-
# You may want to override that by explicitly giving a <tt>:call-seq:</tt>
562-
# directive if you want to include:
566+
# For C code, the directive may appear in a stand-alone comment.
563567
#
564-
# - A return type, which is not automatically inferred.
565-
# - Multiple calling sequences.
568+
# ====== <tt>:args:</tt>
566569
#
567-
# For C code, the directive may appear in a stand-alone comment.
570+
# - Appears on a line by itself; takes argument +arg_names+ (<tt>:args: _arg_names_</tt>).
571+
# - Specifies the arguments to be reported in the HTML,
572+
# overriding the actual arguments in the code.
573+
# See method #args_directive.
568574
#
569-
# - <tt># :args: _arg_names_</tt> (aliased as <tt>:arg:</tt>):
575+
# Aliased as <tt>:arg:</tt>.
570576
#
571-
# - Appears on a line by itself.
572-
# - Specifies the arguments to be reported in the HTML,
573-
# overriding the actual arguments in the code.
574-
# See method #args_directive.
577+
# ====== <tt>:yields:</tt>
575578
#
576-
# - <tt># :yields: _arg_names_</tt> (aliased as <tt>:yield:</tt>):
579+
# - Appears on a line by itself; takes argument +arg_names+ (<tt>:yields: _arg_names_</tt>).
580+
# - Specifies the yield arguments to be reported in the HTML,
581+
# overriding the actual yield in the code.
582+
# See method #yields_directive.
577583
#
578-
# - Appears on a line by itself.
579-
# - Specifies the yield arguments to be reported in the HTML,
580-
# overriding the actual yield in the code.
581-
# See method #yields_directive.
584+
# Aliased as <tt>:yield:</tt>.
582585
#
583586
# ==== Directives for Organizing Documentation
584587
#
@@ -590,64 +593,65 @@
590593
#
591594
# You can use directives to modify those behaviors.
592595
#
593-
# - <tt># :section: _section_title_</tt>:
594-
#
595-
# - Appears on a line by itself.
596-
# - Specifies that following methods are to be grouped into the section
597-
# with the given <em>section_title</em>,
598-
# or into the default section if no title is given.
599-
# The directive remains in effect until another such directive is given,
600-
# but may be temporarily overridden by directive <tt>:category:</tt>.
601-
# See below.
602-
#
603-
# The comment block containing this directive:
604-
#
605-
# - Must be separated by a blank line from the documentation for the next item.
606-
# - May have one or more lines preceding the directive.
607-
# These will be removed, along with any trailing lines that match them.
608-
# Such lines may be visually helpful.
609-
# - Lines of text that are not so removed become the descriptive text
610-
# for the section.
611-
#
612-
# Example:
613-
#
614-
# # ----------------------------------------
615-
# # :section: My Section
616-
# # This is the section that I wrote.
617-
# # See it glisten in the noon-day sun.
618-
# # ----------------------------------------
619-
#
620-
# ##
621-
# # Comment for some_method
622-
# def some_method
623-
# # ...
624-
# end
596+
# ====== <tt>:section:</tt>
597+
#
598+
# - Appears on a line by itself; takes argument +section_title+ (<tt>:section: _section_title_</tt>).
599+
# - Specifies that following methods are to be grouped into the section
600+
# with the given +section_title+,
601+
# or into the default section if no title is given.
602+
# The directive remains in effect until another such directive is given,
603+
# but may be temporarily overridden by directive <tt>:category:</tt>.
604+
# See below.
605+
#
606+
# The comment block containing this directive:
625607
#
626-
# You can use directive <tt>:category:</tt> to temporarily
627-
# override the current section.
608+
# - Must be separated by a blank line from the documentation for the next item.
609+
# - May have one or more lines preceding the directive.
610+
# These will be removed, along with any trailing lines that match them.
611+
# Such lines may be visually helpful.
612+
# - Lines of text that are not so removed become the descriptive text
613+
# for the section.
628614
#
629-
# - <tt># :category: _section_title_</tt>:
615+
# Example:
630616
#
631-
# - Appears on a line by itself.
632-
# - Specifies that just one following method is to be included
633-
# in the given section, or in the default section if no title is given.
634-
# Subsequent methods are to be grouped into the current section.
617+
# # ----------------------------------------
618+
# # :section: My Section
619+
# # This is the section that I wrote.
620+
# # See it glisten in the noon-day sun.
621+
# # ----------------------------------------
622+
#
623+
# ##
624+
# # Comment for some_method
625+
# def some_method
626+
# # ...
627+
# end
628+
#
629+
# You can use directive <tt>:category:</tt> to temporarily
630+
# override the current section.
631+
#
632+
# ====== <tt>:category:</tt>
633+
#
634+
# - Appears on a line by itself; takes argument +section_title+ (<tt>:category: _section_title_</tt>).
635+
# - Specifies that just one following method is to be included
636+
# in the given section, or in the default section if no title is given.
637+
# Subsequent methods are to be grouped into the current section.
635638
#
636639
# ==== Directive for Including a File
637640
#
638-
# - <tt># :include: _filepath_</tt>:
641+
# ====== <tt>:include:</tt>
642+
#
643+
# - Appears on a line by itself; takes argument +filepath+ (<tt>:include: _filepath_</tt>).
644+
# - Specifies that the contents of the given file
645+
# are to be included at this point.
639646
#
640-
# - Appears on a line by itself.
641-
# - Specifies that the contents of the given file
642-
# are to be included at this point.
643-
# The file content is shifted to have the same indentation as the colon
644-
# at the start of the directive.
647+
# The file content is shifted to have the same indentation as the colon
648+
# at the start of the directive.
645649
#
646-
# The file is searched for in the directory containing the current file,
647-
# and then in each of the directories given with the <tt>--include</tt>
648-
# command-line option.
650+
# The file is searched for in the directory containing the current file,
651+
# and then in each of the directories given with the <tt>--include</tt>
652+
# command-line option.
649653
#
650-
# For C code, the directive may appear in a stand-alone comment
654+
# For C code, the directive may appear in a stand-alone comment
651655
#
652656
# === Text Markup
653657
#

0 commit comments

Comments
 (0)