rdoc 2.3.0 → 2.4.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.

Files changed (81) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +14 -0
  3. data/History.txt +27 -0
  4. data/Manifest.txt +29 -9
  5. data/Rakefile +2 -0
  6. data/bin/rdoc +13 -2
  7. data/lib/rdoc.rb +11 -3
  8. data/lib/rdoc/alias.rb +54 -0
  9. data/lib/rdoc/anon_class.rb +10 -0
  10. data/lib/rdoc/any_method.rb +190 -0
  11. data/lib/rdoc/attr.rb +79 -0
  12. data/lib/rdoc/cache.rb +11 -2
  13. data/lib/rdoc/class_module.rb +87 -0
  14. data/lib/rdoc/code_object.rb +152 -0
  15. data/lib/rdoc/code_objects.rb +18 -1118
  16. data/lib/rdoc/constant.rb +36 -0
  17. data/lib/rdoc/context.rb +712 -0
  18. data/lib/rdoc/diagram.rb +8 -8
  19. data/lib/rdoc/generator.rb +3 -1140
  20. data/lib/rdoc/generator/darkfish.rb +107 -133
  21. data/lib/rdoc/generator/markup.rb +194 -0
  22. data/lib/rdoc/generator/ri.rb +4 -2
  23. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +92 -113
  24. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +33 -35
  25. data/lib/rdoc/generator/template/darkfish/index.rhtml +22 -15
  26. data/lib/rdoc/ghost_method.rb +8 -0
  27. data/lib/rdoc/include.rb +39 -0
  28. data/lib/rdoc/markup/attribute_manager.rb +46 -0
  29. data/lib/rdoc/markup/formatter.rb +11 -0
  30. data/lib/rdoc/markup/fragments.rb +42 -2
  31. data/lib/rdoc/markup/inline.rb +29 -4
  32. data/lib/rdoc/markup/lines.rb +4 -0
  33. data/lib/rdoc/markup/preprocess.rb +4 -0
  34. data/lib/rdoc/markup/to_flow.rb +27 -1
  35. data/lib/rdoc/markup/to_html.rb +33 -33
  36. data/lib/rdoc/markup/to_html_crossref.rb +4 -11
  37. data/lib/rdoc/markup/to_latex.rb +31 -31
  38. data/lib/rdoc/markup/to_test.rb +3 -0
  39. data/lib/rdoc/markup/to_texinfo.rb +18 -14
  40. data/lib/rdoc/meta_method.rb +8 -0
  41. data/lib/rdoc/normal_class.rb +18 -0
  42. data/lib/rdoc/normal_module.rb +34 -0
  43. data/lib/rdoc/options.rb +26 -159
  44. data/lib/rdoc/parser/c.rb +16 -8
  45. data/lib/rdoc/parser/ruby.rb +16 -10
  46. data/lib/rdoc/parser/simple.rb +1 -1
  47. data/lib/rdoc/rdoc.rb +50 -34
  48. data/lib/rdoc/require.rb +32 -0
  49. data/lib/rdoc/ri/descriptions.rb +1 -1
  50. data/lib/rdoc/ri/driver.rb +4 -4
  51. data/lib/rdoc/ri/formatter.rb +70 -32
  52. data/lib/rdoc/single_class.rb +8 -0
  53. data/lib/rdoc/top_level.rb +232 -0
  54. data/test/test_rdoc_any_method.rb +10 -0
  55. data/test/test_rdoc_code_object.rb +80 -0
  56. data/test/test_rdoc_constant.rb +15 -0
  57. data/test/test_rdoc_context.rb +250 -0
  58. data/test/test_rdoc_include.rb +17 -0
  59. data/test/test_rdoc_markup.rb +13 -2
  60. data/test/test_rdoc_markup_to_html.rb +22 -0
  61. data/test/test_rdoc_markup_to_html_crossref.rb +50 -115
  62. data/test/test_rdoc_normal_module.rb +26 -0
  63. data/test/test_rdoc_parser_c.rb +33 -0
  64. data/test/test_rdoc_parser_ruby.rb +54 -36
  65. data/test/test_rdoc_require.rb +25 -0
  66. data/test/test_rdoc_ri_default_display.rb +2 -1
  67. data/test/test_rdoc_ri_html_formatter.rb +141 -0
  68. data/test/test_rdoc_top_level.rb +85 -0
  69. data/test/xref_data.rb +46 -0
  70. data/test/xref_test_case.rb +48 -0
  71. metadata +42 -13
  72. metadata.gz.sig +0 -0
  73. data/lib/rdoc/generator/html.rb +0 -456
  74. data/lib/rdoc/generator/html/common.rb +0 -24
  75. data/lib/rdoc/generator/html/html.rb +0 -769
  76. data/lib/rdoc/generator/html/one_page_html.rb +0 -122
  77. data/lib/rdoc/generator/xml.rb +0 -124
  78. data/lib/rdoc/generator/xml/rdf.rb +0 -113
  79. data/lib/rdoc/generator/xml/xml.rb +0 -123
  80. data/lib/rdoc/parser/f95.rb +0 -1835
  81. data/lib/rdoc/template.rb +0 -68
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,14 @@
1
+ # vim: filetype=ruby
2
+
3
+ Autotest.add_hook :initialize do |at|
4
+ at.testlib = 'minitest/unit' if at.respond_to? :testlib=
5
+
6
+ def at.path_to_classname(s)
7
+ sep = File::SEPARATOR
8
+ f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
9
+ f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
10
+ f = f.map { |path| path =~ /^Test/ ? path : "Test#{path}" }
11
+ f.join('::').sub 'Rdoc', 'RDoc'
12
+ end
13
+ end
14
+
@@ -1,3 +1,30 @@
1
+ === 2.3.1 / ??
2
+
3
+ * N Minor Enhancements
4
+ * `ri -f html` is now XHTML-happy
5
+ * Clarified RDoc::Markup link syntax. Bug #23517 by Eric Armstrong.
6
+ * Number of threads to parse with is now configurable
7
+ * Darkfish can now use alternate templates from $LOAD_PATH via -T
8
+ * Removed F95 parser in favor of the rdoc-f95 gem
9
+ * Moved HTML and XML generators to unmaintained
10
+ * No gem will be provided as it's too difficult to make them work
11
+ * Removed options --one-file, --style=, --inline-source, --promiscuous,
12
+ --op-name
13
+ * Removed support for --accessor, use regular documentation or
14
+ the method directive instead. See RDoc::Parser::Ruby
15
+ * Removed --ri-system as it is unused by Ruby's makefiles
16
+ * Added method list to index.html
17
+
18
+ * N Bug Fixes
19
+ * nodoc'd classes no longer appear in the index. Bug #23751 by Clifford
20
+ Heath.
21
+ * Fix 1.9 compatibility issues. Bug #23815 by paddor.
22
+ * Darkfish now respects --charset
23
+ * RDoc no longer attempts to be lazy when building HTML. This is a
24
+ workaround. Bug #23893 by Stefano Crocco.
25
+ * RDoc doesn't crash with def (blah).foo() end
26
+ * RDoc doesn't crash with #define functions
27
+
1
28
  === 2.3.0 / 2009-01-28
