rdoc 3.5.1 → 3.5.2

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 CHANGED
Binary file
@@ -1,4 +1,21 @@
1
- === 3.5.1
1
+ === 3.5.2 / 2010-02-04
2
+
3
+ * Deprecations
4
+ * RDoc::Context::Section#sequence is now deprecated. Use
5
+ RDoc::Context::Section#aref instead.
6
+
7
+ * Bug fixes
8
+ * Fixed syntax highlighting CSS class generation. Reported by Daniel
9
+ Bretoi.
10
+ * Fixed ri for methods with aliases. Pull Request #15 by Sven Riedel.
11
+ * Added windows-specific test for test_check_files.
12
+ * Darkfish now supports sections. Template and generator author see
13
+ RDoc::Context#each_section to add section support. RubyForge Bug #26883
14
+ by Jeff Hodges.
15
+ * Fixed post-install message for Ruby 1.9.2 users.
16
+ * Set required ruby version to >= 1.8.7.
17
+
18
+ === 3.5.1 / 2010-01-30
2
19
 
3
20
  * Bug fixes
4
21
  * Fixed some typos. Pull request #13 by R.T. Lechow.
@@ -124,6 +124,7 @@ test/test_rdoc_class_module.rb
124
124
  test/test_rdoc_code_object.rb
125
125
  test/test_rdoc_constant.rb
126
126
  test/test_rdoc_context.rb
127
+ test/test_rdoc_context_section.rb
127
128
  test/test_rdoc_encoding.rb
128
129
  test/test_rdoc_generator_darkfish.rb
129
130
  test/test_rdoc_generator_ri.rb
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  = \RDoc - Ruby Documentation System
2
2
 
