rdoc 2.5 → 2.5.1

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.

Files changed (56) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +1 -1
  3. data/History.txt +41 -8
  4. data/Manifest.txt +1 -0
  5. data/lib/rdoc.rb +7 -7
  6. data/lib/rdoc/any_method.rb +24 -8
  7. data/lib/rdoc/attr.rb +13 -0
  8. data/lib/rdoc/class_module.rb +5 -3
  9. data/lib/rdoc/code_object.rb +0 -19
  10. data/lib/rdoc/generator/darkfish.rb +44 -42
  11. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +5 -5
  12. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +7 -7
  13. data/lib/rdoc/generator/template/darkfish/rdoc.css +2 -2
  14. data/lib/rdoc/markup.rb +7 -7
  15. data/lib/rdoc/markup/parser.rb +1 -1
  16. data/lib/rdoc/markup/preprocess.rb +1 -1
  17. data/lib/rdoc/markup/to_html.rb +1 -1
  18. data/lib/rdoc/options.rb +1 -1
  19. data/lib/rdoc/parser.rb +5 -5
  20. data/lib/rdoc/parser/c.rb +54 -17
  21. data/lib/rdoc/parser/perl.rb +8 -8
  22. data/lib/rdoc/parser/ruby.rb +24 -29
  23. data/lib/rdoc/rdoc.rb +30 -18
  24. data/lib/rdoc/ri/driver.rb +7 -15
  25. data/lib/rdoc/ri/paths.rb +1 -2
  26. data/lib/rdoc/ruby_lex.rb +12 -12
  27. data/lib/rdoc/ruby_token.rb +4 -4
  28. data/lib/rdoc/stats.rb +2 -2
  29. data/lib/rdoc/task.rb +9 -5
  30. data/test/test.txt +1 -0
  31. data/test/test_rdoc_any_method.rb +50 -8
  32. data/test/test_rdoc_attr.rb +8 -0
  33. data/test/test_rdoc_class_module.rb +1 -1
  34. data/test/test_rdoc_code_object.rb +2 -2
  35. data/test/test_rdoc_constant.rb +1 -1
  36. data/test/test_rdoc_context.rb +2 -2
  37. data/test/test_rdoc_include.rb +1 -1
  38. data/test/test_rdoc_markup_parser.rb +18 -0
  39. data/test/test_rdoc_markup_to_ansi.rb +1 -1
  40. data/test/test_rdoc_markup_to_html_crossref.rb +1 -1
  41. data/test/test_rdoc_markup_to_rdoc.rb +1 -1
  42. data/test/test_rdoc_normal_class.rb +1 -1
  43. data/test/test_rdoc_normal_module.rb +1 -1
  44. data/test/test_rdoc_parser.rb +2 -6
  45. data/test/test_rdoc_parser_c.rb +20 -0
  46. data/test/test_rdoc_parser_ruby.rb +1 -1
  47. data/test/test_rdoc_rdoc.rb +2 -2
  48. data/test/test_rdoc_require.rb +1 -1
  49. data/test/test_rdoc_ri_driver.rb +27 -6
  50. data/test/test_rdoc_ri_paths.rb +10 -6
  51. data/test/test_rdoc_task.rb +9 -9
  52. data/test/test_rdoc_top_level.rb +1 -1
  53. data/test/xref_data.rb +1 -1
  54. data/test/xref_test_case.rb +1 -1
  55. metadata +4 -2
  56. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -10,7 +10,7 @@ Autotest.add_hook :initialize do |at|
10
10
  f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
11
11
  f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
12
12
  f = f.map { |path| path =~ /^Test/ ? path : "Test#{path}" }
13
- f.join('::').sub('Rdoc', 'RDoc').sub('Ri', 'RI')
13
+ f.join('::').gsub('Rdoc', 'RDoc').gsub('Ri', 'RI')
14
14
  end
15
15
  end
16
16
 