2
29
 
3
30
  * 3 Major Enhancements
@@ -1,3 +1,4 @@
1
+ .autotest
1
2
  .document
2
3
  History.txt
3
4
  Manifest.txt
@@ -7,16 +8,21 @@ Rakefile
7
8
  bin/rdoc
8
9
  bin/ri
9
10
  lib/rdoc.rb
11
+ lib/rdoc/alias.rb
12
+ lib/rdoc/anon_class.rb
13
+ lib/rdoc/any_method.rb
14
+ lib/rdoc/attr.rb
10
15
  lib/rdoc/cache.rb
16
+ lib/rdoc/class_module.rb
17
+ lib/rdoc/code_object.rb
11
18
  lib/rdoc/code_objects.rb
19
+ lib/rdoc/constant.rb
20
+ lib/rdoc/context.rb
12
21
  lib/rdoc/diagram.rb
13
22
  lib/rdoc/dot.rb
14
23
  lib/rdoc/generator.rb
15
24
  lib/rdoc/generator/darkfish.rb
16
- lib/rdoc/generator/html.rb
17
- lib/rdoc/generator/html/common.rb
18
- lib/rdoc/generator/html/html.rb
19
- lib/rdoc/generator/html/one_page_html.rb
25
+ lib/rdoc/generator/markup.rb
20
26
  lib/rdoc/generator/ri.rb
21
27
  lib/rdoc/generator/template/darkfish/.document
22
28
  lib/rdoc/generator/template/darkfish/classpage.rhtml
@@ -47,9 +53,8 @@ lib/rdoc/generator/template/darkfish/js/jquery.js
47
53
  lib/rdoc/generator/template/darkfish/js/quicksearch.js
48
54
  lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
