33\RDoc derives Ruby documentation from files
44that are selected by \RDoc defaults and by user specifications.
55
6- \RDoc reads files and directories specified as arguments
7- on the ` rdoc ` command line;
8- if no arguments are given, \RDoc reads ` '.' ` (the current working directory):
6+ \RDoc reads files and directories specified as arguments on the ` rdoc ` command line
7+ (` '.' ` if no arguments given).
98
10- - For each given file path \RDoc reads the file.
11- - For each given directory path,
12- \RDoc (by default) recursively reads all directories and files in the directory tree.
13- You can restrict the and directories and files to be read by creating
14- [ .document files] [ document files ] .
9+ When the argument is:
10+
11+ - A file path: \RDoc reads the file.
12+ - A directory path:
13+ \RDoc (by default) recursively reads all files and directories in the directory tree.
14+ You can restrict the files and directories to be read;
15+ see [ Document-Control Files] [ document-control files ] .
1516
1617## File Types
1718
@@ -23,12 +24,14 @@ Based on the file extension of a file name,
2324- ` .rdoc ` : Text file in ` rdoc ` (markup) format.
2425- ` .md ` : Text file in ` markdown ` format.
2526- ` .rd ` : Text file in ` rd ` format.
27+ - _ Anything else_ : Text file in ` rdoc ` (markup) format.
28+
29+ In Ruby or C code, some documentation is derived from the code itself.
2630
27- In Ruby or C code, documentation is derived from the code itself,
28- and may also be derived from the text of comments;
31+ Additional documentation may be derived from the text in comments;
2932that text may be in any of these formats
3033(see [ directive :markup:] [ directive markup ] ).
31-
34+
3235- ` rdoc ` (markup);
3336 see RDoc::MarkupReference.
3437- ` markdown ` ;
@@ -38,33 +41,36 @@ that text may be in any of these formats
3841- ` tomdoc ` ;
3942 see [ Tomdoc for Ruby] [ tomdoc for ruby ] .
4043
41- ## ` .document ` Files
44+ ## Document-Control Files
4245
43- When \RDoc reads a directory,
44- it first looks for a file named ` .document ` :
46+ A directory may have a document-control file, named ` .document ` .
4547
46- - If the file does not exist,
47- \RDoc reads all files in the directory,
48- and reads its subdirectories.
49- - It the file exists,
48+ - If a directory _ does not_ have document-control file,
49+ \RDoc reads all its files and subdirectories.
50+ - If directory _ does have_ a document-control file,
5051 \RDoc reads only the files and subdirectories specified there.
5152
52- The format of the ` . document` file is simple:
53+ The format of the document-control file is simple:
5354
5455- Each line may contain a _ pattern_ , which may be:
5556
56- - A file path.
57- - A directory path.
58- - A file glob, such as ` *.rb ` or ` C* ` .
57+ - A file path; e.g., ` foo.rb ` , ` lib/bar.rb ` .
58+ - A directory path; e.g., ` subdir ` , ` subdir/subsubdir ` .
59+ - A file glob; e.g., ` *.rb ` , ` C* ` , ` lib/*.rb ` .
5960
6061- A line may contain only one pattern (no whitespace- or comma-separated multiple patterns).
6162- A pattern may be followed (on the same line) by a comment (beginning with ` '#' ` ).
6263- An entire line may be a comment (beginning with ` '#' ` ).
6364- A line may be blank (empty).
6465
65- Any directory in the filetree may contain a ` .document ` file.
66+ Each directory in the filetree may (or may not) contain a document-control file.
67+
68+ Note that a document-control file in a subdirectory is read _ after_ document-control files
69+ in directories above it;
70+ therefore if file ` parent/.document ` specifies ` child/foo.rb ` ,
71+ then ` child/foo.rb ` is to be read regardless of the content of ` child/.document ` .
6672
67- [ document files ] : rdoc-ref:rdoc_sources.md@.document +Files
73+ [ document-control files ] : rdoc-ref:rdoc_sources.md@Document-Control +Files
6874[ directive markup ] : https://ruby.github.io/rdoc/RDoc/MarkupReference.html#class-RDoc::MarkupReference-label-3Amarkup-3A
6975[ rd working draft ] : https://github.com/uwabami/rdtool/blob/master/doc/rd-draft.rd
7076[ tomdoc for ruby ] : http://tomdoc.org
0 commit comments