@@ -1,3 +1,36 @@
1
+ === 2.5.1 / 2010-04-?
2
+
3
+ *NOTE*:
4
+
5
+ RDoc 2.5 did not save method parameters, so you should upgrade your rdoc-data
6
+ gem to a version > 2.5.1.
7
+
8
+ To have ri data for core and stdlib you'll need to:
9
+
10
+ gem install rdoc-data
11
+
12
+ then run:
13
+
14
+ rdoc-data --install
15
+
16
+ To have ri data for you gems you'll also need to run:
17
+
18
+ gem rdoc --all --overwrite
19
+
20
+ If you don't want to rebuild the rdoc for `gem server`, add --no-rdoc.
21
+
22
+ * 1 Minor Enhancement
23
+ * RDoc::Parser::C now supports the include directive for classes and
24
+ modules.
25
+ * N Bug Fixes
26
+ * RDoc::AnyMethod params now get saved in ri data.
27
+ * ri now displays method arguments correctly.
28
+ * RDoc::Markup::Parser allows no space between = and header text like rdoc
29
+ 2.4 and earlier.
30
+ * RDoc::Parser::C's "in" directive now looks in the current directory.
31
+ * RDoc::Task's rerdoc task no longer deletes the doc directory twice.
32
+ * rdoc --force-update now works correctly. Patch by Nobu Nokada
33
+
1
34
  === 2.5 / 2010-03-31
2
35
 
3
36
  *NOTE*:
@@ -30,14 +63,14 @@ to have ri data for core and stdlib like Array or Kernel or Date.
30
63
 
31
64
  * 17 Minor Enhancements
32
65
  * Source Parsing
33
- * RDoc now supports module aliasing via constant assignment.
34
- * RDoc now tracks superclasses correctly. Fixes File < IO for core docs.
35
- * RDoc now ignores methods inside methods.
36
- * RDoc now ignores Marshal and other binray files.
37
- * Removed "Skipping require of dynamic string" warning.
38
- * C parser now handles Document-method better. Bug #27329.
39
- * API enhancements for writing parsers like the Ruby parser, see
40
- RDoc::Parser::RubyTools
66
+ * RDoc now supports module aliasing via constant assignment.
67
+ * RDoc now tracks superclasses correctly. Fixes File < IO for core docs.
68
+ * RDoc now ignores methods inside methods.
69
+ * RDoc now ignores Marshal and other binray files.
70
+ * Removed "Skipping require of dynamic string" warning.
71
+ * C parser now handles Document-method better. Bug #27329.
72
+ * API enhancements for writing parsers like the Ruby parser, see
73
+ RDoc::Parser::RubyTools
41
74
  * ri
42
75
  * Uses pager over less and more for Debian. Ruby Bug #1171.
43
76
  * ri will use the RI_PAGER environment variable to find a pager.
@@ -105,6 +105,7 @@ test/binary.dat
105
105
  test/hidden.zip.txt
106
106
  test/test.ja.rdoc
107
107
  test/test.ja.txt
108
+ test/test.txt
108
109
  test/test_attribute_manager.rb
109
110
  test/test_rdoc_any_method.rb
110
111
  test/test_rdoc_attr.rb
@@ -88,7 +88,7 @@ $DEBUG_RDOC = nil
88
88
  #
89
89
  # =begin rdoc
90
90
  # Documentation to be processed by RDoc.
91
- #
91
+ #
92
92
  # ...
93
93
  # =end
94
94
  #
@@ -104,7 +104,7 @@ $DEBUG_RDOC = nil
104
104
  # # FIXME: fails if the birthday falls on February 29th
105
105
  # #++
106
106
  # # The DOB is returned as a Time object.
107
- #
107
+ #
108
108
  # def get_dob(person)
109
109
  # # ...
110
110
  # end
@@ -130,7 +130,7 @@ $DEBUG_RDOC = nil
130
130
  #
131
131
  # def fred # :yields: index, position
132
132
  # # ...
133
- #
133
+ #
134
134
  # yield line, address
135
135
  #
136
136
  # which will get documented as
@@ -256,12 +256,12 @@ $DEBUG_RDOC = nil
256
256
  # module also will be omitted. By default, though, modules and
257
257
  # classes within that class of module _will_ be documented. This is
258
258
  # turned off by adding the +all+ modifier.
259
- #
259
+ #
260
260
  # module MyModule # :nodoc:
261
261
  # class Input
262
262
  # end
263
263
  # end
264
- #
264
+ #
265
265
  # module OtherModule # :nodoc: all
266
266
  # class Output
267
267
  # end
@@ -295,7 +295,7 @@ $DEBUG_RDOC = nil
295
295
  # comment block may have one or more lines before the :section: directive.
296
296
  # These will be removed, and any identical lines at the end of the block are