49
55
  lib/rdoc/generator/template/darkfish/rdoc.css
50
- lib/rdoc/generator/xml.rb
51
- lib/rdoc/generator/xml/rdf.rb
52
- lib/rdoc/generator/xml/xml.rb
56
+ lib/rdoc/ghost_method.rb
57
+ lib/rdoc/include.rb
53
58
  lib/rdoc/known_classes.rb
54
59
  lib/rdoc/markup.rb
55
60
  lib/rdoc/markup/attribute_manager.rb
@@ -64,14 +69,17 @@ lib/rdoc/markup/to_html_crossref.rb
64
69
  lib/rdoc/markup/to_latex.rb
65
70
  lib/rdoc/markup/to_test.rb
66
71
  lib/rdoc/markup/to_texinfo.rb
72
+ lib/rdoc/meta_method.rb
73
+ lib/rdoc/normal_class.rb
74
+ lib/rdoc/normal_module.rb
67
75
  lib/rdoc/options.rb
68
76
  lib/rdoc/parser.rb
69
77
  lib/rdoc/parser/c.rb
70
- lib/rdoc/parser/f95.rb
71
78
  lib/rdoc/parser/perl.rb
72
79
  lib/rdoc/parser/ruby.rb
73
80
  lib/rdoc/parser/simple.rb
74
81
  lib/rdoc/rdoc.rb
82
+ lib/rdoc/require.rb
75
83
  lib/rdoc/ri.rb
76
84
  lib/rdoc/ri/cache.rb
77
85
  lib/rdoc/ri/descriptions.rb
@@ -82,23 +90,35 @@ lib/rdoc/ri/paths.rb
82
90
  lib/rdoc/ri/reader.rb
83
91
  lib/rdoc/ri/util.rb
84
92
  lib/rdoc/ri/writer.rb
93
+ lib/rdoc/single_class.rb
85
94
  lib/rdoc/stats.rb
86
- lib/rdoc/template.rb
87
95
  lib/rdoc/tokenstream.rb
96
+ lib/rdoc/top_level.rb
88
97
  test/binary.dat
89
98
  test/test.ja.rdoc
90
99
  test/test.ja.txt
91
100
  test/test_attribute_manager.rb
101
+ test/test_rdoc_any_method.rb
102
+ test/test_rdoc_code_object.rb
103
+ test/test_rdoc_constant.rb
104
+ test/test_rdoc_context.rb
105
+ test/test_rdoc_include.rb
92
106
  test/test_rdoc_markup.rb
93
107
  test/test_rdoc_markup_attribute_manager.rb
94
108
  test/test_rdoc_markup_to_html.rb
95
109
  test/test_rdoc_markup_to_html_crossref.rb
110
+ test/test_rdoc_normal_module.rb
96
111
  test/test_rdoc_parser.rb
97
112
  test/test_rdoc_parser_c.rb
98
113
  test/test_rdoc_parser_perl.rb
99
114
  test/test_rdoc_parser_ruby.rb
115
+ test/test_rdoc_require.rb
100
116
  test/test_rdoc_ri_attribute_formatter.rb
101
117
  test/test_rdoc_ri_default_display.rb
102
118
  test/test_rdoc_ri_driver.rb
103
119
  test/test_rdoc_ri_formatter.rb
120
+ test/test_rdoc_ri_html_formatter.rb
104
121
  test/test_rdoc_ri_overstrike_formatter.rb
122
+ test/test_rdoc_top_level.rb
123
+ test/xref_data.rb
124
+ test/xref_test_case.rb
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'hoe'
2
2
 
3
+ $rdoc_rakefile = true
4
+
3
5
  $:.unshift 'lib'
4
6
  require 'rdoc'
5
7
 
data/bin/rdoc CHANGED
@@ -16,7 +16,18 @@ begin
16
16
  rescue Interrupt
17
17
  $stderr.puts
18
18
  $stderr.puts "Interrupted"
19
- rescue RDoc::Error => e
20
- $stderr.puts e.message
19
+ exit 1
20
+ rescue Exception => e
21
+ if $DEBUG_RDOC then
22
+ $stderr.puts e.message
23
+ $stderr.puts "#{e.backtrace.join "\n\t"}"
24
+ $stderr.puts
25
+ else
26
+ $stderr.puts "uh-oh! RDoc had a problem:"
27
+ $stderr.puts e.message
28
+ $stderr.puts
29
+ $stderr.puts "run with --debug for full backtrace"
30
+ end
21
31
  exit 1
22
32
  end
