rdoc 2.2.1 → 2.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 +2 -0
- data/.document +4 -0
- data/History.txt +35 -0
- data/Manifest.txt +36 -15
- data/README.txt +11 -27
- data/Rakefile +3 -0
- data/lib/rdoc.rb +1 -1
- data/lib/rdoc/cache.rb +32 -0
- data/lib/rdoc/code_objects.rb +121 -59
- data/lib/rdoc/generator.rb +196 -133
- data/lib/rdoc/generator/darkfish.rb +471 -0
- data/lib/rdoc/generator/html.rb +71 -60
- data/lib/rdoc/generator/html/html.rb +115 -115
- data/lib/rdoc/generator/html/one_page_html.rb +56 -56
- data/lib/rdoc/generator/ri.rb +2 -0
- data/lib/rdoc/generator/template/darkfish/.document +0 -0
- data/lib/rdoc/generator/template/darkfish/classpage.rhtml +302 -0
- data/lib/rdoc/generator/template/darkfish/filepage.rhtml +114 -0
- data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
- data/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +57 -0
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
- data/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
- data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
- data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
- data/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
- data/lib/rdoc/generator/xml.rb +19 -12
- data/lib/rdoc/generator/xml/rdf.rb +50 -50
- data/lib/rdoc/generator/xml/xml.rb +58 -58
- data/lib/rdoc/known_classes.rb +0 -1
- data/lib/rdoc/markup/preprocess.rb +4 -3
- data/lib/rdoc/markup/to_html.rb +4 -1
- data/lib/rdoc/markup/to_html_crossref.rb +28 -31
- data/lib/rdoc/options.rb +25 -20
- data/lib/rdoc/parser.rb +10 -2
- data/lib/rdoc/parser/c.rb +38 -29
- data/lib/rdoc/parser/f95.rb +32 -32
- data/lib/rdoc/parser/ruby.rb +5 -2
- data/lib/rdoc/parser/simple.rb +1 -0
- data/lib/rdoc/rdoc.rb +99 -47
- data/lib/rdoc/ri/cache.rb +6 -6
- data/lib/rdoc/ri/display.rb +22 -75
- data/lib/rdoc/ri/driver.rb +237 -78
- data/lib/rdoc/stats.rb +91 -28
- data/lib/rdoc/template.rb +6 -2
- data/test/test.ja.rdoc +8 -0
- data/test/test.ja.txt +8 -0
- data/test/test_attribute_manager.rb +9 -6
- data/test/test_rdoc_markup.rb +4 -2
- data/test/test_rdoc_markup_attribute_manager.rb +13 -3
- data/test/test_rdoc_markup_to_html.rb +18 -2
- data/test/test_rdoc_markup_to_html_crossref.rb +186 -249
- data/test/test_rdoc_parser.rb +17 -1
- data/test/test_rdoc_parser_c.rb +65 -10
- data/test/test_rdoc_parser_perl.rb +4 -2
- data/test/test_rdoc_parser_ruby.rb +6 -4
- data/test/test_rdoc_ri_attribute_formatter.rb +4 -2
- data/test/test_rdoc_ri_default_display.rb +8 -4
- data/test/test_rdoc_ri_driver.rb +4 -2
- data/test/test_rdoc_ri_formatter.rb +6 -4
- data/test/test_rdoc_ri_overstrike_formatter.rb +4 -2
- metadata +84 -33
- metadata.gz.sig +0 -0
- data/lib/rdoc/generator/chm.rb +0 -113
- data/lib/rdoc/generator/chm/chm.rb +0 -100
- data/lib/rdoc/generator/html/frameless.rb +0 -92
- data/lib/rdoc/generator/html/hefss.rb +0 -150
- data/lib/rdoc/generator/html/kilmer.rb +0 -151
- data/lib/rdoc/generator/html/kilmerfactory.rb +0 -427
- data/lib/rdoc/generator/texinfo.rb +0 -81
- data/lib/rdoc/generator/texinfo/class.texinfo.erb +0 -44
- data/lib/rdoc/generator/texinfo/file.texinfo.erb +0 -6
- data/lib/rdoc/generator/texinfo/method.texinfo.erb +0 -6
- data/lib/rdoc/generator/texinfo/texinfo.erb +0 -28
- data/test/rdoc_markup_to_html_crossref_reference.rb +0 -31
- data/test/test_rdoc_info_formatting.rb +0 -175
- data/test/test_rdoc_info_sections.rb +0 -136
@@ -7,38 +7,30 @@ require 'rdoc/markup/to_html'
|
|
7
7
|
|
8
8
|
class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
##
|
12
11
|
# Regular expressions to match class and method references.
|
13
|
-
#
|
14
|
-
# 1
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# 2.) There can be a '::' in front of class names to reference
|
19
|
-
# from the top-level namespace.
|
20
|
-
# 3.) The method can be followed by parenthesis,
|
21
|
-
# which may or may not have things inside (this
|
22
|
-
# apparently is allowed for Fortran 95, but I also think that this
|
23
|
-
# is a good idea for Ruby, as it is very reasonable to want to
|
24
|
-
# reference a call with arguments).
|
12
|
+
#
|
13
|
+
# 1) There can be a '\' in front of text to suppress any cross-references
|
14
|
+
# 2) There can be a '::' in front of class names to reference from the
|
15
|
+
# top-level namespace.
|
16
|
+
# 3) The method can be followed by parenthesis which may
|
25
17
|
#
|
26
18
|
# NOTE: In order to support Fortran 95 properly, the [A-Z] below
|
27
19
|
# should be changed to [A-Za-z]. This slows down rdoc significantly,
|
28
20
|
# however, and the Fortran 95 support is broken in any case due to
|
29
21
|
# the return in handle_special_CROSSREF if the token consists
|
30
22
|
# entirely of lowercase letters.
|
31
|
-
|
32
|
-
# The markup/cross-referencing engine needs a rewrite for
|
33
|
-
# Fortran 95 to be supported properly.
|
23
|
+
|
34
24
|
CLASS_REGEXP_STR = '\\\\?((?:\:{2})?[A-Z]\w*(?:\:\:\w+)*)'
|
35
25
|
METHOD_REGEXP_STR = '(\w+[!?=]?)(?:\([\.\w+\*\/\+\-\=\<\>]*\))?'
|
36
26
|
|
27
|
+
##
|
37
28
|
# Regular expressions matching text that should potentially have
|
38
|
-
# cross-reference links generated are passed to add_special.
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
29
|
+
# cross-reference links generated are passed to add_special. Note that
|
30
|
+
# these expressions are meant to pick up text for which cross-references
|
31
|
+
# have been suppressed, since the suppression characters are removed by the
|
32
|
+
# code that is triggered.
|
33
|
+
|
42
34
|
CROSSREF_REGEXP = /(
|
43
35
|
# A::B::C.meth
|
44
36
|
#{CLASS_REGEXP_STR}[\.\#]#{METHOD_REGEXP_STR}
|
@@ -72,8 +64,14 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
72
64
|
)/x
|
73
65
|
|
74
66
|
##
|
75
|
-
#
|
76
|
-
|
67
|
+
# RDoc::Generator::Context for generating references
|
68
|
+
|
69
|
+
attr_accessor :context
|
70
|
+
|
71
|
+
##
|
72
|
+
# Creates a new crossref resolver that generates links relative to +context+
|
73
|
+
# which lives at +from_path+ in the generated files. '#' characters on
|
74
|
+
# references are removed unless +show_hash+ is true.
|
77
75
|
|
78
76
|
def initialize(from_path, context, show_hash)
|
79
77
|
raise ArgumentError, 'from_path cannot be nil' if from_path.nil?
|
@@ -89,19 +87,18 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
89
87
|
end
|
90
88
|
|
91
89
|
##
|
92
|
-
# We're invoked when any text matches the CROSSREF pattern
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
# prefix, because we look for it in module Generator first.
|
90
|
+
# We're invoked when any text matches the CROSSREF pattern (defined in
|
91
|
+
# MarkUp). If we find the corresponding reference, generate a hyperlink.
|
92
|
+
# If the name we're looking for contains no punctuation, we look for it up
|
93
|
+
# the module/class chain. For example, HyperlinkHtml is found, even without
|
94
|
+
# the Generator:: prefix, because we look for it in module Generator first.
|
98
95
|
|
99
96
|
def handle_special_CROSSREF(special)
|
100
97
|
name = special.text
|
101
98
|
|
102
99
|
# This ensures that words entirely consisting of lowercase letters will
|
103
|
-
# not have cross-references generated (to suppress lots of
|
104
|
-
#
|
100
|
+
# not have cross-references generated (to suppress lots of erroneous
|
101
|
+
# cross-references to "new" in text, for instance)
|
105
102
|
return name if name =~ /\A[a-z]*\z/
|
106
103
|
|
107
104
|
return @seen[name] if @seen.include? name
|
data/lib/rdoc/options.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
# We handle the parsing of options, and subsequently as a singleton
|
2
|
-
# object to be queried for option values
|
3
|
-
|
4
|
-
require "rdoc/ri/paths"
|
5
1
|
require 'optparse'
|
6
2
|
|
3
|
+
require 'rdoc/ri/paths'
|
4
|
+
|
5
|
+
##
|
6
|
+
# RDoc::Options handles the parsing and storage of options
|
7
|
+
|
7
8
|
class RDoc::Options
|
8
9
|
|
9
10
|
##
|
10
|
-
# Should the output be placed into a single file
|
11
|
+
# Should the output be placed into a single file?
|
11
12
|
|
12
13
|
attr_reader :all_one_file
|
13
14
|
|
@@ -22,9 +23,9 @@ class RDoc::Options
|
|
22
23
|
attr_reader :css
|
23
24
|
|
24
25
|
##
|
25
|
-
# Should diagrams be drawn
|
26
|
+
# Should diagrams be drawn?
|
26
27
|
|
27
|
-
|
28
|
+
attr_accessor :diagram
|
28
29
|
|
29
30
|
##
|
30
31
|
# Files matching this pattern will be excluded
|
@@ -42,7 +43,7 @@ class RDoc::Options
|
|
42
43
|
attr_accessor :extra_accessors
|
43
44
|
|
44
45
|
##
|
45
|
-
# Should we draw fileboxes in diagrams
|
46
|
+
# Should we draw fileboxes in diagrams?
|
46
47
|
|
47
48
|
attr_reader :fileboxes
|
48
49
|
|
@@ -65,14 +66,14 @@ class RDoc::Options
|
|
65
66
|
# Formatter to mark up text with
|
66
67
|
|
67
68
|
attr_accessor :formatter
|
68
|
-
|
69
|
+
|
69
70
|
##
|
70
|
-
#
|
71
|
+
# Image format for diagrams
|
71
72
|
|
72
73
|
attr_reader :image_format
|
73
74
|
|
74
75
|
##
|
75
|
-
# Include line numbers in the source listings
|
76
|
+
# Include line numbers in the source listings?
|
76
77
|
|
77
78
|
attr_reader :include_line_numbers
|
78
79
|
|
@@ -103,7 +104,7 @@ class RDoc::Options
|
|
103
104
|
attr_accessor :op_name
|
104
105
|
|
105
106
|
##
|
106
|
-
# Are we promiscuous about showing module contents across multiple files
|
107
|
+
# Are we promiscuous about showing module contents across multiple files?
|
107
108
|
|
108
109
|
attr_reader :promiscuous
|
109
110
|
|
@@ -113,7 +114,7 @@ class RDoc::Options
|
|
113
114
|
attr_reader :rdoc_include
|
114
115
|
|
115
116
|
##
|
116
|
-
# Include private and protected methods in the output
|
117
|
+
# Include private and protected methods in the output?
|
117
118
|
|
118
119
|
attr_accessor :show_all
|
119
120
|
|
@@ -128,7 +129,7 @@ class RDoc::Options
|
|
128
129
|
attr_reader :tab_width
|
129
130
|
|
130
131
|
##
|
131
|
-
#
|
132
|
+
# Template to be used when generating output
|
132
133
|
|
133
134
|
attr_reader :template
|
134
135
|
|
@@ -154,16 +155,16 @@ class RDoc::Options
|
|
154
155
|
|
155
156
|
attr_reader :webcvs
|
156
157
|
|
157
|
-
def initialize
|
158
|
+
def initialize # :nodoc:
|
159
|
+
require 'rdoc/rdoc'
|
158
160
|
@op_dir = "doc"
|
159
161
|
@op_name = nil
|
160
162
|
@show_all = false
|
161
163
|
@main_page = nil
|
162
164
|
@merge = false
|
163
165
|
@exclude = []
|
164
|
-
@generators =
|
165
|
-
@
|
166
|
-
@generator = @generators[@generator_name]
|
166
|
+
@generators = RDoc::RDoc::GENERATORS
|
167
|
+
@generator = RDoc::Generator::Darkfish
|
167
168
|
@rdoc_include = []
|
168
169
|
@title = nil
|
169
170
|
@template = nil
|
@@ -210,6 +211,8 @@ Usage: #{opt.program_name} [options] [names...]
|
|
210
211
|
How RDoc generates output depends on the output formatter being used, and on
|
211
212
|
the options you give.
|
212
213
|
|
214
|
+
- Darkfish is an improved, frameless HTML output by Michael Granger.
|
215
|
+
|
213
216
|
- HTML output is normally produced into a number of separate files
|
214
217
|
(one per class, module, and file, along with various indices).
|
215
218
|
These files will appear in the directory given by the --op
|
@@ -327,8 +330,10 @@ Usage: #{opt.program_name} [options] [names...]
|
|
327
330
|
|
328
331
|
opt.separator nil
|
329
332
|
|
333
|
+
generator_text = @generators.keys.map { |name| " #{name}" }.sort
|
334
|
+
|
330
335
|
opt.on("--fmt=FORMAT", "--format=FORMAT", "-f", @generators.keys,
|
331
|
-
"Set the output formatter.") do |value|
|
336
|
+
"Set the output formatter. One of:", *generator_text) do |value|
|
332
337
|
@generator_name = value.downcase
|
333
338
|
setup_generator
|
334
339
|
end
|
@@ -629,7 +634,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
629
634
|
|
630
635
|
def check_files
|
631
636
|
@files.each do |f|
|
632
|
-
stat = File.stat f
|
637
|
+
stat = File.stat f rescue next
|
633
638
|
raise RDoc::Error, "file '#{f}' not readable" unless stat.readable?
|
634
639
|
end
|
635
640
|
end
|
data/lib/rdoc/parser.rb
CHANGED
@@ -68,7 +68,12 @@ class RDoc::Parser
|
|
68
68
|
|
69
69
|
def self.binary?(file)
|
70
70
|
s = (File.read(file, File.stat(file).blksize) || "").split(//)
|
71
|
-
|
71
|
+
|
72
|
+
if s.size > 0 then
|
73
|
+
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
|
74
|
+
else
|
75
|
+
false
|
76
|
+
end
|
72
77
|
end
|
73
78
|
private_class_method :binary?
|
74
79
|
|
@@ -81,7 +86,7 @@ class RDoc::Parser
|
|
81
86
|
#
|
82
87
|
# The default parser should *NOT* parse binary files.
|
83
88
|
#
|
84
|
-
if parser == RDoc::Parser::Simple then
|
89
|
+
if parser == RDoc::Parser::Simple && file_name !~ /\.(txt|rdoc)$/ then
|
85
90
|
if binary? file_name then
|
86
91
|
return nil
|
87
92
|
end
|
@@ -106,6 +111,9 @@ class RDoc::Parser
|
|
106
111
|
|
107
112
|
parser = can_parse file_name
|
108
113
|
|
114
|
+
# This method must return a parser.
|
115
|
+
parser ||= RDoc::Parser::Simple
|
116
|
+
|
109
117
|
parser.new top_level, file_name, body, options, stats
|
110
118
|
end
|
111
119
|
|
data/lib/rdoc/parser/c.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rdoc/parser'
|
2
|
+
require 'rdoc/parser/ruby'
|
2
3
|
require 'rdoc/known_classes'
|
3
4
|
|
4
5
|
##
|
@@ -95,8 +96,21 @@ class RDoc::Parser::C < RDoc::Parser
|
|
95
96
|
|
96
97
|
parse_files_matching(/\.(?:([CcHh])\1?|c([+xp])\2|y)\z/)
|
97
98
|
|
98
|
-
|
99
|
-
|
99
|
+
##
|
100
|
+
# C file the parser is parsing
|
101
|
+
|
102
|
+
attr_accessor :content
|
103
|
+
|
104
|
+
##
|
105
|
+
# Resets cross-file state. Call when parsing different projects that need
|
106
|
+
# separate documentation.
|
107
|
+
|
108
|
+
def self.reset
|
109
|
+
@@enclosure_classes = {}
|
110
|
+
@@known_bodies = {}
|
111
|
+
end
|
112
|
+
|
113
|
+
reset
|
100
114
|
|
101
115
|
##
|
102
116
|
# Prepare to parse a C file
|
@@ -123,7 +137,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
123
137
|
end
|
124
138
|
|
125
139
|
def do_classes
|
126
|
-
@content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
|
140
|
+
@content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do
|
127
141
|
|var_name, class_name|
|
128
142
|
handle_class_module(var_name, "module", class_name, nil, nil)
|
129
143
|
end
|
@@ -269,12 +283,13 @@ class RDoc::Parser::C < RDoc::Parser
|
|
269
283
|
|
270
284
|
def find_body(class_name, meth_name, meth_obj, body, quiet = false)
|
271
285
|
case body
|
272
|
-
when %r"((?>/\*.*?\*/\s*)
|
273
|
-
\s*(\([^)]*\))([^;]|$)"xm
|
274
|
-
comment
|
275
|
-
body_text =
|
286
|
+
when %r"((?>/\*.*?\*/\s*))((?:(?:static|SWIGINTERN)\s+)?(?:intern\s+)?VALUE\s+#{meth_name}
|
287
|
+
\s*(\([^)]*\))([^;]|$))"xm
|
288
|
+
comment = $1
|
289
|
+
body_text = $2
|
290
|
+
params = $3
|
276
291
|
|
277
|
-
remove_private_comments
|
292
|
+
remove_private_comments comment if comment
|
278
293
|
|
279
294
|
# see if we can find the whole body
|
280
295
|
|
@@ -287,15 +302,15 @@ class RDoc::Parser::C < RDoc::Parser
|
|
287
302
|
# distinct (for example Kernel.hash and Kernel.object_id share the same
|
288
303
|
# implementation
|
289
304
|
|
290
|
-
override_comment = find_override_comment
|
305
|
+
override_comment = find_override_comment class_name, meth_obj.name
|
291
306
|
comment = override_comment if override_comment
|
292
307
|
|
293
|
-
find_modifiers
|
308
|
+
find_modifiers comment, meth_obj if comment
|
294
309
|
|
295
310
|
# meth_obj.params = params
|
296
311
|
meth_obj.start_collecting_tokens
|
297
|
-
meth_obj.add_token
|
298
|
-
meth_obj.comment = mangle_comment
|
312
|
+
meth_obj.add_token RDoc::RubyToken::Token.new(1,1).set_text(body_text)
|
313
|
+
meth_obj.comment = mangle_comment comment
|
299
314
|
when %r{((?>/\*.*?\*/\s*))^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
|
300
315
|
comment = $1
|
301
316
|
find_body(class_name, $2, meth_obj, body, true)
|
@@ -364,25 +379,18 @@ class RDoc::Parser::C < RDoc::Parser
|
|
364
379
|
|
365
380
|
def find_class_comment(class_name, class_meth)
|
366
381
|
comment = nil
|
382
|
+
|
367
383
|
if @content =~ %r{((?>/\*.*?\*/\s+))
|
368
384
|
(static\s+)?void\s+Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)\)}xmi then
|
369
385
|
comment = $1
|
370
|
-
elsif @content =~ %r{Document-(?:class|module):\s
|
386
|
+
elsif @content =~ %r{Document-(?:class|module):\s+#{class_name}\s*?(?:<\s+[:,\w]+)?\n((?>.*?\*/))}m then
|
387
|
+
comment = $1
|
388
|
+
elsif @content =~ %r{((?>/\*.*?\*/\s+))
|
389
|
+
([\w\.\s]+\s* = \s+)?rb_define_(class|module).*?"(#{class_name})"}xm then
|
371
390
|
comment = $1
|
372
|
-
else
|
373
|
-
if @content =~ /rb_define_(class|module)/m then
|
374
|
-
class_name = class_name.split("::").last
|
375
|
-
comments = []
|
376
|
-
@content.split(/(\/\*.*?\*\/)\s*?\n/m).each_with_index do |chunk, index|
|
377
|
-
comments[index] = chunk
|
378
|
-
if chunk =~ /rb_define_(class|module).*?"(#{class_name})"/m then
|
379
|
-
comment = comments[index-1]
|
380
|
-
break
|
381
|
-
end
|
382
|
-
end
|
383
|
-
end
|
384
391
|
end
|
385
|
-
|
392
|
+
|
393
|
+
class_meth.comment = mangle_comment comment if comment
|
386
394
|
end
|
387
395
|
|
388
396
|
##
|
@@ -424,7 +432,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
424
432
|
|
425
433
|
def find_override_comment(class_name, meth_name)
|
426
434
|
name = Regexp.escape(meth_name)
|
427
|
-
if @content =~ %r{Document-method:\s+#{class_name}(
|
435
|
+
if @content =~ %r{Document-method:\s+#{class_name}(?:\.|::|#)#{name}\s*?\n((?>.*?\*/))}m then
|
428
436
|
$1
|
429
437
|
elsif @content =~ %r{Document-method:\s#{name}\s*?\n((?>.*?\*/))}m then
|
430
438
|
$1
|
@@ -491,9 +499,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
491
499
|
@stats.add_module cm
|
492
500
|
end
|
493
501
|
|
494
|
-
cm.record_location
|
502
|
+
cm.record_location enclosure.toplevel
|
503
|
+
|
504
|
+
find_class_comment cm.full_name, cm
|
495
505
|
|
496
|
-
find_class_comment(cm.full_name, cm)
|
497
506
|
@classes[var_name] = cm
|
498
507
|
@@enclosure_classes[var_name] = cm
|
499
508
|
@known_classes[var_name] = cm.full_name
|
data/lib/rdoc/parser/f95.rb
CHANGED
@@ -295,7 +295,7 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
295
295
|
|
296
296
|
@stats.add_module f9x_module
|
297
297
|
|
298
|
-
f9x_comment = COMMENTS_ARE_UPPER ?
|
298
|
+
f9x_comment = COMMENTS_ARE_UPPER ?
|
299
299
|
find_comments(pre_comment.join("\n")) + "\n" + module_trailing :
|
300
300
|
module_trailing + "\n" + find_comments(module_code.sub(/^.*$\n/i, ''))
|
301
301
|
f9x_module.comment = f9x_comment
|
@@ -320,8 +320,8 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
320
320
|
program_code = module_program_code
|
321
321
|
program_trailing = module_program_trailing
|
322
322
|
# progress "p" # HACK what stats thingy does this correspond to?
|
323
|
-
program_comment = COMMENTS_ARE_UPPER ?
|
324
|
-
find_comments(pre_comment.join("\n")) + "\n" + program_trailing :
|
323
|
+
program_comment = COMMENTS_ARE_UPPER ?
|
324
|
+
find_comments(pre_comment.join("\n")) + "\n" + program_trailing :
|
325
325
|
program_trailing + "\n" + find_comments(program_code.sub(/^.*$\n/i, ''))
|
326
326
|
program_comment = "\n\n= <i>Program</i> <tt>#{program_name}</tt>\n\n" \
|
327
327
|
+ program_comment
|
@@ -410,12 +410,12 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
410
410
|
# This information is used when "add_method" and
|
411
411
|
# "set_visibility_for" are called.
|
412
412
|
#
|
413
|
-
visibility_default, visibility_info =
|
413
|
+
visibility_default, visibility_info =
|
414
414
|
parse_visibility(remaining_lines.join("\n"), visibility, container)
|
415
415
|
@@public_methods.concat visibility_info
|
416
416
|
if visibility_default == :public
|
417
417
|
if !cascaded_modules_list.empty?
|
418
|
-
cascaded_modules =
|
418
|
+
cascaded_modules =
|
419
419
|
Attr.new("Cascaded Modules",
|
420
420
|
"Imported modules all of whose components are published again",
|
421
421
|
"",
|
@@ -499,7 +499,7 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
499
499
|
type_trailing = find_comments($4)
|
500
500
|
next if type_trailing =~ /^:nodoc:/
|
501
501
|
type_visibility = $1
|
502
|
-
type_comment = COMMENTS_ARE_UPPER ?
|
502
|
+
type_comment = COMMENTS_ARE_UPPER ?
|
503
503
|
find_comments($~.pre_match) + "\n" + type_trailing :
|
504
504
|
type_trailing + "\n" + find_comments(type_code.sub(/^.*$\n/i, ''))
|
505
505
|
type_element_visibility_public = true
|
@@ -567,8 +567,8 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
567
567
|
end
|
568
568
|
|
569
569
|
if !derived_types_comment.empty?
|
570
|
-
derived_types_table =
|
571
|
-
Attr.new("Derived Types", "Derived_Types", "",
|
570
|
+
derived_types_table =
|
571
|
+
Attr.new("Derived Types", "Derived_Types", "",
|
572
572
|
derived_types_comment)
|
573
573
|
container.add_attribute(derived_types_table)
|
574
574
|
end
|
@@ -733,8 +733,8 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
733
733
|
subroutine_trailing = procedure_trailing
|
734
734
|
subroutine_code = procedure_code
|
735
735
|
|
736
|
-
subroutine_comment = COMMENTS_ARE_UPPER ?
|
737
|
-
pre_comment.join("\n") + "\n" + subroutine_trailing :
|
736
|
+
subroutine_comment = COMMENTS_ARE_UPPER ?
|
737
|
+
pre_comment.join("\n") + "\n" + subroutine_trailing :
|
738
738
|
subroutine_trailing + "\n" + subroutine_code.sub(/^.*$\n/i, '')
|
739
739
|
subroutine = AnyMethod.new("subroutine", subroutine_name)
|
740
740
|
parse_subprogram(subroutine, subroutine_params,
|
@@ -787,7 +787,7 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
787
787
|
|
788
788
|
# The visibility of procedure is specified
|
789
789
|
#
|
790
|
-
set_visibility(container, procedure_name,
|
790
|
+
set_visibility(container, procedure_name,
|
791
791
|
visibility_default, @@public_methods)
|
792
792
|
|
793
793
|
# The alias for this procedure from external modules
|
@@ -871,11 +871,11 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
871
871
|
next if !old_meth
|
872
872
|
nolink = old_meth.visibility == :private ? true : nil
|
873
873
|
nolink = nil if @options.show_all
|
874
|
-
new_meth =
|
875
|
-
initialize_external_method(generic_name, proc,
|
876
|
-
old_meth.params, nil,
|
877
|
-
old_meth.comment,
|
878
|
-
old_meth.clone.token_stream[0].text,
|
874
|
+
new_meth =
|
875
|
+
initialize_external_method(generic_name, proc,
|
876
|
+
old_meth.params, nil,
|
877
|
+
old_meth.comment,
|
878
|
+
old_meth.clone.token_stream[0].text,
|
879
879
|
true, nolink)
|
880
880
|
new_meth.singleton = old_meth.singleton
|
881
881
|
|
@@ -937,10 +937,10 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
937
937
|
end
|
938
938
|
|
939
939
|
if indicated_method
|
940
|
-
external_method =
|
941
|
-
initialize_external_method(generic_name, proc,
|
942
|
-
indicated_method.params,
|
943
|
-
indicated_file,
|
940
|
+
external_method =
|
941
|
+
initialize_external_method(generic_name, proc,
|
942
|
+
indicated_method.params,
|
943
|
+
indicated_file,
|
944
944
|
indicated_method.comment)
|
945
945
|
|
946
946
|
@stats.add_method external_method
|
@@ -1004,12 +1004,12 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
1004
1004
|
# Parse arguments, comment, code of subroutine and function. Return
|
1005
1005
|
# AnyMethod object.
|
1006
1006
|
|
1007
|
-
def parse_subprogram(subprogram, params, comment, code,
|
1007
|
+
def parse_subprogram(subprogram, params, comment, code,
|
1008
1008
|
before_contains=nil, function=nil, prefix=nil)
|
1009
1009
|
subprogram.singleton = false
|
1010
1010
|
prefix = "" if !prefix
|
1011
1011
|
arguments = params.sub(/\(/, "").sub(/\)/, "").split(",") if params
|
1012
|
-
args_comment, params_opt =
|
1012
|
+
args_comment, params_opt =
|
1013
1013
|
find_arguments(arguments, code.sub(/^s*?contains\s*?(!.*?)?$.*/im, ""),
|
1014
1014
|
nil, nil, true)
|
1015
1015
|
params_opt = "( " + params_opt + " ) " if params_opt
|
@@ -1086,7 +1086,7 @@ class RDoc::Parser::F95 < RDoc::Parser
|
|
1086
1086
|
if arg == defitem.varname.strip.chomp || all
|
1087
1087
|
args_rdocforms << <<-"EOF"
|
1088
1088
|
|
1089
|
-
#{indent}<tt><b>#{defitem.varname.chomp.strip}#{defitem.arraysuffix}</b> #{defitem.inivalue}</tt> ::
|
1089
|
+
#{indent}<tt><b>#{defitem.varname.chomp.strip}#{defitem.arraysuffix}</b> #{defitem.inivalue}</tt> ::
|
1090
1090
|
#{indent} <tt>#{defitem.types.chomp.strip}</tt>
|
1091
1091
|
EOF
|
1092
1092
|
if !defitem.comment.chomp.strip.empty?
|
@@ -1096,7 +1096,7 @@ EOF
|
|
1096
1096
|
}
|
1097
1097
|
args_rdocforms << <<-"EOF"
|
1098
1098
|
|
1099
|
-
#{indent} <tt></tt> ::
|
1099
|
+
#{indent} <tt></tt> ::
|
1100
1100
|
#{indent} <tt></tt>
|
1101
1101
|
#{indent} #{comment.chomp.strip}
|
1102
1102
|
EOF
|
@@ -1130,7 +1130,7 @@ EOF
|
|
1130
1130
|
before_contains = "" if !before_contains
|
1131
1131
|
while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i
|
1132
1132
|
lines = $~.post_match
|
1133
|
-
nml_comment = COMMENTS_ARE_UPPER ?
|
1133
|
+
nml_comment = COMMENTS_ARE_UPPER ?
|
1134
1134
|
find_comments($~.pre_match) : find_comments($~.post_match)
|
1135
1135
|
nml_name = $1
|
1136
1136
|
nml_args = $2.split(",")
|
@@ -1193,7 +1193,7 @@ EOF
|
|
1193
1193
|
|
1194
1194
|
if internal
|
1195
1195
|
external_alias_header = "#{INTERNAL_ALIAS_MES} "
|
1196
|
-
external_alias_text = external_alias_header + old
|
1196
|
+
external_alias_text = external_alias_header + old
|
1197
1197
|
elsif file
|
1198
1198
|
external_alias_header = "#{EXTERNAL_ALIAS_MES} "
|
1199
1199
|
external_alias_text = external_alias_header + file + "#" + old
|
@@ -1325,8 +1325,8 @@ EOF
|
|
1325
1325
|
subname.upcase == alias_item["old_name"].upcase &&
|
1326
1326
|
@options.ignore_case
|
1327
1327
|
|
1328
|
-
new_meth = initialize_external_method(alias_item["new_name"],
|
1329
|
-
subname, params, @file_name,
|
1328
|
+
new_meth = initialize_external_method(alias_item["new_name"],
|
1329
|
+
subname, params, @file_name,
|
1330
1330
|
comment)
|
1331
1331
|
new_meth.visibility = alias_item["visibility"]
|
1332
1332
|
|
@@ -1402,7 +1402,7 @@ EOF
|
|
1402
1402
|
brank_flag = false
|
1403
1403
|
now_continuing = false
|
1404
1404
|
next ""
|
1405
|
-
else
|
1405
|
+
else
|
1406
1406
|
brank_flag = false
|
1407
1407
|
now_continuing = false
|
1408
1408
|
ignore = false
|
@@ -1595,7 +1595,7 @@ EOF
|
|
1595
1595
|
comment_block = Array.new
|
1596
1596
|
checked = false
|
1597
1597
|
lines.each do |line|
|
1598
|
-
if !checked
|
1598
|
+
if !checked
|
1599
1599
|
if /^\s?#{INTERNAL_ALIAS_MES}/ =~ line ||
|
1600
1600
|
/^\s?#{EXTERNAL_ALIAS_MES}/ =~ line
|
1601
1601
|
checked = true
|
@@ -1676,9 +1676,9 @@ EOF
|
|
1676
1676
|
|
1677
1677
|
def to_s
|
1678
1678
|
return <<-EOF
|
1679
|
-
<Fortran95Definition:
|
1679
|
+
<Fortran95Definition:
|
1680
1680
|
varname=#{@varname}, types=#{types},
|
1681
|
-
inivalue=#{@inivalue}, arraysuffix=#{@arraysuffix}, nodoc=#{@nodoc},
|
1681
|
+
inivalue=#{@inivalue}, arraysuffix=#{@arraysuffix}, nodoc=#{@nodoc},
|
1682
1682
|
comment=
|
1683
1683
|
#{@comment}
|
1684
1684
|
>
|