297
297
  # also removed. This allows you to add visual cues such as:
298
- #
298
+ #
299
299
  # # ----------------------------------------
300
300
  # # :section: My Section
301
301
  # # This is the section that I wrote.
@@ -383,7 +383,7 @@ module RDoc
383
383
  ##
384
384
  # RDoc version you are using
385
385
 
386
- VERSION = '2.5'
386
+ VERSION = '2.5.1'
387
387
 
388
388
  ##
389
389
  # Name of the dotfile that contains the description of files to be processed
@@ -6,7 +6,7 @@ require 'rdoc/tokenstream'
6
6
 
7
7
  class RDoc::AnyMethod < RDoc::CodeObject
8
8
 
9
- MARSHAL_VERSION = 0 # :nodoc:
9
+ MARSHAL_VERSION = 1 # :nodoc:
10
10
 
11
11
  include Comparable
12
12
 
@@ -58,7 +58,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
58
58
  ##
59
59
  # Parameters for this method
60
60
 
61
- attr_overridable :params, :param, :parameters, :parameter
61
+ attr_accessor :params
62
62
 
63
63
  ##
64
64
  # Different ways to call this method
@@ -87,6 +87,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
87
87
  @call_seq = nil
88
88
  @dont_rename_initialize = false
89
89
  @is_alias_for = nil
90
+ @params = nil
90
91
  @parent_name = nil
91
92
  @singleton = nil
92
93
  @token_stream = nil
@@ -110,6 +111,19 @@ class RDoc::AnyMethod < RDoc::CodeObject
110
111
  @aliases << method
111
112
  end
112
113
 
114
+ ##
115
+ # The call_seq or the param_seq with method name, if there is no call_seq.
116
+ #
117
+ # Use this for displaying a method's argument lists.
118
+
119
+ def arglists
120
+ if @call_seq then
121
+ @call_seq
122
+ elsif @params then
123
+ "#{name}#{param_seq}"
124
+ end
125
+ end
126
+
113
127
  ##
114
128
  # HTML id-friendly method name
115
129
 
@@ -151,6 +165,7 @@ class RDoc::AnyMethod < RDoc::CodeObject
151
165
  @call_seq,
152
166
  @block_params,
153
167
  aliases,
168
+ @params,
154
169
  ]
155
170
  end
156
171
 
@@ -162,7 +177,6 @@ class RDoc::AnyMethod < RDoc::CodeObject
162
177
  # * #parent_name
163
178
 
164
179
  def marshal_load(array)
165
- @aliases = []
166
180
  @dont_rename_initialize = nil
167
181
  @is_alias_for = nil
168
182
  @token_stream = nil
@@ -174,6 +188,8 @@ class RDoc::AnyMethod < RDoc::CodeObject
174
188
  @comment = array[5]
175
189
  @call_seq = array[6]
176
190
  @block_params = array[7]
191
+ @aliases = array[8]
192
+ @params = array[9]
177
193
 
178
194
  @parent_name = if @full_name =~ /#/ then