33
+
@@ -223,7 +223,7 @@ $DEBUG_RDOC = nil
223
223
  #
224
224
  # [\<b>text...</b>] displays word in a *bold* font
225
225
  # [\<em>text...</em>] displays word in an _emphasized_ font
226
- # [\\<i>text...</i>] displays word in an <i>italicized</i> font
226
+ # [\<i>text...</i>] displays word in an <i>italicized</i> font
227
227
  # [\<tt>text...</tt>] displays word in a +code+ font
228
228
  #
229
229
  # Unlike conventional Wiki markup, general markup can cross line
@@ -233,7 +233,7 @@ $DEBUG_RDOC = nil
233
233
  #
234
234
  # * Hyperlinks to the web starting http:, mailto:, ftp:, or www. are
235
235
  # recognized. An HTTP url that references an external image file is
236
- # converted into an inline <IMG..>. Hyperlinks starting 'link:' are
236
+ # converted into an inline \<IMG..>. Hyperlinks starting 'link:' are
237
237
  # assumed to refer to local files whose path is relative to the --op
238
238
  # directory.
239
239
  #
@@ -242,6 +242,14 @@ $DEBUG_RDOC = nil
242
242
  # used as the target. If +label+ contains multiple words,
243
243
  # put it in braces: <em>{multi word label}[</em>url<em>]</em>.
244
244
  #
245
+ # Example hyperlinks:
246
+ #
247
+ # link:RDoc.html
248
+ # http://rdoc.rubyforge.org
249
+ # mailto:user@example.com
250
+ # {RDoc Documentation}[http://rdoc.rubyforge.org]
251
+ # {RDoc Markup}[link:RDoc/Markup.html]
252
+ #
245
253
  # == Directives
246
254
  #
247
255
  # [+:nodoc:+ / +:nodoc:+ all]
@@ -372,7 +380,7 @@ module RDoc
372
380
  ##
373
381
  # RDoc version you are using
374
382
 
375
- VERSION = "2.3.0"
383
+ VERSION = "2.4.0"
376
384
 
377
385
  ##
378
386
  # Name of the dotfile that contains the description of files to be processed
