rdoc 3.10.pre.3 → 3.10
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/History.rdoc +35 -4
- data/LEGAL.rdoc +27 -0
- data/Manifest.txt +1 -0
- data/Rakefile +4 -0
- data/TODO.rdoc +4 -0
- data/lib/gauntlet_rdoc.rb +36 -4
- data/lib/rdoc.rb +21 -2
- data/lib/rdoc/any_method.rb +6 -2
- data/lib/rdoc/class_module.rb +4 -0
- data/lib/rdoc/context.rb +1 -2
- data/lib/rdoc/generator/template/darkfish/class.rhtml +4 -2
- data/lib/rdoc/include.rb +19 -7
- data/lib/rdoc/markup/parser.rb +21 -4
- data/lib/rdoc/markup/to_html_crossref.rb +2 -0
- data/lib/rdoc/method_attr.rb +15 -2
- data/lib/rdoc/options.rb +229 -5
- data/lib/rdoc/parser/c.rb +19 -6
- data/lib/rdoc/parser/ruby.rb +3 -5
- data/lib/rdoc/rdoc.rb +33 -6
- data/lib/rdoc/ruby_lex.rb +4 -3
- data/lib/rdoc/test_case.rb +17 -0
- data/lib/rdoc/top_level.rb +8 -0
- data/test/test_rdoc_any_method.rb +9 -0
- data/test/test_rdoc_attr.rb +13 -0
- data/test/test_rdoc_class_module.rb +13 -0
- data/test/test_rdoc_context.rb +10 -10
- data/test/test_rdoc_cross_reference.rb +8 -8
- data/test/test_rdoc_markup_parser.rb +58 -0
- data/test/test_rdoc_markup_to_html_crossref.rb +16 -8
- data/test/test_rdoc_method_attr.rb +13 -0
- data/test/test_rdoc_options.rb +161 -13
- data/test/test_rdoc_parser_c.rb +15 -0
- data/test/test_rdoc_rdoc.rb +35 -16
- data/test/test_rdoc_ruby_lex.rb +19 -0
- data/test/test_rdoc_top_level.rb +9 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
* Major enhancements
|
4
4
|
* RDoc HTML output has been improved:
|
5
|
-
* The search from Володя Колесников's
|
5
|
+
* The search from Володя Колесников's (Vladimir Kolesnikov) Sdoc has been
|
6
|
+
integrated.
|
6
7
|
|
7
8
|
The search index generation is a reusable component through
|
8
9
|
RDoc::Generator::JsonIndex
|
@@ -24,8 +25,21 @@
|
|
24
25
|
overrides the default markup format.
|
25
26
|
|
26
27
|
The markup format can be set for rake tasks using RDoc::Task#markup
|
28
|
+
* RDoc can save and load an options file.
|
29
|
+
|
30
|
+
To create an options file that defaults to using TomDoc markup run:
|
31
|
+
|
32
|
+
rdoc --markup tomdoc --write-options
|
33
|
+
|
34
|
+
This will create a .rdoc_options file. Check it in to your VCS and
|
35
|
+
package it with your gem. RDoc will automatically load this file and
|
36
|
+
combine it with the user's options.
|
37
|
+
|
38
|
+
Some options are not saved. See RDoc::Options@Saved+Options for full
|
39
|
+
details.
|
27
40
|
|
28
41
|
* Minor enhancements
|
42
|
+
* RDoc autoloads everything. You only need to require 'rdoc' now.
|
29
43
|
* HTML headings now have ids matching their titles.
|
30
44
|
|
31
45
|
= Hello!
|
@@ -39,9 +53,9 @@
|
|
39
53
|
<tt>RDoc::Markup@Links</tt>
|
40
54
|
|
41
55
|
See RDoc::Markup@Links for further details.
|
42
|
-
*
|
43
|
-
|
44
|
-
|
56
|
+
* For HTML output RDoc uses +SomeClass.method_name+ and
|
57
|
+
+SomeClass#method_name+ for remote methods and attributes and
|
58
|
+
+::method_name+ and +#method_name+ for local methods.
|
45
59
|
* RDoc makes an effort to syntax-highlight ruby code in verbatim sections.
|
46
60
|
See RDoc::Markup@Paragraphs+and+Verbatim
|
47
61
|
* Added RDoc::TopLevel#text? and RDoc::Parser::Text to indicate a
|
@@ -58,6 +72,10 @@
|
|
58
72
|
* Moved token stream HTML markup out of RDoc::AnyMethod#markup_code into
|
59
73
|
RDoc::TokenStream::to_html
|
60
74
|
* "Top" link in section headers is no longer inside the heading element.
|
75
|
+
* RDoc avoids printing some warnings unless run with `rdoc --verbose`. For
|
76
|
+
Rails issue #1646.
|
77
|
+
* Finishing a paragraph with two or more spaces will result in a line break.
|
78
|
+
This feature is experimental and may be modified or removed.
|
61
79
|
|
62
80
|
* Bug fixes
|
63
81
|
* Markup defined by RDoc::Markup#add_special inside a <tt><tt></tt> is no
|
@@ -71,6 +89,19 @@
|
|
71
89
|
* Fixed RDoc::Markup::Parser for CRLF line endings. Issue #67 by Marvin
|
72
90
|
Gülker.
|
73
91
|
* Fixed lexing of percent strings like %r{#}. Issue #68 by eclectic923.
|
92
|
+
* The C parser now understands classes defined with
|
93
|
+
+rb_struct_define_without_accessor+ (like Range). Pull Request #73 by Dan
|
94
|
+
Bernier
|
95
|
+
* Fixed lexing of <code>a b <<-HEREDOC</code>. Issue #75 by John Mair.
|
96
|
+
* Added LEGAL.rdoc with references to licenses in other files. Issue #78 by
|
97
|
+
Dmitry Jemerov.
|
98
|
+
* Block parameters are displayed in Darkfish output again. Issue #76 by
|
99
|
+
Andrea Singh.
|
100
|
+
* The method parameter coverage report no longer includes parameter default
|
101
|
+
values. Issue #77 by Jake Goulding.
|
102
|
+
* The module for an include is not looked up until parsed all the files are
|
103
|
+
parsed. Unless your project includes nonexistent modules this avoids
|
104
|
+
worst-case behavior (<tt>O(n!)</tt>) of RDoc::Include#module.
|
74
105
|
|
75
106
|
=== 3.9.2 / 2011-08-11
|
76
107
|
|
data/LEGAL.rdoc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
|
3
|
+
= Legal Notice Information
|
4
|
+
|
5
|
+
The files in this distribution are covered by the Ruby license (see LICENSE) except the features mentioned below:
|
6
|
+
|
7
|
+
Darkfish::
|
8
|
+
Darkfish was written by Michael Granger and is included under the MIT
|
9
|
+
license. Darkfish contains images from the Silk Icons set by Mark James.
|
10
|
+
|
11
|
+
See lib/rdoc/generator/darkfish.rb for license information.
|
12
|
+
|
13
|
+
* lib/rdoc/generator/darkfish.rb
|
14
|
+
* lib/rdoc/generator/template/darkfish/*
|
15
|
+
* lib/rdoc/generator/template/darkfish/images
|
16
|
+
|
17
|
+
Sdoc::
|
18
|
+
Portions of SDoc by (Володя Колесников) Vladimir Kolesnikov are included
|
19
|
+
under the MIT license as RDoc::Generator::JsonIndex. See
|
20
|
+
lib/rdoc/generator/json_index.rb for license information.
|
21
|
+
|
22
|
+
* lib/rdoc/generator/json_index.rb
|
23
|
+
* lib/rdoc/generator/template/json_index/*
|
24
|
+
* The +#search_index+ methods on RDoc::CodeObject subclasses were derived
|
25
|
+
from sdoc.
|
26
|
+
* RDoc::ClassModule#document_self_or_methods comes from Sdoc.
|
27
|
+
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -2,6 +2,8 @@ $:.unshift File.expand_path 'lib'
|
|
2
2
|
require 'rdoc'
|
3
3
|
require 'hoe'
|
4
4
|
|
5
|
+
ENV['BENCHMARK'] = 'yes'
|
6
|
+
|
5
7
|
task :docs => :generate
|
6
8
|
task :test => :generate
|
7
9
|
|
@@ -41,6 +43,7 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
|
|
41
43
|
self.extra_rdoc_files += %w[
|
42
44
|
History.rdoc
|
43
45
|
LICENSE.rdoc
|
46
|
+
LEGAL.rdoc
|
44
47
|
README.rdoc
|
45
48
|
RI.rdoc
|
46
49
|
TODO.rdoc
|
@@ -128,3 +131,4 @@ task :diff_rubinius do
|
|
128
131
|
sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true"
|
129
132
|
end
|
130
133
|
|
134
|
+
|
data/TODO.rdoc
CHANGED
@@ -11,11 +11,15 @@ Some file contains some things that might happen in RDoc, or might not
|
|
11
11
|
* Add direct accessor to RDoc::Options to RDoc::Task
|
12
12
|
* Remove Public in HTML output if there are only public methods
|
13
13
|
* Method markup support for rd documentation
|
14
|
+
* Improve SIGINFO handling
|
15
|
+
* Global variable support
|
16
|
+
* Page support for ri
|
14
17
|
|
15
18
|
=== 4
|
16
19
|
|
17
20
|
API changes to RDoc
|
18
21
|
|
22
|
+
* Remove global state
|
19
23
|
* Remove RDoc::RDocError
|
20
24
|
* RDoc::TopLevel#add_method should automatically create the appropriate method
|
21
25
|
class rather than requiring one be passed in.
|
data/lib/gauntlet_rdoc.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
Gem.load_yaml
|
1
3
|
require 'rdoc'
|
2
4
|
require 'gauntlet'
|
3
5
|
require 'fileutils'
|
@@ -7,19 +9,33 @@ require 'fileutils'
|
|
7
9
|
|
8
10
|
class RDoc::Gauntlet < Gauntlet
|
9
11
|
|
12
|
+
def initialize # :nodoc:
|
13
|
+
super
|
14
|
+
|
15
|
+
@args = nil
|
16
|
+
@type = nil
|
17
|
+
end
|
18
|
+
|
10
19
|
##
|
11
20
|
# Runs an RDoc generator for gem +name+
|
12
21
|
|
13
22
|
def run name
|
14
23
|
return if self.data.key? name
|
15
24
|
|
16
|
-
dir = File.expand_path "~/.gauntlet/data
|
25
|
+
dir = File.expand_path "~/.gauntlet/data/#{@type}/#{name}"
|
17
26
|
FileUtils.rm_rf dir if File.exist? dir
|
18
27
|
|
19
28
|
yaml = File.read 'gemspec'
|
20
|
-
|
29
|
+
begin
|
30
|
+
spec = Gem::Specification.from_yaml yaml
|
31
|
+
rescue Psych::SyntaxError
|
32
|
+
puts "bad spec #{name}"
|
33
|
+
self.data[name] = false
|
34
|
+
return
|
35
|
+
end
|
21
36
|
|
22
|
-
args =
|
37
|
+
args = @args.dup
|
38
|
+
args << '--op' << dir
|
23
39
|
args.push(*spec.rdoc_options)
|
24
40
|
args << spec.require_paths
|
25
41
|
args << spec.extra_rdoc_files
|
@@ -46,7 +62,23 @@ class RDoc::Gauntlet < Gauntlet
|
|
46
62
|
puts
|
47
63
|
end
|
48
64
|
|
65
|
+
##
|
66
|
+
# Runs the gauntlet with the given +type+ (rdoc or ri) and +filter+ for
|
67
|
+
# which gems to run
|
68
|
+
|
69
|
+
def run_the_gauntlet type = 'rdoc', filter = nil
|
70
|
+
@type = type || 'rdoc'
|
71
|
+
@args = type == 'rdoc' ? [] : %w[--ri]
|
72
|
+
@data_file = "#{DATADIR}/#{@type}-data.yml"
|
73
|
+
|
74
|
+
super filter
|
75
|
+
end
|
76
|
+
|
49
77
|
end
|
50
78
|
|
51
|
-
|
79
|
+
type = ARGV.shift
|
80
|
+
filter = ARGV.shift
|
81
|
+
filter = /#{filter}/ if filter
|
82
|
+
|
83
|
+
RDoc::Gauntlet.new.run_the_gauntlet type, filter
|
52
84
|
|
data/lib/rdoc.rb
CHANGED
@@ -27,13 +27,15 @@ $DEBUG_RDOC = nil
|
|
27
27
|
# * If you want to use RDoc to create documentation for your Ruby source files,
|
28
28
|
# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line
|
29
29
|
# usage.
|
30
|
+
# * If you want to store rdoc configuration in your gem see
|
31
|
+
# RDoc::Options@Saved+Options
|
30
32
|
# * If you want to write documentation for Ruby files see RDoc::Parser::Ruby
|
31
33
|
# * If you want to write documentation for extensions written in C see
|
32
34
|
# RDoc::Parser::C
|
33
35
|
# * If you want to generate documentation using <tt>rake</tt> see RDoc::Task.
|
34
36
|
# * If you want to drive RDoc programmatically, see RDoc::RDoc.
|
35
|
-
# * If you want to use the library to format text blocks into HTML
|
36
|
-
# RDoc::Markup.
|
37
|
+
# * If you want to use the library to format text blocks into HTML or other
|
38
|
+
# formats, look at RDoc::Markup.
|
37
39
|
# * If you want to make an RDoc plugin such as a generator or directive
|
38
40
|
# handler see RDoc::RDoc.
|
39
41
|
# * If you want to write your own output generator see RDoc::Generator.
|
@@ -143,6 +145,23 @@ module RDoc
|
|
143
145
|
METHOD_MODIFIERS = GENERAL_MODIFIERS +
|
144
146
|
%w[arg args yield yields notnew not-new not_new doc]
|
145
147
|
|
148
|
+
##
|
149
|
+
# Loads the best available YAML library.
|
150
|
+
|
151
|
+
def self.load_yaml
|
152
|
+
begin
|
153
|
+
gem 'psych'
|
154
|
+
rescue Gem::LoadError
|
155
|
+
end
|
156
|
+
|
157
|
+
begin
|
158
|
+
require 'psych'
|
159
|
+
rescue ::LoadError
|
160
|
+
ensure
|
161
|
+
require 'yaml'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
146
165
|
autoload :RDoc, 'rdoc/rdoc'
|
147
166
|
|
148
167
|
autoload :TestCase, 'rdoc/test_case'
|
data/lib/rdoc/any_method.rb
CHANGED
@@ -166,7 +166,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
166
166
|
return []
|
167
167
|
end
|
168
168
|
|
169
|
-
params.gsub(/\s+/, '').split ','
|
169
|
+
params = params.gsub(/\s+/, '').split ','
|
170
|
+
|
171
|
+
params.map { |param| param.sub(/=.*/, '') }
|
170
172
|
end
|
171
173
|
|
172
174
|
##
|
@@ -178,10 +180,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
178
180
|
params = @call_seq.split("\n").last
|
179
181
|
params = params.sub(/[^( ]+/, '')
|
180
182
|
params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2')
|
181
|
-
|
183
|
+
elsif @params then
|
182
184
|
params = @params.gsub(/\s*\#.*/, '')
|
183
185
|
params = params.tr("\n", " ").squeeze(" ")
|
184
186
|
params = "(#{params})" unless params[0] == ?(
|
187
|
+
else
|
188
|
+
params = ''
|
185
189
|
end
|
186
190
|
|
187
191
|
if @block_params then
|
data/lib/rdoc/class_module.rb
CHANGED
@@ -374,6 +374,8 @@ class RDoc::ClassModule < RDoc::Context
|
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
377
|
+
@includes.uniq! # clean up
|
378
|
+
|
377
379
|
merge_collections method_list, cm.method_list, other_files do |add, meth|
|
378
380
|
if add then
|
379
381
|
add_method meth
|
@@ -609,6 +611,8 @@ class RDoc::ClassModule < RDoc::Context
|
|
609
611
|
mod = include.module
|
610
612
|
!(String === mod) && RDoc::TopLevel.all_modules_hash[mod.full_name].nil?
|
611
613
|
end
|
614
|
+
|
615
|
+
includes.uniq!
|
612
616
|
end
|
613
617
|
|
614
618
|
end
|
data/lib/rdoc/context.rb
CHANGED
@@ -398,8 +398,7 @@ class RDoc::Context < RDoc::CodeObject
|
|
398
398
|
# Adds included module +include+ which should be an RDoc::Include
|
399
399
|
|
400
400
|
def add_include include
|
401
|
-
add_to @includes, include
|
402
|
-
@includes.map { |i| i.full_name }.include? include.full_name
|
401
|
+
add_to @includes, include
|
403
402
|
|
404
403
|
include
|
405
404
|
end
|
@@ -104,7 +104,9 @@
|
|
104
104
|
<% if method.call_seq then %>
|
105
105
|
<% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
|
106
106
|
<div class="method-heading">
|
107
|
-
<span class="method-callseq"
|
107
|
+
<span class="method-callseq">
|
108
|
+
<%= h(call_seq.strip.gsub( /^\w+\./m, '')).gsub(/[-=]>/, '→') %>
|
109
|
+
</span>
|
108
110
|
<% if i == 0 then %>
|
109
111
|
<span class="method-click-advice">click to toggle source</span>
|
110
112
|
<% end %>
|
@@ -113,7 +115,7 @@
|
|
113
115
|
<% else %>
|
114
116
|
<div class="method-heading">
|
115
117
|
<span class="method-name"><%= h method.name %></span><span
|
116
|
-
class="method-args"><%= method.
|
118
|
+
class="method-args"><%= method.param_seq %></span>
|
117
119
|
<span class="method-click-advice">click to toggle source</span>
|
118
120
|
</div>
|
119
121
|
<% end %>
|
data/lib/rdoc/include.rb
CHANGED
@@ -15,7 +15,7 @@ class RDoc::Include < RDoc::CodeObject
|
|
15
15
|
super()
|
16
16
|
@name = name
|
17
17
|
self.comment = comment
|
18
|
-
@module = nil
|
18
|
+
@module = nil # cache for module if found
|
19
19
|
end
|
20
20
|
|
21
21
|
##
|
@@ -28,10 +28,11 @@ class RDoc::Include < RDoc::CodeObject
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def == other # :nodoc:
|
31
|
-
self.class == other.
|
32
|
-
self.name == other.name
|
31
|
+
self.class === other and @name == other.name
|
33
32
|
end
|
34
33
|
|
34
|
+
alias eql? ==
|
35
|
+
|
35
36
|
##
|
36
37
|
# Full name based on #module
|
37
38
|
|
@@ -40,6 +41,10 @@ class RDoc::Include < RDoc::CodeObject
|
|
40
41
|
RDoc::ClassModule === m ? m.full_name : @name
|
41
42
|
end
|
42
43
|
|
44
|
+
def hash # :nodoc:
|
45
|
+
[@name, self.module].hash
|
46
|
+
end
|
47
|
+
|
43
48
|
def inspect # :nodoc:
|
44
49
|
"#<%s:0x%x %s.include %s>" % [
|
45
50
|
self.class,
|
@@ -57,6 +62,13 @@ class RDoc::Include < RDoc::CodeObject
|
|
57
62
|
# - if not found, look into the children of included modules,
|
58
63
|
# in reverse inclusion order;
|
59
64
|
# - if still not found, go up the hierarchy of names.
|
65
|
+
#
|
66
|
+
# This method has <code>O(n!)</code> behavior when the module calling
|
67
|
+
# include is referencing nonexistent modules. Avoid calling #module until
|
68
|
+
# after all the files are parsed. This behavior is due to ruby's constant
|
69
|
+
# lookup behavior.
|
70
|
+
#
|
71
|
+
# As of the beginning of October, 2011, no gem includes nonexistent modules.
|
60
72
|
|
61
73
|
def module
|
62
74
|
return @module if @module
|
@@ -79,12 +91,12 @@ class RDoc::Include < RDoc::CodeObject
|
|
79
91
|
end
|
80
92
|
|
81
93
|
# go up the hierarchy of names
|
82
|
-
|
83
|
-
while
|
84
|
-
full_name =
|
94
|
+
up = parent.parent
|
95
|
+
while up
|
96
|
+
full_name = up.child_name(@name)
|
85
97
|
@module = RDoc::TopLevel.modules_hash[full_name]
|
86
98
|
return @module if @module
|
87
|
-
|
99
|
+
up = up.parent
|
88
100
|
end
|
89
101
|
|
90
102
|
@name
|
data/lib/rdoc/markup/parser.rb
CHANGED
@@ -203,6 +203,11 @@ class RDoc::Markup::Parser
|
|
203
203
|
|
204
204
|
if type == :TEXT && column == margin then
|
205
205
|
paragraph << data
|
206
|
+
|
207
|
+
if peek_token[0] == :BREAK then
|
208
|
+
break
|
209
|
+
end
|
210
|
+
|
206
211
|
skip :NEWLINE
|
207
212
|
else
|
208
213
|
unget
|
@@ -268,7 +273,7 @@ class RDoc::Markup::Parser
|
|
268
273
|
peek_column ||= column + width
|
269
274
|
indent = peek_column - column - width
|
270
275
|
line << ' ' * indent
|
271
|
-
when :TEXT then
|
276
|
+
when :BREAK, :TEXT then
|
272
277
|
line << data
|
273
278
|
else # *LIST_TOKENS
|
274
279
|
list_marker = case type
|
@@ -322,7 +327,12 @@ class RDoc::Markup::Parser
|
|
322
327
|
until @tokens.empty? do
|
323
328
|
type, data, column, = get
|
324
329
|
|
325
|
-
|
330
|
+
case type
|
331
|
+
when :BREAK then
|
332
|
+
parent << RDoc::Markup::BlankLine.new
|
333
|
+
skip :NEWLINE, false
|
334
|
+
next
|
335
|
+
when :NEWLINE then
|
326
336
|
# trailing newlines are skipped below, so this is a blank line
|
327
337
|
parent << RDoc::Markup::BlankLine.new
|
328
338
|
skip :NEWLINE, false
|
@@ -458,8 +468,15 @@ class RDoc::Markup::Parser
|
|
458
468
|
when s.scan(/(.*?)::( +|\r?$)/) then
|
459
469
|
[:NOTE, s[1], *token_pos(pos)]
|
460
470
|
# anything else: :TEXT
|
461
|
-
else s.scan(
|
462
|
-
[:TEXT, s
|
471
|
+
else s.scan(/(.*?)( )?\r?$/)
|
472
|
+
token = [:TEXT, s[1], *token_pos(pos)]
|
473
|
+
|
474
|
+
if s[2] then
|
475
|
+
@tokens << token
|
476
|
+
[:BREAK, s[2], *token_pos(pos + s[1].length)]
|
477
|
+
else
|
478
|
+
token
|
479
|
+
end
|
463
480
|
end
|
464
481
|
end
|
465
482
|
|