179
195
  $`
@@ -201,16 +217,16 @@ class RDoc::AnyMethod < RDoc::CodeObject
201
217
  # Pretty parameter list for this method
202
218
 
203
219
  def param_seq
204
- params = params.gsub(/\s*\#.*/, '')
220
+ params = @params.gsub(/\s*\#.*/, '')
205
221
  params = params.tr("\n", " ").squeeze(" ")
206
- params = "(#{params})" unless p[0] == ?(
222
+ params = "(#{params})" unless params[0] == ?(
207
223
 
208
- if block = block_params then # yes, =
224
+ if @block_params then
209
225
  # If this method has explicit block parameters, remove any explicit
210
226
  # &block
211
- params.sub!(/,?\s*&\w+/)
227
+ params.sub!(/,?\s*&\w+/, '')
212
228
 
213
- block.gsub!(/\s*\#.*/, '')
229
+ block = @block_params.gsub(/\s*\#.*/, '')
214
230
  block = block.tr("\n", " ").squeeze(" ")
215
231
  if block[0] == ?(
216
232
  block.sub!(/^\(/, '').sub!(/\)/, '')
@@ -56,6 +56,12 @@ class RDoc::Attr < RDoc::CodeObject
56
56
  ##
57
57
  # Returns nil, for duck typing with RDoc::AnyMethod
58
58
 
59
+ def arglists
60
+ end
61
+
62
+ ##
63
+ # Returns nil, for duck typing with RDoc::AnyMethod
64
+
59
65
  def block_params
60
66
  end
61
67
 
@@ -132,6 +138,13 @@ class RDoc::Attr < RDoc::CodeObject
132
138
  @parent_name || super
133
139
  end
134
140
 
141
+ ##
142
+ # For duck typing with RDoc::AnyMethod, returns nil
143
+
144
+ def params
145
+ nil
146
+ end
147
+
135
148
  ##
136
149
  # URL path for this attribute
137
150
 
@@ -145,12 +145,14 @@ class RDoc::ClassModule < RDoc::Context
145
145
  # Merges +class_module+ into this ClassModule
146
146
 
147
147
  def merge class_module
148
- if class_module.comment then
148
+ comment = class_module.comment
149
+
150
+ if comment then
149
151
  document = parse @comment
150
152
 
151
- class_module.comment.parts.push(*document.parts)
153
+ comment.parts.concat document.parts
152
154
 
153
- @comment = class_module.comment
155
+ @comment = comment
154
156
  end
155
157
 
156
158
  class_module.each_attribute do |attr|
@@ -53,25 +53,6 @@ class RDoc::CodeObject
53
53
 
54
54
  attr_accessor :viewer
55
55
 
56
- ##
57
- # There's a wee trick we pull. Comment blocks can have directives that
58
- # override the stuff we extract during the parse. So, we have a special
59
- # class method, attr_overridable, that lets code objects list those
60
- # directives. When a comment is assigned, we then extract out any matching
61
- # directives and update our object
62
-
63
- def self.attr_overridable(name, *aliases)
64
- @overridables ||= {}
65
-
66
- attr_accessor name
67
-
68
- aliases.unshift name
69
-
70
- aliases.each do |directive_name|
71
- @overridables[directive_name.to_s] = name
72
- end
73
- end
74
-
75
56
  ##
76
57
  # Creates a new CodeObject that will document itself and its children
77
58
 
@@ -1,8 +1,10 @@
1
- #!ruby
1
+ # -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
2
2
  # vim: noet ts=2 sts=8 sw=2
3
3
 
4
- require 'rubygems'
5
- gem 'rdoc', '>= 2.4' unless ENV['RDOC_TEST'] or defined?($rdoc_rakefile)
4
+ unless File.exist? File.expand_path('../.svn', __FILE__) then
5
+ require 'rubygems'
6
+ gem 'rdoc', '>= 2.4'
7
+ end
6
8
 
7
9
  require 'pp'
8
10
  require 'pathname'
@@ -14,46 +16,46 @@ require 'rdoc/generator/markup'
14
16
  $DARKFISH_DRYRUN = false # TODO make me non-global
15
17
 
16
18
  #
17
- # Darkfish RDoc HTML Generator
18
- #
19
- # $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
19
+ # Darkfish RDoc HTML Generator
20
+ #
21
+ # $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
22
+ #
23
+ # == Author/s
24
+ # * Michael Granger (ged@FaerieMUD.org)
25
+ #
26
+ # == Contributors
27
+ # * Mahlon E. Smith (mahlon@martini.nu)
28
+ # * Eric Hodel (drbrain@segment7.net)
29
+ #
30
+ # == License
31
+ #
32
+ # Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
33
+ #
34
+ # Redistribution and use in source and binary forms, with or without
35
+ # modification, are permitted provided that the following conditions are met:
36
+ #
37
+ # * Redistributions of source code must retain the above copyright notice,
38
+ # this list of conditions and the following disclaimer.
39
+ #
40
+ # * Redistributions in binary form must reproduce the above copyright notice,
41
+ # this list of conditions and the following disclaimer in the documentation
42
+ # and/or other materials provided with the distribution.
43
+ #
44
+ # * Neither the name of the author/s, nor the names of the project's
45
+ # contributors may be used to endorse or promote products derived from this
46
+ # software without specific prior written permission.
47
+ #
48
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
52
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20
58
  #
21
- # == Author/s
22
- # * Michael Granger (ged@FaerieMUD.org)
23
- #
24
- # == Contributors
25
- # * Mahlon E. Smith (mahlon@martini.nu)
26
- # * Eric Hodel (drbrain@segment7.net)
27
- #
28
- # == License
29
- #
30
- # Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
31
- #
32
- # Redistribution and use in source and binary forms, with or without
33
- # modification, are permitted provided that the following conditions are met:
34
- #
35
- # * Redistributions of source code must retain the above copyright notice,
36
- # this list of conditions and the following disclaimer.
37
- #
38
- # * Redistributions in binary form must reproduce the above copyright notice,
39
- # this list of conditions and the following disclaimer in the documentation
40
- # and/or other materials provided with the distribution.
41
- #
42
- # * Neither the name of the author/s, nor the names of the project's
43
- # contributors may be used to endorse or promote products derived from this
44
- # software without specific prior written permission.
45
- #
46
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
49
- # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
50
- # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51
- # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
52
- # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
53
- # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54
- # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55
- # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
- #
57
59
  class RDoc::Generator::Darkfish
58
60
 
59
61
  RDoc::RDoc.add_generator( self )
@@ -1,10 +1,10 @@
1
1
  /**
2
- *
2
+ *
3
3
  * Darkfish Page Functions
4
4
  * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
- *
5
+ *
6
6
  * Author: Michael Granger <mgranger@laika.com>
7
- *
7
+ *
8
8
  */
9
9
 
10
10
  /* Provide console simulation for firebug-less environments */
@@ -58,7 +58,7 @@ function hookQuickSearch() {
58
58
  var toggle = $(this).parents('.section').find('h3 .search-toggle');
59
59
  // console.debug( "Toggle is: %o", toggle );
60
60
  var qsbox = $(this).parents('form').get( 0 );
61
-
61
+
62
62
  $(this).quicksearch( this, searchElems, {
63
63
  noSearchResultsIndicator: 'no-class-search-results',
64
64
  focusOnLoad: false
@@ -87,7 +87,7 @@ function highlightTarget( anchor ) {
87
87
  function highlightLocationTarget() {
88
88
  console.debug( "Location hash: %s", window.location.hash );
89
89
  if ( ! window.location.hash || window.location.hash.length == 0 ) return;
90
-
90
+
91
91
  var anchor = window.location.hash.substring(1);
92
92
  console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
93
93
 
@@ -1,10 +1,10 @@
1
1
  /**
2
- *
2
+ *
3
3
  * JQuery QuickSearch - Hook up a form field to hide non-matching elements.
4
4
  * $Id: quicksearch.js 53 2009-01-07 02:52:03Z deveiant $
5
- *
5
+ *
6
6
  * Author: Michael Granger <mgranger@laika.com>
7
- *
7
+ *
8
8
  */
9
9
  jQuery.fn.quicksearch = function( target, searchElems, options ) {
10
10
  // console.debug( "Quicksearch fn" );
@@ -17,7 +17,7 @@ jQuery.fn.quicksearch = function( target, searchElems, options ) {
17
17
  noSearchResultsIndicator: null
18
18
  };
19
19
  if ( options ) $.extend( settings, options );
20
-
20
+
21
21
  return jQuery(this).each( function() {
22
22
  // console.debug( "Creating a new quicksearch on %o for %o", this, searchElems );
23
23
  new jQuery.quicksearch( this, searchElems, settings );
@@ -56,7 +56,7 @@ jQuery.quicksearch = function( searchBox, searchElems, settings ) {
56
56
  case 8:
57
57
  return true;
58
58
  break;
59
-
59
+
60
60
  // Only allow valid search characters
61
61
  default:
62
62
  return validQSChar( e.charCode );
@@ -88,7 +88,7 @@ jQuery.quicksearch = function( searchBox, searchElems, settings ) {
88
88
  var searchText = searchBox.value;
89
89
  var pat = new RegExp( searchText, "im" );
90
90
  var shownCount = 0;
91
-
91
+
92
92
  if ( settings.noSearchResultsIndicator ) {
93
93
  $('#' + settings.noSearchResultsIndicator).hide();
94
94
  }
@@ -96,7 +96,7 @@ jQuery.quicksearch = function( searchBox, searchElems, settings ) {
96
96
  // All elements start out hidden
97
97
  $(searchElems).each( function(index) {
98
98
  var str = $(this).text();
99
-
99
+
100
100
  if ( pat.test(str) ) {
101
101
  shownCount += 1;
102
102
  $(this).fadeIn();