rdoc 2.5.11 → 3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.document +1 -0
- data/History.txt +95 -0
- data/Manifest.txt +13 -4
- data/README.txt +9 -3
- data/Rakefile +1 -1
- data/lib/rdoc.rb +15 -298
- data/lib/rdoc/alias.rb +65 -16
- data/lib/rdoc/any_method.rb +27 -150
- data/lib/rdoc/attr.rb +36 -115
- data/lib/rdoc/class_module.rb +236 -22
- data/lib/rdoc/code_object.rb +76 -31
- data/lib/rdoc/constant.rb +32 -4
- data/lib/rdoc/context.rb +494 -222
- data/lib/rdoc/encoding.rb +79 -0
- data/lib/rdoc/erbio.rb +37 -0
- data/lib/rdoc/gauntlet.rb +9 -5
- data/lib/rdoc/generator.rb +33 -1
- data/lib/rdoc/generator/darkfish.rb +284 -375
- data/lib/rdoc/generator/markup.rb +72 -36
- data/lib/rdoc/generator/ri.rb +4 -4
- data/lib/rdoc/generator/template/darkfish/classpage.rhtml +267 -274
- data/lib/rdoc/generator/template/darkfish/filepage.rhtml +91 -91
- data/lib/rdoc/generator/template/darkfish/index.rhtml +45 -45
- data/lib/rdoc/generator/template/darkfish/rdoc.css +298 -298
- data/lib/rdoc/include.rb +40 -1
- data/lib/rdoc/known_classes.rb +1 -0
- data/lib/rdoc/markup.rb +467 -2
- data/lib/rdoc/markup/attribute_manager.rb +24 -6
- data/lib/rdoc/markup/blank_line.rb +11 -3
- data/lib/rdoc/markup/document.rb +6 -0
- data/lib/rdoc/markup/formatter.rb +10 -0
- data/lib/rdoc/markup/formatter_test_case.rb +339 -3
- data/lib/rdoc/markup/heading.rb +3 -0
- data/lib/rdoc/markup/inline.rb +11 -1
- data/lib/rdoc/markup/list.rb +3 -0
- data/lib/rdoc/markup/list_item.rb +3 -0
- data/lib/rdoc/markup/paragraph.rb +3 -0
- data/lib/rdoc/markup/parser.rb +191 -237
- data/lib/rdoc/markup/{preprocess.rb → pre_process.rb} +50 -29
- data/lib/rdoc/markup/raw.rb +4 -0
- data/lib/rdoc/markup/rule.rb +3 -0
- data/lib/rdoc/markup/text_formatter_test_case.rb +116 -0
- data/lib/rdoc/markup/to_ansi.rb +14 -2
- data/lib/rdoc/markup/to_bs.rb +8 -2
- data/lib/rdoc/markup/to_html.rb +84 -91
- data/lib/rdoc/markup/to_html_crossref.rb +77 -26
- data/lib/rdoc/markup/to_rdoc.rb +94 -49
- data/lib/rdoc/markup/to_test.rb +9 -1
- data/lib/rdoc/markup/verbatim.rb +6 -3
- data/lib/rdoc/method_attr.rb +353 -0
- data/lib/rdoc/normal_class.rb +11 -2
- data/lib/rdoc/normal_module.rb +0 -5
- data/lib/rdoc/options.rb +373 -82
- data/lib/rdoc/parser.rb +59 -23
- data/lib/rdoc/parser/c.rb +224 -86
- data/lib/rdoc/parser/ruby.rb +219 -111
- data/lib/rdoc/parser/ruby_tools.rb +4 -1
- data/lib/rdoc/parser/simple.rb +9 -4
- data/lib/rdoc/rdoc.rb +68 -28
- data/lib/rdoc/require.rb +21 -0
- data/lib/rdoc/ri/driver.rb +20 -10
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/store.rb +22 -5
- data/lib/rdoc/ruby_lex.rb +11 -12
- data/lib/rdoc/ruby_token.rb +2 -2
- data/lib/rdoc/single_class.rb +2 -1
- data/lib/rdoc/stats.rb +202 -162
- data/lib/rdoc/stats/normal.rb +51 -0
- data/lib/rdoc/stats/quiet.rb +59 -0
- data/lib/rdoc/stats/verbose.rb +45 -0
- data/lib/rdoc/text.rb +133 -4
- data/lib/rdoc/{tokenstream.rb → token_stream.rb} +0 -2
- data/lib/rdoc/top_level.rb +230 -39
- data/test/test_attribute_manager.rb +58 -7
- data/test/test_rdoc_alias.rb +13 -0
- data/test/test_rdoc_any_method.rb +43 -2
- data/test/test_rdoc_attr.rb +15 -8
- data/test/test_rdoc_class_module.rb +133 -0
- data/test/test_rdoc_code_object.rb +62 -5
- data/test/test_rdoc_context.rb +72 -26
- data/test/test_rdoc_encoding.rb +145 -0
- data/test/test_rdoc_generator_darkfish.rb +119 -0
- data/test/test_rdoc_generator_ri.rb +22 -2
- data/test/test_rdoc_include.rb +79 -0
- data/test/test_rdoc_markup_attribute_manager.rb +4 -4
- data/test/test_rdoc_markup_parser.rb +134 -95
- data/test/test_rdoc_markup_pre_process.rb +7 -2
- data/test/test_rdoc_markup_to_ansi.rb +43 -153
- data/test/test_rdoc_markup_to_bs.rb +42 -156
- data/test/test_rdoc_markup_to_html.rb +130 -58
- data/test/test_rdoc_markup_to_html_crossref.rb +10 -10
- data/test/test_rdoc_markup_to_rdoc.rb +40 -151
- data/test/test_rdoc_method_attr.rb +122 -0
- data/test/test_rdoc_normal_class.rb +1 -1
- data/test/test_rdoc_normal_module.rb +6 -1
- data/test/test_rdoc_options.rb +237 -12
- data/test/test_rdoc_parser.rb +3 -22
- data/test/test_rdoc_parser_c.rb +203 -2
- data/test/test_rdoc_parser_ruby.rb +403 -89
- data/test/test_rdoc_parser_simple.rb +25 -1
- data/test/test_rdoc_rdoc.rb +44 -32
- data/test/test_rdoc_ri_driver.rb +29 -24
- data/test/test_rdoc_ri_store.rb +46 -3
- data/test/test_rdoc_task.rb +1 -1
- data/test/test_rdoc_text.rb +102 -8
- data/test/test_rdoc_top_level.rb +13 -4
- data/test/xref_data.rb +8 -0
- data/test/xref_test_case.rb +6 -0
- metadata +29 -19
- metadata.gz.sig +0 -0
- data/lib/rdoc/parser/perl.rb +0 -165
- data/test/test_rdoc_parser_perl.rb +0 -73
data/lib/rdoc/include.rb
CHANGED
@@ -17,6 +17,7 @@ class RDoc::Include < RDoc::CodeObject
|
|
17
17
|
super()
|
18
18
|
@name = name
|
19
19
|
self.comment = comment
|
20
|
+
@module = nil # cache for module if found
|
20
21
|
end
|
21
22
|
|
22
23
|
##
|
@@ -52,9 +53,47 @@ class RDoc::Include < RDoc::CodeObject
|
|
52
53
|
##
|
53
54
|
# Attempts to locate the included module object. Returns the name if not
|
54
55
|
# known.
|
56
|
+
#
|
57
|
+
# The scoping rules of Ruby to resolve the name of an included module are:
|
58
|
+
# - first look into the children of the current context;
|
59
|
+
# - if not found, look into the children of included modules,
|
60
|
+
# in reverse inclusion order;
|
61
|
+
# - if still not found, go up the hierarchy of names.
|
55
62
|
|
56
63
|
def module
|
57
|
-
|
64
|
+
return @module if @module
|
65
|
+
|
66
|
+
# search the current context
|
67
|
+
return @name unless parent
|
68
|
+
full_name = parent.child_name(@name)
|
69
|
+
@module = RDoc::TopLevel.modules_hash[full_name]
|
70
|
+
return @module if @module
|
71
|
+
return @name if @name =~ /^::/
|
72
|
+
|
73
|
+
# search the includes before this one, in reverse order
|
74
|
+
searched = parent.includes.take_while { |i| i != self }.reverse
|
75
|
+
searched.each do |i|
|
76
|
+
inc = i.module
|
77
|
+
next if String === inc
|
78
|
+
full_name = inc.child_name(@name)
|
79
|
+
@module = RDoc::TopLevel.modules_hash[full_name]
|
80
|
+
return @module if @module
|
81
|
+
end
|
82
|
+
|
83
|
+
# go up the hierarchy of names
|
84
|
+
p = parent.parent
|
85
|
+
while p
|
86
|
+
full_name = p.child_name(@name)
|
87
|
+
@module = RDoc::TopLevel.modules_hash[full_name]
|
88
|
+
return @module if @module
|
89
|
+
p = p.parent
|
90
|
+
end
|
91
|
+
|
92
|
+
@name
|
93
|
+
end
|
94
|
+
|
95
|
+
def to_s # :nodoc:
|
96
|
+
"include #@name in: #{parent}"
|
58
97
|
end
|
59
98
|
|
60
99
|
end
|
data/lib/rdoc/known_classes.rb
CHANGED
data/lib/rdoc/markup.rb
CHANGED
@@ -59,12 +59,477 @@ require 'rdoc'
|
|
59
59
|
#
|
60
60
|
# puts "<body>#{wh.convert ARGF.read}</body>"
|
61
61
|
#
|
62
|
+
# == Encoding
|
63
|
+
#
|
64
|
+
# Where Encoding support is available RDoc will automatically convert all
|
65
|
+
# documents to the same output encoding. The output encoding can be set via
|
66
|
+
# RDoc::Options#encoding and defaults to Encoding.default_external.
|
67
|
+
#
|
68
|
+
# = \RDoc Markup Reference
|
69
|
+
#
|
70
|
+
# == Block Markup
|
71
|
+
#
|
72
|
+
# === Paragraphs and Verbatim
|
73
|
+
#
|
74
|
+
# The markup engine looks for a document's natural left margin. This is
|
75
|
+
# used as the initial margin for the document.
|
76
|
+
#
|
77
|
+
# Consecutive lines starting at this margin are considered to be a
|
78
|
+
# paragraph. Empty lines separate paragraphs.
|
79
|
+
#
|
80
|
+
# Any line that starts to the right of the current margin is treated
|
81
|
+
# as verbatim text. This is useful for code listings:
|
82
|
+
#
|
83
|
+
# 3.times { puts "Ruby" }
|
84
|
+
#
|
85
|
+
# In verbatim text, two or more blank lines are collapsed into one,
|
86
|
+
# and trailing blank lines are removed:
|
87
|
+
#
|
88
|
+
# This is the first line
|
89
|
+
#
|
90
|
+
#
|
91
|
+
# This is the second non-blank line,
|
92
|
+
# after 2 blank lines in the source markup.
|
93
|
+
#
|
94
|
+
#
|
95
|
+
# There were two trailing blank lines right above this paragraph, that
|
96
|
+
# have been removed. In addition, the verbatim text has been shifted
|
97
|
+
# left, so the amount of indentation of verbatim text is unimportant.
|
98
|
+
#
|
99
|
+
# === Headers and Rules
|
100
|
+
#
|
101
|
+
# A line starting with an equal sign (=) is treated as a
|
102
|
+
# heading. Level one headings have one equals sign, level two headings
|
103
|
+
# have two, and so on until level six, which is the maximum
|
104
|
+
# (seven hyphens or more result in a level six heading).
|
105
|
+
#
|
106
|
+
# For example, the above header was obtained with:
|
107
|
+
# == Headers and Rules
|
108
|
+
#
|
109
|
+
# A line starting with three or more hyphens (at the current indent)
|
110
|
+
# generates a horizontal rule. The more hyphens, the thicker the rule
|
111
|
+
# (within reason, and if supported by the output device).
|
112
|
+
#
|
113
|
+
# In the case of HTML output, three dashes generate a 1-pixel high rule,
|
114
|
+
# four dashes result in 2 pixels, and so on. The actual height is limited
|
115
|
+
# to 10 pixels:
|
116
|
+
#
|
117
|
+
# ---
|
118
|
+
# -----
|
119
|
+
# -----------------------------------------------------
|
120
|
+
#
|
121
|
+
# produces:
|
122
|
+
#
|
123
|
+
# ---
|
124
|
+
# -----
|
125
|
+
# -----------------------------------------------------
|
126
|
+
#
|
127
|
+
# === Simple Lists
|
128
|
+
#
|
129
|
+
# If a paragraph starts with a "*", "-", "<digit>." or "<letter>.",
|
130
|
+
# then it is taken to be the start of a list. The margin in increased to be
|
131
|
+
# the first non-space following the list start flag. Subsequent lines
|
132
|
+
# should be indented to this new margin until the list ends. For example:
|
133
|
+
#
|
134
|
+
# * this is a list with three paragraphs in
|
135
|
+
# the first item. This is the first paragraph.
|
136
|
+
#
|
137
|
+
# And this is the second paragraph.
|
138
|
+
#
|
139
|
+
# 1. This is an indented, numbered list.
|
140
|
+
# 2. This is the second item in that list
|
141
|
+
#
|
142
|
+
# This is the third conventional paragraph in the
|
143
|
+
# first list item.
|
144
|
+
#
|
145
|
+
# * This is the second item in the original list
|
146
|
+
#
|
147
|
+
# produces:
|
148
|
+
#
|
149
|
+
# * this is a list with three paragraphs in
|
150
|
+
# the first item. This is the first paragraph.
|
151
|
+
#
|
152
|
+
# And this is the second paragraph.
|
153
|
+
#
|
154
|
+
# 1. This is an indented, numbered list.
|
155
|
+
# 2. This is the second item in that list
|
156
|
+
#
|
157
|
+
# This is the third conventional paragraph in the
|
158
|
+
# first list item.
|
159
|
+
#
|
160
|
+
# * This is the second item in the original list
|
161
|
+
#
|
162
|
+
# === Labeled Lists
|
163
|
+
#
|
164
|
+
# You can also construct labeled lists, sometimes called description
|
165
|
+
# or definition lists. Do this by putting the label in square brackets
|
166
|
+
# and indenting the list body:
|
167
|
+
#
|
168
|
+
# [cat] a small furry mammal
|
169
|
+
# that seems to sleep a lot
|
170
|
+
#
|
171
|
+
# [ant] a little insect that is known
|
172
|
+
# to enjoy picnics
|
173
|
+
#
|
174
|
+
# produces:
|
175
|
+
#
|
176
|
+
# [cat] a small furry mammal
|
177
|
+
# that seems to sleep a lot
|
178
|
+
#
|
179
|
+
# [ant] a little insect that is known
|
180
|
+
# to enjoy picnics
|
181
|
+
#
|
182
|
+
# If you want the list bodies to line up to the left of the labels,
|
183
|
+
# use two colons:
|
184
|
+
#
|
185
|
+
# cat:: a small furry mammal
|
186
|
+
# that seems to sleep a lot
|
187
|
+
#
|
188
|
+
# ant:: a little insect that is known
|
189
|
+
# to enjoy picnics
|
190
|
+
#
|
191
|
+
# produces:
|
192
|
+
#
|
193
|
+
# cat:: a small furry mammal
|
194
|
+
# that seems to sleep a lot
|
195
|
+
#
|
196
|
+
# ant:: a little insect that is known
|
197
|
+
# to enjoy picnics
|
198
|
+
#
|
199
|
+
# Notice that blank lines right after the label are ignored in labeled lists:
|
200
|
+
#
|
201
|
+
# [one]
|
202
|
+
#
|
203
|
+
# definition 1
|
204
|
+
#
|
205
|
+
# [two]
|
206
|
+
#
|
207
|
+
# definition 2
|
208
|
+
#
|
209
|
+
# produces the same output as
|
210
|
+
#
|
211
|
+
# [one] definition 1
|
212
|
+
# [two] definition 2
|
213
|
+
#
|
214
|
+
#
|
215
|
+
# === Lists and Verbatim
|
216
|
+
#
|
217
|
+
# If you want to introduce a verbatim section right after a list, it has to be
|
218
|
+
# less indented than the list item bodies, but more indented than the list
|
219
|
+
# label, letter, digit or bullet. For instance:
|
220
|
+
#
|
221
|
+
# * point 1
|
222
|
+
#
|
223
|
+
# * point 2, first paragraph
|
224
|
+
#
|
225
|
+
# point 2, second paragraph
|
226
|
+
# verbatim text inside point 2
|
227
|
+
# point 2, third paragraph
|
228
|
+
# verbatim text outside of the list (the list is therefore closed)
|
229
|
+
# regular paragraph after the list
|
230
|
+
#
|
231
|
+
# produces:
|
232
|
+
#
|
233
|
+
# * point 1
|
234
|
+
#
|
235
|
+
# * point 2, first paragraph
|
236
|
+
#
|
237
|
+
# point 2, second paragraph
|
238
|
+
# verbatim text inside point 2
|
239
|
+
# point 2, third paragraph
|
240
|
+
# verbatim text outside of the list (the list is therefore closed)
|
241
|
+
# regular paragraph after the list
|
242
|
+
#
|
243
|
+
#
|
244
|
+
# == Text Markup
|
245
|
+
#
|
246
|
+
# === Bold, Italic, Typewriter Text
|
247
|
+
#
|
248
|
+
# You can use markup within text (except verbatim) to change the
|
249
|
+
# appearance of parts of that text. Out of the box, RDoc::Markup
|
250
|
+
# supports word-based and general markup.
|
251
|
+
#
|
252
|
+
# Word-based markup uses flag characters around individual words:
|
253
|
+
#
|
254
|
+
# <tt>\*_word_\*</tt>:: displays _word_ in a *bold* font
|
255
|
+
# <tt>\__word_\_</tt>:: displays _word_ in an _emphasized_ font
|
256
|
+
# <tt>\+_word_\+</tt>:: displays _word_ in a +code+ font
|
257
|
+
#
|
258
|
+
# General markup affects text between a start delimiter and an end
|
259
|
+
# delimiter. Not surprisingly, these delimiters look like HTML markup.
|
260
|
+
#
|
261
|
+
# <tt>\<b>_text_</b></tt>:: displays _text_ in a *bold* font
|
262
|
+
# <tt>\<em>_text_</em></tt>:: displays _text_ in an _emphasized_ font
|
263
|
+
# (alternate tag: <tt>\<i></tt>)
|
264
|
+
# <tt>\<tt>_text_\</tt></tt>:: displays _text_ in a +code+ font
|
265
|
+
# (alternate tag: <tt>\<code></tt>)
|
266
|
+
#
|
267
|
+
# Unlike conventional Wiki markup, general markup can cross line
|
268
|
+
# boundaries. You can turn off the interpretation of markup by
|
269
|
+
# preceding the first character with a backslash (see <i>Escaping
|
270
|
+
# Text Markup</i>, below).
|
271
|
+
#
|
272
|
+
# === Hyperlinks
|
273
|
+
#
|
274
|
+
# Hyperlinks to the web starting with +http:+, +mailto:+, +ftp:+ or +www.+
|
275
|
+
# are recognized. An HTTP url that references an external image file is
|
276
|
+
# converted into an inline <img...>. Hyperlinks starting with +link:+ are
|
277
|
+
# assumed to refer to local files whose path is relative to the <tt>--op</tt>
|
278
|
+
# directory.
|
279
|
+
#
|
280
|
+
# Hyperlinks can also be of the form _label_[_url_], in which
|
281
|
+
# case _label_ is used in the displayed text, and _url_ is
|
282
|
+
# used as the target. If _label_ contains multiple words,
|
283
|
+
# put it in braces: {<em>multi word label</em>}[url].
|
284
|
+
#
|
285
|
+
# Example hyperlinks:
|
286
|
+
#
|
287
|
+
# link:RDoc.html
|
288
|
+
# http://rdoc.rubyforge.org
|
289
|
+
# mailto:user@example.com
|
290
|
+
# {RDoc Documentation}[http://rdoc.rubyforge.org]
|
291
|
+
# {RDoc Markup}[link:RDoc/Markup.html]
|
292
|
+
#
|
293
|
+
# === Escaping Text Markup
|
294
|
+
#
|
295
|
+
# Text markup can be escaped with a backslash, as in \<tt>, which was obtained
|
296
|
+
# with "<tt>\\<tt></tt>". Except in verbatim sections and between \<tt> tags,
|
297
|
+
# to produce a backslash, you have to double it unless it is followed by a
|
298
|
+
# space, tab or newline. Otherwise, the HTML formatter will discard it, as it
|
299
|
+
# is used to escape potential hyperlinks:
|
300
|
+
#
|
301
|
+
# * The \ must be doubled if not followed by white space: \\.
|
302
|
+
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
|
303
|
+
# * This is a link to {ruby-lang}[www.ruby-lang.org].
|
304
|
+
# * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org].
|
305
|
+
# * This will not be hyperlinked to \RDoc::RDoc#document
|
306
|
+
#
|
307
|
+
# generates:
|
308
|
+
#
|
309
|
+
# * The \ must be doubled if not followed by white space: \\.
|
310
|
+
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
|
311
|
+
# * This is a link to {ruby-lang}[www.ruby-lang.org]
|
312
|
+
# * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org]
|
313
|
+
# * This will not be hyperlinked to \RDoc::RDoc#document
|
314
|
+
#
|
315
|
+
# Inside \<tt> tags, more precisely, leading backslashes are removed
|
316
|
+
# only if followed by a markup character (<tt><*_+</tt>), a backslash,
|
317
|
+
# or a known hyperlink reference (a known class or method). So in the
|
318
|
+
# example above, the backslash of <tt>\S</tt> would be removed
|
319
|
+
# if there was a class or module named +S+ in the current context.
|
320
|
+
#
|
321
|
+
# This behavior is inherited from RDoc version 1, and has been kept
|
322
|
+
# for compatibility with existing RDoc documentation.
|
323
|
+
#
|
324
|
+
# === Conversion of characters
|
325
|
+
#
|
326
|
+
# HTML will convert two/three dashes to an em-dash. Other common characters are
|
327
|
+
# converted as well:
|
328
|
+
#
|
329
|
+
# em-dash:: -- or ---
|
330
|
+
# ellipsis:: ...
|
331
|
+
#
|
332
|
+
# single quotes:: 'text' or `text'
|
333
|
+
# double quotes:: "text" or ``text''
|
334
|
+
#
|
335
|
+
# copyright:: (c)
|
336
|
+
# registered trademark:: (r)
|
337
|
+
#
|
338
|
+
# produces:
|
339
|
+
#
|
340
|
+
# em-dash:: -- or ---
|
341
|
+
# ellipsis:: ...
|
342
|
+
#
|
343
|
+
# single quotes:: 'text' or `text'
|
344
|
+
# double quotes:: "text" or ``text''
|
345
|
+
#
|
346
|
+
# copyright:: (c)
|
347
|
+
# registered trademark:: (r)
|
348
|
+
#
|
349
|
+
#
|
350
|
+
# == Documenting Source Code
|
351
|
+
#
|
352
|
+
# Comment blocks can be written fairly naturally, either using <tt>#</tt> on
|
353
|
+
# successive lines of the comment, or by including the comment in
|
354
|
+
# a <tt>=begin</tt>/<tt>=end</tt> block. If you use the latter form,
|
355
|
+
# the <tt>=begin</tt> line _must_ be flagged with an +rdoc+ tag:
|
356
|
+
#
|
357
|
+
# =begin rdoc
|
358
|
+
# Documentation to be processed by RDoc.
|
359
|
+
#
|
360
|
+
# ...
|
361
|
+
# =end
|
362
|
+
#
|
363
|
+
# RDoc stops processing comments if it finds a comment line starting
|
364
|
+
# with <tt>--</tt> right after the <tt>#</tt> character (otherwise,
|
365
|
+
# it will be treated as a rule if it has three dashes or more).
|
366
|
+
# This can be used to separate external from internal comments,
|
367
|
+
# or to stop a comment being associated with a method, class, or module.
|
368
|
+
# Commenting can be turned back on with a line that starts with <tt>++</tt>.
|
369
|
+
#
|
370
|
+
# ##
|
371
|
+
# # Extract the age and calculate the date-of-birth.
|
372
|
+
# #--
|
373
|
+
# # FIXME: fails if the birthday falls on February 29th
|
374
|
+
# #++
|
375
|
+
# # The DOB is returned as a Time object.
|
376
|
+
#
|
377
|
+
# def get_dob(person)
|
378
|
+
# # ...
|
379
|
+
# end
|
380
|
+
#
|
381
|
+
# Names of classes, files, and any method names containing an
|
382
|
+
# underscore or preceded by a hash character are automatically hyperlinked
|
383
|
+
# from comment text to their description. This hyperlinking works inside
|
384
|
+
# the current class or module, and with ancestor methods (in included modules
|
385
|
+
# or in the superclass).
|
386
|
+
#
|
387
|
+
# Method parameter lists are extracted and displayed with the method
|
388
|
+
# description. If a method calls +yield+, then the parameters passed to yield
|
389
|
+
# will also be displayed:
|
390
|
+
#
|
391
|
+
# def fred
|
392
|
+
# ...
|
393
|
+
# yield line, address
|
394
|
+
#
|
395
|
+
# This will get documented as:
|
396
|
+
#
|
397
|
+
# fred() { |line, address| ... }
|
398
|
+
#
|
399
|
+
# You can override this using a comment containing ':yields: ...' immediately
|
400
|
+
# after the method definition
|
401
|
+
#
|
402
|
+
# def fred # :yields: index, position
|
403
|
+
# # ...
|
404
|
+
#
|
405
|
+
# yield line, address
|
406
|
+
#
|
407
|
+
# which will get documented as
|
408
|
+
#
|
409
|
+
# fred() { |index, position| ... }
|
410
|
+
#
|
411
|
+
# +:yields:+ is an example of a documentation directive. These appear
|
412
|
+
# immediately after the start of the document element they are modifying.
|
413
|
+
#
|
414
|
+
# RDoc automatically cross-references words with underscores or camel-case.
|
415
|
+
# To suppress cross-references, prefix the word with a \ character. To
|
416
|
+
# include special characters like "<tt>\n</tt>", you'll need to use
|
417
|
+
# two \ characters in normal text, but only one in \<tt> text:
|
418
|
+
#
|
419
|
+
# "\\n" or "<tt>\n</tt>"
|
420
|
+
#
|
421
|
+
# produces:
|
422
|
+
#
|
423
|
+
# "\\n" or "<tt>\n</tt>"
|
424
|
+
#
|
425
|
+
# == Directives
|
426
|
+
#
|
427
|
+
# Directives are keywords surrounded by ":" characters.
|
428
|
+
#
|
429
|
+
# === Controlling what is documented
|
430
|
+
#
|
431
|
+
# [+:nodoc:+ / <tt>:nodoc: all</tt>]
|
432
|
+
# This directive prevents documentation for the element from
|
433
|
+
# being generated. For classes and modules, the methods, aliases,
|
434
|
+
# constants, and attributes directly within the affected class or
|
435
|
+
# module also will be omitted. By default, though, modules and
|
436
|
+
# classes within that class of module _will_ be documented. This is
|
437
|
+
# turned off by adding the +all+ modifier.
|
438
|
+
#
|
439
|
+
# module MyModule # :nodoc:
|
440
|
+
# class Input
|
441
|
+
# end
|
442
|
+
# end
|
443
|
+
#
|
444
|
+
# module OtherModule # :nodoc: all
|
445
|
+
# class Output
|
446
|
+
# end
|
447
|
+
# end
|
448
|
+
#
|
449
|
+
# In the above code, only class <tt>MyModule::Input</tt> will be documented.
|
450
|
+
#
|
451
|
+
# The +:nodoc:+ directive, like +:enddoc:+, +:stopdoc:+ and +:startdoc:+
|
452
|
+
# presented below, is local to the current file: if you do not want to
|
453
|
+
# document a module that appears in several files, specify +:nodoc:+ on each
|
454
|
+
# appearance, at least once per file.
|
455
|
+
#
|
456
|
+
# [+:stopdoc:+ / +:startdoc:+]
|
457
|
+
# Stop and start adding new documentation elements to the current container.
|
458
|
+
# For example, if a class has a number of constants that you don't want to
|
459
|
+
# document, put a +:stopdoc:+ before the first, and a +:startdoc:+ after the
|
460
|
+
# last. If you don't specify a +:startdoc:+ by the end of the container,
|
461
|
+
# disables documentation for the rest of the current file.
|
462
|
+
#
|
463
|
+
# [+:doc:+]
|
464
|
+
# Forces a method or attribute to be documented even if it wouldn't be
|
465
|
+
# otherwise. Useful if, for example, you want to include documentation of a
|
466
|
+
# particular private method.
|
467
|
+
#
|
468
|
+
# [+:enddoc:+]
|
469
|
+
# Document nothing further at the current level: directives +:startdoc:+ and
|
470
|
+
# +:doc:+ that appear after this will not be honored for the current container
|
471
|
+
# (file, class or module), in the current file.
|
472
|
+
#
|
473
|
+
# [+:notnew:+ / +:not_new:+ / +:not-new:+ ]
|
474
|
+
# Only applicable to the +initialize+ instance method. Normally RDoc
|
475
|
+
# assumes that the documentation and parameters for +initialize+ are
|
476
|
+
# actually for the +new+ method, and so fakes out a +new+ for the class.
|
477
|
+
# The +:notnew:+ directive stops this. Remember that +initialize+ is private,
|
478
|
+
# so you won't see the documentation unless you use the +-a+ command line
|
479
|
+
# option.
|
480
|
+
#
|
481
|
+
# === Other directives
|
482
|
+
#
|
483
|
+
# [+:include:+ _filename_]
|
484
|
+
# Include the contents of the named file at this point. This directive
|
485
|
+
# must appear alone on one line, possibly preceded by spaces. In this
|
486
|
+
# position, it can be escapd with a \ in front of the first colon.
|
487
|
+
#
|
488
|
+
# The file will be searched for in the directories listed by the +--include+
|
489
|
+
# option, or in the current directory by default. The contents of the file
|
490
|
+
# will be shifted to have the same indentation as the ':' at the start of
|
491
|
+
# the +:include:+ directive.
|
492
|
+
#
|
493
|
+
# [+:title:+ _text_]
|
494
|
+
# Sets the title for the document. Equivalent to the <tt>--title</tt>
|
495
|
+
# command line parameter. (The command line parameter overrides any :title:
|
496
|
+
# directive in the source).
|
497
|
+
#
|
498
|
+
# [+:main:+ _name_]
|
499
|
+
# Equivalent to the <tt>--main</tt> command line parameter.
|
500
|
+
#
|
501
|
+
# [<tt>:section: title</tt>]
|
502
|
+
# Starts a new section in the output. The title following +:section:+ is
|
503
|
+
# used as the section heading, and the remainder of the comment containing
|
504
|
+
# the section is used as introductory text. Subsequent methods, aliases,
|
505
|
+
# attributes, and classes will be documented in this section. A :section:
|
506
|
+
# comment block may have one or more lines before the :section: directive.
|
507
|
+
# These will be removed, and any identical lines at the end of the block are
|
508
|
+
# also removed. This allows you to add visual cues such as:
|
509
|
+
#
|
510
|
+
# # ----------------------------------------
|
511
|
+
# # :section: My Section
|
512
|
+
# # This is the section that I wrote.
|
513
|
+
# # See it glisten in the noon-day sun.
|
514
|
+
# # ----------------------------------------
|
515
|
+
#
|
516
|
+
# <i>Note: Current formatters to not take sections into account.</i>
|
517
|
+
#
|
518
|
+
# [+:call-seq:+]
|
519
|
+
# Lines up to the next blank line in the comment are treated as the method's
|
520
|
+
# calling sequence, overriding the default parsing of method parameters and
|
521
|
+
# yield arguments.
|
522
|
+
#
|
523
|
+
# Further directives can be found in RDoc::Parser::Ruby and RDoc::Parser::C.
|
62
524
|
#--
|
63
|
-
# Author::
|
64
|
-
# License::
|
525
|
+
# Original Author:: Dave Thomas, dave@pragmaticprogrammer.com
|
526
|
+
# License:: Ruby license
|
65
527
|
|
66
528
|
class RDoc::Markup
|
67
529
|
|
530
|
+
##
|
531
|
+
# An AttributeManager which handles inline markup.
|
532
|
+
|
68
533
|
attr_reader :attribute_manager
|
69
534
|
|
70
535
|
##
|