3
3
  * {RDoc Project Page}[https://github.com/rdoc/rdoc/]
4
- * {RDoc Documentation}[http://rdoc.rubyforge.org/]
4
+ * {RDoc Documentation}[http://docs.seattlerb.org/rdoc]
5
5
  * {RDoc Bug Tracker}[https://github.com/rdoc/rdoc/issues]
6
6
 
7
7
  == DESCRIPTION:
@@ -27,12 +27,12 @@ To generate documentation programmatically:
27
27
  == BUGS:
28
28
 
29
29
  If you find a bug, please report it at the RDoc project's
30
- tracker[http://rubyforge.org/tracker/?group_id=627] on RubyForge
30
+ {issues tracker}[https://github.com/rdoc/rdoc/issues] on github
31
31
 
32
32
  == LICENSE:
33
33
 
34
34
  RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers.
35
- Portions (c) 2007-2010 Eric Hodel. Portions copyright others, see individual
35
+ Portions (c) 2007-2011 Eric Hodel. Portions copyright others, see individual
36
36
  files for details.
37
37
 
38
38
  It is free software, and may be redistributed under the terms specified in
data/Rakefile CHANGED
@@ -16,11 +16,13 @@ Hoe.spec 'rdoc' do
16
16
  developer 'Tony Strauss', 'tony.strauss@designingpatterns.com'
17
17
 
18
18
  self.rsync_args = '-avz'
19
+ rdoc_locations << 'docs.seattlerb.org:/data/www/docs.seattlerb.org/rdoc/'
19
20
  rdoc_locations << 'drbrain@rubyforge.org:/var/www/gforge-projects/rdoc/'
20
21
 
21
22
  self.testlib = :minitest
22
23
  self.isolate_dir = 'tmp/isolate'
23
24
 
25
+ require_ruby_version '>= 1.8.7'
24
26
  extra_dev_deps << ['minitest', '~> 2']
25
27
  extra_dev_deps << ['isolate', '~> 3']
26
28
  extra_dev_deps << ['ZenTest', '~> 4'] # for autotest/isolate
@@ -30,10 +32,12 @@ Hoe.spec 'rdoc' do
30
32
  spec_extras['homepage'] = 'http://rdoc.rubyforge.org'
31
33
 
32
34
  spec_extras[:post_install_message] = <<-EOF
33
- RDoc 2.5 did not save method parameters, so you should upgrade your rdoc-data
34
- gem to a version >= 2.5.3.
35
+ NOTE: If you are running Ruby 1.9.2 you can ignore this message.
35
36
 
36
- To have ri data for core and stdlib you'll need to:
37
+ RDoc 2.5+ has a new ri data format for Ruby 1.8.7 and 1.9.1. (1.9.2 contains
38
+ RDoc 2.5 so there is nothing to do!)
39
+
40
+ To install new ri data for core and stdlib you'll need to:
37
41
 
38
42
  gem install rdoc-data
39
43
 
@@ -46,6 +50,9 @@ To have ri data for you gems you'll also need to run:
46
50
  gem rdoc --all --overwrite
47
51
 
48
52
  If you don't want to rebuild the rdoc for `gem server`, add --no-rdoc.
53
+
54
+ NOTE: RDoc 2.5 did not save method parameters, so you should upgrade your
55
+ rdoc-data gem to a version >= 2.5.3 if you installed an older version.
49
56
  EOF
50
57
  end
51
58
 
@@ -95,7 +95,7 @@ module RDoc
95
95
  ##
96
96
  # RDoc version you are using
97
97
 
98
- VERSION = '3.5.1'
98
+ VERSION = '3.5.2'
99
99
 
100
100
  ##
101
101
  # Method visibilities
@@ -44,7 +44,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
44
44
  ##
45
45
  # Adds +an_alias+ as an alias for this method in +context+.
46
46
 
47
- def add_alias(an_alias, context)
47
+ def add_alias(an_alias, context = nil )
48
48
  method = self.class.new an_alias.text, an_alias.new_name
49
49
 
50
50
  method.record_location an_alias.file
@@ -54,7 +54,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
54
54
  method.comment = an_alias.comment
55
55
  method.is_alias_for = self
56
56
  @aliases << method
57
- context.add_method method
57
+ context.add_method( method ) if context
58
58
  method
59
59
  end
60
60
 
@@ -59,11 +59,6 @@ class RDoc::Context < RDoc::CodeObject
59
59
 
60
60
  attr_reader :requires
61
61
 
62
- ##
63
- # Sections in this context
64
-
65
- attr_reader :sections
66
-
67
62
  ##
68
63
  # Hash <tt>old_name => [aliases]</tt>, for aliases
69
64
  # that haven't (yet) been resolved to a method/attribute.
@@ -93,13 +88,18 @@ class RDoc::Context < RDoc::CodeObject
93
88
  attr_reader :constants_hash
94
89
 
95
90
  ##
96
- # A per-comment section of documentation like:
91
+ # A section of documentation like:
97
92
  #
98
93
  # # :section: The title
99
94
  # # The body
95
+ #
96
+ # Sections can be referenced multiple times and will be collapsed into a
97
+ # single section.
100
98
 
101
99
  class Section
102
100
 
101
+ include RDoc::Text
102
+
103
103
  ##
104
104
  # Section comment
105
105
 
@@ -110,11 +110,6 @@ class RDoc::Context < RDoc::CodeObject
110
110
 
111
111
  attr_reader :parent
112
112
 
113
- ##
114
- # Section sequence number (for linking)
115
-
116
- attr_reader :sequence
117
-
118
113
  ##
119
114
  # Section title
120
115
 
@@ -125,56 +120,84 @@ class RDoc::Context < RDoc::CodeObject
125
120
  ##
126
121
  # Creates a new section with +title+ and +comment+
127
122
 
128
- def initialize(parent, title, comment)
123
+ def initialize parent, title, comment
129
124
  @parent = parent
130
- @title = title
125
+ @title = title ? title.strip : title
131
126
 
132
127
  @@sequence.succ!
133
128
  @sequence = @@sequence.dup
134
129
 
135
- set_comment comment
130
+ @comment = extract_comment comment
136
131
  end
137
132
 
138
133
  ##
139
- # Sections are equal when they have the same #sequence
134
+ # Sections are equal when they have the same #title
140
135
 
141
- def ==(other)
142
- self.class === other and @sequence == other.sequence
136
+ def == other
137
+ self.class === other and @title == other.title
143
138
  end
144
139
 
145
- def inspect # :nodoc:
146
- "#<%s:0x%x %s %p>" % [
147
- self.class, object_id,
148
- @sequence, title
149
- ]
140
+ ##
141
+ # Anchor reference for linking to this section
142
+
143
+ def aref
144
+ title = @title || '[untitled]'
145
+
146
+ CGI.escape(title).gsub('%', '-').sub(/^-/, '')
147
+ end
148
+
149
+ ##
150
+ # Appends +comment+ to the current comment separated by a rule.
151
+
152
+ def comment= comment
153
+ comment = extract_comment comment
154
+
155
+ return if comment.empty?
156
+
157
+ if @comment then
158
+ @comment += "\n# ---\n#{comment}"
159
+ else
160
+ @comment = comment
161
+ end
150
162
  end
151
163
 
152
164
  ##
153
- # Set the comment for this section from the original comment block. If
154
- # the first line contains :section:, strip it and use the rest.
165
+ # Extracts the comment for this section from the original comment block.
166
+ # If the first line contains :section:, strip it and use the rest.
155
167
  # Otherwise remove lines up to the line containing :section:, and look
156
168
  # for those lines again at the end and remove them. This lets us write
157
169
  #
158
170
  # # :section: The title
159
171
  # # The body
160
172
 
161
- def set_comment(comment)
162
- return unless comment
163
-
173
+ def extract_comment comment
164
174
  if comment =~ /^#[ \t]*:section:.*\n/ then
165
175
  start = $`
166
176
  rest = $'
167
177
 
168
- if start.empty?
169
- @comment = rest
178
+ if start.empty? then
179
+ rest
170
180
  else
171
- @comment = rest.sub(/#{start.chomp}\Z/, '')
181
+ rest.sub(/#{start.chomp}\Z/, '')
172
182
  end
173
183
  else
174
- @comment = comment
184
+ comment
175
185
  end
186
+ end
176
187
 
177
- @comment = nil if @comment.empty?
188
+ def inspect # :nodoc:
189
+ "#<%s:0x%x %s %p>" % [
190
+ self.class, object_id,
191
+ @sequence, title
192
+ ]
193
+ end
194
+
195
+ ##
196
+ # Section sequence number (deprecated)
197
+
198
+ def sequence
199
+ warn "RDoc::Context::Section#sequence is deprecated, use #aref"
200
+ @sequence
178
201
  end
179
202
 
180
203
  end
@@ -192,7 +215,7 @@ class RDoc::Context < RDoc::CodeObject
192
215
  @visibility = :public
193
216
 
194
217
  @current_section = Section.new self, nil, nil
195
- @sections = [@current_section]
218
+ @sections = { nil => @current_section }
196
219
 
197
220
  @classes = {}
198
221
  @modules = {}
@@ -669,6 +692,28 @@ class RDoc::Context < RDoc::CodeObject
669
692
  @method_list.sort.each {|m| yield m}
670
693
  end
671
694
 
695
+ ##
696
+ # Iterator for each section's contents sorted by title. The +section+, the
697
+ # section's +constants+ and the sections +attributes+ are yielded. The
698
+ # +constants+ and +attributes+ collections are sorted.
699
+ #
700
+ # To retrieve methods in a section use #methods_by_type with the optional
701
+ # +section+ parameter.
702
+ #
703
+ # NOTE: Do not edit collections yielded by this method
704
+
705
+ def each_section # :yields: section, constants, attributes
706
+ constants = @constants.group_by do |constant| constant.section end
707
+ constants.default = []
708
+
709
+ attributes = @attributes.group_by do |attribute| attribute.section end
710
+ attributes.default = []
711
+
712
+ @sections.sort_by { |title, _| title.to_s }.each do |_, section|
713
+ yield section, constants[section].sort, attributes[section].sort
714
+ end
715
+ end
716
+
672
717
  ##
673
718
  # Finds an attribute +name+ with singleton value +singleton+.
674
719
 
@@ -876,10 +921,13 @@ class RDoc::Context < RDoc::CodeObject
876
921
  end
877
922
 
878
923
  ##
879
- # Breaks method_list into a nested hash by type (class or instance) and
880
- # visibility (public, protected, private)
924
+ # Breaks method_list into a nested hash by type (<tt>'class'</tt> or
925
+ # <tt>'instance'</tt>) and visibility (+:public+, +:protected+, +:private+).
926
+ #
927
+ # If +section+ is provided only methods in that RDoc::Context::Section will
928
+ # be returned.
881
929
 
882
- def methods_by_type
930
+ def methods_by_type section = nil
883
931
  methods = {}
884
932
 
885
933
  TYPES.each do |type|
@@ -892,6 +940,7 @@ class RDoc::Context < RDoc::CodeObject
892
940
  end
893
941
 
894
942
  each_method do |method|
943
+ next if section and not method.section == section
895
944
  methods[method.type][method.visibility] << method
896
945
  end
897
946
 
@@ -996,12 +1045,30 @@ class RDoc::Context < RDoc::CodeObject
996
1045
  @unmatched_alias_lists.delete key
997
1046
  end
998
1047
 
1048
+ ##
1049
+ # Sections in this context
1050
+
1051
+ def sections
1052
+ @sections.values
1053
+ end
1054
+
1055
+ def sections_hash # :nodoc:
1056
+ @sections
1057
+ end
1058
+
999
1059
  ##
1000
1060
  # Creates a new section with +title+ and +comment+
1001
1061
 
1002
1062
  def set_current_section(title, comment)
1003
- @current_section = Section.new self, title, comment
1004
- @sections << @current_section
1063
+ if @sections.key? title then
1064
+ @current_section = @sections[title]
1065
+ @current_section.comment = comment
1066
+ else
1067
+ @current_section = Section.new self, title, comment
1068
+ @sections[title] = @current_section
1069
+ end
1070
+
1071
+ @current_section
1005
1072
  end
1006
1073
 
1007
1074
  ##
@@ -62,22 +62,6 @@ end
62
62
 
63
63
  class RDoc::AnyMethod
64
64
 
65
- ##
66
- # Maps RDoc::RubyToken classes to CSS class names
67
-
68
- STYLE_MAP = {
69
- RDoc::RubyToken::TkCONSTANT => 'ruby-constant',
70
- RDoc::RubyToken::TkKW => 'ruby-keyword',
71
- RDoc::RubyToken::TkIVAR => 'ruby-ivar',
72
- RDoc::RubyToken::TkOp => 'ruby-operator',
73
- RDoc::RubyToken::TkId => 'ruby-identifier',
74
- RDoc::RubyToken::TkNode => 'ruby-node',
75
- RDoc::RubyToken::TkCOMMENT => 'ruby-comment',
76
- RDoc::RubyToken::TkREGEXP => 'ruby-regexp',
77
- RDoc::RubyToken::TkSTRING => 'ruby-string',
78
- RDoc::RubyToken::TkVal => 'ruby-value',
79
- }
80
-
81
65
  include RDoc::Generator::Markup
82
66
 
83
67
  @add_line_numbers = false
@@ -130,7 +114,18 @@ class RDoc::AnyMethod
130
114
  @token_stream.each do |t|
131
115
  next unless t
132
116
 
133
- style = STYLE_MAP[t.class]
117
+ style = case t
118
+ when RDoc::RubyToken::TkCONSTANT then 'ruby-constant'
119
+ when RDoc::RubyToken::TkKW then 'ruby-keyword'
120
+ when RDoc::RubyToken::TkIVAR then 'ruby-ivar'
121
+ when RDoc::RubyToken::TkOp then 'ruby-operator'
122
+ when RDoc::RubyToken::TkId then 'ruby-identifier'
123
+ when RDoc::RubyToken::TkNode then 'ruby-node'
124
+ when RDoc::RubyToken::TkCOMMENT then 'ruby-comment'
125
+ when RDoc::RubyToken::TkREGEXP then 'ruby-regexp'
126
+ when RDoc::RubyToken::TkSTRING then 'ruby-string'
127
+ when RDoc::RubyToken::TkVal then 'ruby-value'
128
+ end
134
129
 
135
130
  text = CGI.escapeHTML t.text
136
131
 
@@ -9,17 +9,13 @@
9
9
 
10
10
  <link rel="stylesheet" href="<%= rel_prefix %>/rdoc.css" type="text/css" media="screen" />
11
11
 
12
- <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
12
+ <script src="<%= rel_prefix %>/js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="<%= rel_prefix %>/js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="<%= rel_prefix %>/js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="<%= rel_prefix %>/js/darkfish.js" type="text/javascript" charset="utf-8"></script>
20
16
 
21
17
  </head>
22
- <body class="<%= klass.type %>">
18
+ <body id="top" class="<%= klass.type %>">
23
19
 
24
20
  <div id="metadata">
25
21
  <div id="home-metadata">
@@ -45,7 +41,7 @@
45
41
  </div>
46
42
  </div>
47
43
 
48
- <% if !svninfo.empty? %>
44
+ <% if !svninfo.empty? then %>
49
45
  <div id="file-svninfo-section" class="section">
50
46
  <h3 class="section-header">Subversion Info</h3>
51
47
  <div class="section-body">
@@ -66,9 +62,8 @@
66
62
  </div>
67
63
 
68
64
  <div id="class-metadata">
69
-
65
+ <% if klass.type == 'class' then %>
70
66
  <!-- Parent Class -->
71
- <% if klass.type == 'class' %>
72
67
  <div id="parent-class-section" class="section">
73
68
  <h3 class="section-header">Parent</h3>
74
69
  <% if klass.superclass and not String === klass.superclass then %>
@@ -79,8 +74,20 @@
79
74
  </div>
80
75
  <% end %>
81
76
 
77
+ <% unless klass.sections.length == 1 then %>
78
+ <!-- Sections -->
79
+ <div id="sections-section" class="section">
80
+ <h3 class="section-header">Sections</h3>
81
+ <ul class="link-list">
82
+ <% klass.sections.sort_by { |s| s.title.to_s }.each do |section| %>
83
+ <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
84
+ <% end %>
85
+ </ul>
86
+ </div>
87
+ <% end %>
88
+
89
+ <% unless klass.classes_and_modules.empty? then %>
82
90
  <!-- Namespace Contents -->
83
- <% unless klass.classes_and_modules.empty? %>
84
91
  <div id="namespace-list-section" class="section">
85
92
  <h3 class="section-header">Namespace</h3>
86
93
  <ul class="link-list">
@@ -91,8 +98,8 @@
91
98
  </div>
92
99
  <% end %>
93
100
 
101
+ <% unless klass.method_list.empty? then %>
94
102
  <!-- Method Quickref -->
95
- <% unless klass.method_list.empty? %>
96
103
  <div id="method-list-section" class="section">
97
104
  <h3 class="section-header">Methods</h3>
98
105
  <ul class="link-list">
@@ -103,13 +110,13 @@
103
110
  </div>
104
111
  <% end %>
105
112
 
113
+ <% unless klass.includes.empty? then %>
106
114
  <!-- Included Modules -->
107
- <% unless klass.includes.empty? %>
108
115
  <div id="includes-section" class="section">
109
116
  <h3 class="section-header">Included Modules</h3>
110
117
  <ul class="link-list">
111
118
  <% klass.each_include do |inc| %>
112
- <% unless String === inc.module %>
119
+ <% unless String === inc.module then %>
113
120
  <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
114
121
  <% else %>
115
122
  <li><span class="include"><%= inc.name %></span></li>
@@ -154,7 +161,7 @@
154
161
  <div id="no-class-search-results" style="display: none;">No matching classes.</div>
155
162
  </div>
156
163
 
157
- <% if $DEBUG_RDOC %>
164
+ <% if $DEBUG_RDOC then %>
158
165
  <div id="debugging-toggle"><img src="<%= rel_prefix %>/images/bug.png"
159
166
  alt="toggle debugging" height="16" width="16" /></div>
160
167
  <% end %>
@@ -164,126 +171,142 @@
164
171
  <div id="documentation">
165
172
  <h1 class="<%= klass.type %>"><%= klass.full_name %></h1>
166
173
 
167
- <div id="description">
174
+ <div id="description" class="description">
168
175
  <%= klass.description %>
169
- </div>
176
+ </div><!-- description -->
177
+
178
+ <% klass.each_section do |section, constants, attributes| %>
179
+ <div id="<%= section.aref %>" class="documentation-section">
180
+ <% if section.title then %>
181
+ <h2 class="section-header">
182
+ <%= section.title %>
183
+ <a href="#top">&uarr; top</a>
184
+ </h2>
185
+ <% end %>
170
186
 
171
- <!-- Constants -->
172
- <% unless klass.constants.empty? %>
173
- <div id="constants-list" class="section">
174
- <h3 class="section-header">Constants</h3>
175
- <dl>
176
- <% klass.each_constant do |const| %>
177
- <dt><a name="<%= const.name %>"><%= const.name %></a></dt>
178
- <% if const.comment %>
179
- <dd class="description"><%= const.description.strip %></dd>
180
- <% else %>
181
- <dd class="description missing-docs">(Not documented)</dd>
182
- <% end %>
187
+ <% if section.comment then %>
188
+ <div class="description">
189
+ <%= section.description %>
190
+ </div>
183
191
  <% end %>
184
- </dl>
185
- </div>
186
- <% end %>
187
-
188
- <!-- Attributes -->
189
- <% unless klass.attributes.empty? %>
190
- <div id="attribute-method-details" class="method-section section">
191
- <h3 class="section-header">Attributes</h3>
192
-
193
- <% klass.each_attribute do |attrib| %>
194
- <div id="<%= attrib.html_name %>-attribute-method" class="method-detail">
195
- <a name="<%= h attrib.name %>"></a>
196
- <% if attrib.rw =~ /w/i %>
197
- <a name="<%= h attrib.name %>="></a>
198
- <% end %>
199
- <div class="method-heading attribute-method-heading">
200
- <span class="method-name"><%= h attrib.name %></span><span
201
- class="attribute-access-type">[<%= attrib.rw %>]</span>
202
- </div>
203
192
 
204
- <div class="method-description">
205
- <% if attrib.comment %>
206
- <%= attrib.description.strip %>
207
- <% else %>
208
- <p class="missing-docs">(Not documented)</p>
193
+ <% unless constants.empty? then %>
194
+ <!-- Constants -->
195
+ <div id="constants-list" class="section">
196
+ <h3 class="section-header">Constants</h3>
197
+ <dl>
198
+ <% constants.each do |const| %>
199
+ <dt><a name="<%= const.name %>"><%= const.name %></a></dt>
200
+ <% if const.comment then %>
201
+ <dd class="description"><%= const.description.strip %></dd>
202
+ <% else %>
203
+ <dd class="description missing-docs">(Not documented)</dd>
204
+ <% end %>
209
205
  <% end %>
210
- </div>
206
+ </dl>
211
207
  </div>
212
208
  <% end %>
213
- </div>
214
- <% end %>
215
-
216
- <!-- Methods -->
217
- <% klass.methods_by_type.each do |type, visibilities|
218
- next if visibilities.empty?
219
- visibilities.each do |visibility, methods|
220
- next if methods.empty? %>
221
- <div id="<%= visibility %>-<%= type %>-method-details" class="method-section section">
222
- <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
223
-
224
- <% methods.each do |method| %>
225
- <div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
226
- <a name="<%= h method.aref %>"></a>
227
-
228
- <% if method.call_seq %>
229
- <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
230
- <div class="method-heading">
231
- <span class="method-callseq"><%= call_seq.strip.gsub(/->/, '&rarr;').gsub( /^\w+\./m, '') %></span>
232
- <% if i == 0 %>
233
- <span class="method-click-advice">click to toggle source</span>
209
+
210
+ <% unless attributes.empty? then %>
211
+ <!-- Attributes -->
212
+ <div id="attribute-method-details" class="method-section section">
213
+ <h3 class="section-header">Attributes</h3>
214
+
215
+ <% attributes.each do |attrib| %>
216
+ <div id="<%= attrib.html_name %>-attribute-method" class="method-detail">
217
+ <a name="<%= h attrib.name %>"></a>
218
+ <% if attrib.rw =~ /w/i then %>
219
+ <a name="<%= h attrib.name %>="></a>
234
220
  <% end %>
221
+ <div class="method-heading attribute-method-heading">
222
+ <span class="method-name"><%= h attrib.name %></span><span
223
+ class="attribute-access-type">[<%= attrib.rw %>]</span>
224
+ </div>
225
+
226
+ <div class="method-description">
227
+ <% if attrib.comment then %>
228
+ <%= attrib.description.strip %>
229
+ <% else %>
230
+ <p class="missing-docs">(Not documented)</p>
231
+ <% end %>
232
+ </div>
235
233
  </div>
236
234
  <% end %>
237
- <% else %>
238
- <div class="method-heading">
239
- <span class="method-name"><%= h method.name %></span><span
240
- class="method-args"><%= method.params %></span>
241
- <span class="method-click-advice">click to toggle source</span>
242
- </div>
243
- <% end %>
235
+ </div><!-- attribute-method-details -->
236
+ <% end %>
244
237
 
245
- <div class="method-description">
246
- <% if method.comment %>
247
- <%= method.description.strip %>
238
+ <!-- Methods -->
239
+ <% klass.methods_by_type(section).each do |type, visibilities|
240
+ next if visibilities.empty?
241
+ visibilities.each do |visibility, methods|
242
+ next if methods.empty? %>
243
+ <div id="<%= visibility %>-<%= type %>-method-details" class="method-section section">
244
+ <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
245
+
246
+ <% methods.each do |method| %>
247
+ <div id="<%= method.html_name %>-method" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
248
+ <a name="<%= h method.aref %>"></a>
249
+
250
+ <% if method.call_seq then %>
251
+ <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
252
+ <div class="method-heading">
253
+ <span class="method-callseq"><%= call_seq.strip.gsub(/->/, '&rarr;').gsub( /^\w+\./m, '') %></span>
254
+ <% if i == 0 then %>
255
+ <span class="method-click-advice">click to toggle source</span>
256
+ <% end %>
257
+ </div>
258
+ <% end %>
248
259
  <% else %>
249
- <p class="missing-docs">(Not documented)</p>
260
+ <div class="method-heading">
261
+ <span class="method-name"><%= h method.name %></span><span
262
+ class="method-args"><%= method.params %></span>
263
+ <span class="method-click-advice">click to toggle source</span>
264
+ </div>
250
265
  <% end %>
251
266
 
252
- <% if method.token_stream %>
253
- <div class="method-source-code"
254
- id="<%= method.html_name %>-source">
267
+ <div class="method-description">
268
+ <% if method.comment then %>
269
+ <%= method.description.strip %>
270
+ <% else %>
271
+ <p class="missing-docs">(Not documented)</p>
272
+ <% end %>
273
+
274
+ <% if method.token_stream then %>
275
+ <div class="method-source-code" id="<%= method.html_name %>-source">
255
276
  <pre>
256
277
  <%= method.markup_code %>
257
278
  </pre>
279
+ </div><!-- <%= method.html_name %>-source -->
280
+ <% end %>
258
281
  </div>
259
- <% end %>
260
- </div>
261
282
 
262
- <% unless method.aliases.empty? %>
263
- <div class="aliases">
264
- Also aliased as: <%= method.aliases.map do |aka|
265
- if aka.parent then # HACK lib/rexml/encodings
266
- %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
267
- else
268
- h aka.name
269
- end
270
- end.join ", " %>
271
- </div>
272
- <% end %>
283
+ <% unless method.aliases.empty? then %>
284
+ <div class="aliases">
285
+ Also aliased as: <%= method.aliases.map do |aka|
286
+ if aka.parent then # HACK lib/rexml/encodings
287
+ %{<a href="#{klass.aref_to aka.path}">#{h aka.name}</a>}
288
+ else
289
+ h aka.name
290
+ end
291
+ end.join ", " %>
292
+ </div>
293
+ <% end %>
273
294
 
274
- <% if method.is_alias_for then %>
275
- <div class="aliases">
276
- Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
277
- </div>
278
- <% end %>
279
- </div>
295
+ <% if method.is_alias_for then %>
296
+ <div class="aliases">
297
+ Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
298
+ </div>
299
+ <% end %>
300
+ </div><!-- <%= method.html_name %>-method -->
280
301
 
281
- <% end %>
282
- </div>
283
- <% end
284
- end %>
302
+ <% end %>
303
+ </div><!-- <%= visibility %>-<%= type %>-method-details -->
304
+ <% end
305
+ end %>
306
+ </div><!-- <%= section.aref %> -->
307
+ <% end %>
285
308
 
286
- </div>
309
+ </div><!-- documentation -->
287
310
 
288
311
  <div id="validator-badges">
289
312
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>