@@ -0,0 +1,54 @@
1
+ require 'rdoc/code_object'
2
+
3
+ ##
4
+ # Represent an alias, which is an old_name/new_name pair associated with a
5
+ # particular context
6
+
7
+ class RDoc::Alias < RDoc::CodeObject
8
+
9
+ ##
10
+ # Allow comments to be overridden
11
+
12
+ attr_writer :comment
13
+
14
+ ##
15
+ # Aliased name
16
+
17
+ attr_accessor :new_name
18
+
19
+ ##
20
+ # Aliasee's name
21
+
22
+ attr_accessor :old_name
23
+
24
+ ##
25
+ # Source file token stream
26
+
27
+ attr_accessor :text
28
+
29
+ ##
30
+ # Creates a new Alias with a token stream of +text+ that aliases +old_name+
31
+ # to +new_name+ and has +comment+
32
+
33
+ def initialize(text, old_name, new_name, comment)
34
+ super()
35
+ @text = text
36
+ @old_name = old_name
37
+ @new_name = new_name
38
+ self.comment = comment
39
+ end
40
+
41
+ def inspect # :nodoc:
42
+ "#<%s:0x%x %s.alias_method %s, %s>" % [
43
+ self.class, object_id,
44
+ parent.name, @old_name, @new_name,
45
+ ]
46
+ end
47
+
48
+ def to_s # :nodoc:
49
+ "alias: #{self.old_name} -> #{self.new_name}\n#{self.comment}"
50
+ end
51
+
52
+ end
53
+
54
+
@@ -0,0 +1,10 @@
1
+ require 'rdoc/class_module'
2
+
3
+ ##
4
+ # An anonymous class like:
5
+ #
6
+ # c = Class.new do end
7
+
8
+ class RDoc::AnonClass < RDoc::ClassModule
9
+ end
10
+
@@ -0,0 +1,190 @@
1
+ require 'rdoc/code_object'
2
+ require 'rdoc/tokenstream'
3
+
4
+ ##
5
+ # AnyMethod is the base class for objects representing methods
6
+
7
+ class RDoc::AnyMethod < RDoc::CodeObject
8
+
9
+ ##
10
+ # Method name
11
+
12
+ attr_writer :name
13
+
14
+ ##
15
+ # public, protected, private
16
+
17
+ attr_accessor :visibility
18
+
19
+ ##
20
+ # Parameters yielded by the called block
21
+
22
+ attr_accessor :block_params
23
+
24
+ ##
25
+ # Don't rename \#initialize to \::new
26
+
27
+ attr_accessor :dont_rename_initialize
28
+
29
+ ##
30
+ # Is this a singleton method?
31
+
32
+ attr_accessor :singleton
33
+
34
+ ##
35
+ # Source file token stream
36
+
37
+ attr_reader :text
38
+
39
+ ##
40
+ # Array of other names for this method
41
+
42
+ attr_reader :aliases
43
+
44
+ ##
45
+ # Fragment reference for this method
46
+
47
+ attr_reader :aref
48
+
49
+ ##
50
+ # The method we're aliasing
51
+
52
+ attr_accessor :is_alias_for
53
+
54
+ ##
55
+ # Parameters for this method
56
+
57
+ attr_overridable :params, :param, :parameters, :parameter
58
+
59
+ ##
60
+ # Different ways to call this method
61
+
62
+ attr_accessor :call_seq
63
+
64
+ include RDoc::TokenStream
65
+
66
+ ##
67
+ # Resets method fragment reference counter
68
+
69
+ def self.reset
70
+ @@aref = 'M000000'
71
+ end
72
+
73
+ reset
74
+
75
+ def initialize(text, name)
76
+ super()
77
+ @text = text
78
+ @name = name
79
+ @token_stream = nil
80
+ @visibility = :public
81
+ @dont_rename_initialize = false
82
+ @block_params = nil
83
+ @aliases = []
84
+ @is_alias_for = nil
85
+ @call_seq = nil
86
+
87
+ @aref = @@aref
88
+ @@aref = @@aref.succ
89
+ end
90
+
91
+ ##
92
+ # Order by #singleton then #name
93
+
94
+ def <=>(other)
95
+ [@singleton ? 0 : 1, @name] <=> [other.singleton ? 0 : 1, other.name]
96
+ end
97
+
98
+ ##
99
+ # Adds +method+ as an alias for this method
100
+
101
+ def add_alias(method)
102
+ @aliases << method
103
+ end
104
+
105
+ ##
106
+ # HTML id-friendly method name
107
+
108
+ def html_name
109
+ @name.gsub(/[^a-z]+/, '-')
110
+ end
111
+
112
+ def inspect # :nodoc:
113
+ alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
114
+ "#<%s:0x%x %s%s%s (%s)%s>" % [
115
+ self.class, object_id,
116
+ parent_name,
117
+ singleton ? '::' : '#',
118
+ name,
119
+ visibility,
120
+ alias_for,
121
+ ]
122
+ end
123
+
124
+ ##
125
+ # Full method name including namespace
126
+
127
+ def full_name
128
+ "#{@parent.full_name}#{pretty_name}"
129
+ end
130
+
131
+ ##
132
+ # Method name
133
+
134
+ def name
135
+ return @name if @name
136
+
137
+ @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq
138
+ end
139
+
140
+ ##
141
+ # Pretty parameter list for this method
142
+
143
+ def param_seq
144
+ params = params.gsub(/\s*\#.*/, '')
145
+ params = params.tr("\n", " ").squeeze(" ")
146
+ params = "(#{params})" unless p[0] == ?(
147
+
148
+ if block = block_params then # yes, =
149
+ # If this method has explicit block parameters, remove any explicit
150
+ # &block
151
+ params.sub!(/,?\s*&\w+/)
152
+
153
+ block.gsub!(/\s*\#.*/, '')
154
+ block = block.tr("\n", " ").squeeze(" ")
155
+ if block[0] == ?(
156
+ block.sub!(/^\(/, '').sub!(/\)/, '')
157
+ end
158
+ params << " { |#{block}| ... }"
159
+ end
160
+
161
+ params
162
+ end
163
+
164
+ ##
165
+ # Path to this method
166
+
167
+ def path
168
+ "#{@parent.path}##{@aref}"
169
+ end
170
+
171
+ ##
172
+ # Method name with class/instance indicator
173
+
174
+ def pretty_name
175
+ "#{singleton ? '::' : '#'}#{@name}"
176
+ end
177
+
178
+ def to_s # :nodoc:
179
+ "#{self.class.name}: #{full_name} (#{@text})\n#{@comment}"
180
+ end
181
+
182
+ ##
183
+ # Type of method (class or instance)
184
+
185
+ def type
186
+ singleton ? 'class' : 'instance'
187
+ end
188
+
189
+ end
190
+