sdoc 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,173 +1,209 @@
1
1
  <div id="content">
2
- <% unless (desc = context.description).empty? %>
2
+ <% unless (description = context.description).empty? %>
3
3
  <div class="description">
4
- <%= desc %>
4
+ <%= description %>
5
5
  </div>
6
- <% end %>
6
+ <% end %>
7
+
7
8
 
8
- <% unless context.requires.empty? %>
9
+ <% unless context.requires.empty? %>
10
+ <!-- File only: requires -->
9
11
  <div class="sectiontitle">Required Files</div>
10
12
  <ul>
11
- <% context.requires.each do |req| %>
13
+ <% context.requires.each do |req| %>
12
14
  <li><%= h req.name %></li>
13
- <% end %>
15
+ <% end %>
14
16
  </ul>
15
- <% end %>
17
+ <% end %>
18
+
16
19
 
17
- <% sections = context.sections.select { |section| section.title } %>
18
- <% unless sections.empty? %>
19
- <div class="sectiontitle">Contents</div>
20
+ <% sections = context.sections.select { |s| s.title }.sort_by{ |s| s.title.to_s } %>
21
+ <% unless sections.empty? then %>
22
+ <!-- Sections -->
23
+ <div class="sectiontitle">Sections</div>
20
24
  <ul>
21
- <% sections.each do |section| %>
22
- <li><a href="#<%= section.sequence %>"><%= h section.title %></a></li>
23
- <% end %>
25
+ <% sections.each do |section| %>
26
+ <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
27
+ <% end %>
24
28
  </ul>
25
- <% end %>
29
+ <% end %>
26
30
 
27
- <%
28
- list = context.method_list
29
- list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
30
- %>
31
- <% unless list.empty? %>
31
+
32
+ <% unless context.classes_and_modules.empty? %>
33
+ <!-- Namespace -->
34
+ <div class="sectiontitle">Namespace</div>
35
+ <ul>
36
+ <% (context.modules.sort + context.classes.sort).each do |mod| %>
37
+ <li>
38
+ <span class="type"><%= mod.type.upcase %></span>
39
+ <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a>
40
+ </li>
41
+ <% end %>
42
+ </ul>
43
+ <% end %>
44
+
45
+
46
+ <% unless context.method_list.empty? %>
47
+ <!-- Method ref -->
32
48
  <div class="sectiontitle">Methods</div>
33
49
  <dl class="methods">
34
- <% each_letter_group(list) do |group| %>
50
+ <% each_letter_group(context.method_list) do |group| %>
35
51
  <dt><%= group[:name] %></dt>
36
52
  <dd>
37
- <ul>
38
- <% group[:methods].each_with_index do |method, i| %>
39
- <li><a href="#<%= method.aref %>"><%= method.name %></a><%= ',' unless group[:methods].size == i+1 %></li>
40
- <% end %>
41
- </ul>
53
+ <ul>
54
+ <% group[:methods].each_with_index do |method, i| %>
55
+ <%
56
+ comma = group[:methods].size == i+1 ? '' : ','
57
+ %>
58
+ <li>
59
+ <a href="#<%= method.aref %>"><%= h method.name %></a><%= comma %>
60
+ </li>
61
+ <% end %>
62
+ </ul>
42
63
  </dd>
43
- <% end %>
64
+ <% end %>
44
65
  </dl>
45
- <% end %>
66
+ <% end %>
46
67
 
47
- <% unless context.includes.empty? %>
68
+ <% unless context.includes.empty? %>
69
+ <!-- Includes -->
48
70
  <div class="sectiontitle">Included Modules</div>
49
71
  <ul>
50
- <% context.includes.each do |inc| %>
72
+ <% context.includes.each do |inc| %>
51
73
  <li>
52
- <% unless String === inc.module %>
53
- <a href="<%= context.aref_to inc.module.path %>"><%= h inc.module.full_name %></a>
54
- <% else %>
55
- <span><%= h inc.name %></span>
56
- <% end %>
57
- START:includes
74
+ <% unless String === inc.module %>
75
+ <a href="<%= context.aref_to inc.module.path %>">
76
+ <%= h inc.module.full_name %>
77
+ </a>
78
+ <% else %>
79
+ <%= h inc.name %>
80
+ <% end %>
58
81
  </li>
59
- <% end %>
82
+ <% end %>
60
83
  </ul>
61
- <% end %>
84
+ <% end %>
62
85
 
63
- <% sections.each do |section| %>
64
- <div class="sectiontitle"><a name="<%= h section.sequence %>"><%= h section.title %></a></div>
65
- <% unless (description = section.description).empty? %>
66
- <div class="description">
67
- <%= description %>
68
- </div>
69
- <% end %>
86
+
87
+
88
+ <% context.each_section do |section, constants, attributes| %>
89
+
90
+ <% if section.title then %>
91
+ <div class="contenttitle" id="<%= h section.aref %>">
92
+ <%= h section.title %>
93
+ </div>
70
94
  <% end %>
71
95
 
72
- <% unless context.classes_and_modules.empty? %>
73
- <div class="sectiontitle">Classes and Modules</div>
74
- <ul>
75
- <% (context.modules.sort + context.classes.sort).each do |mod| %>
76
- <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a></li>
77
- <% end %>
78
- </ul>
96
+ <% if section.comment then %>
97
+ <div class="description">
98
+ <%= section.description %>
99
+ </div>
79
100
  <% end %>
80
101
 
81
- <% unless context.constants.empty? %>
82
- <div class="sectiontitle">Constants</div>
83
- <table border='0' cellpadding='5'>
102
+ <% unless constants.empty? %>
103
+ <!-- Section constants -->
104
+ <div class="sectiontitle">Constants</div>
105
+ <table border='0' cellpadding='5'>
84
106
  <% context.each_constant do |const| %>
85
- <tr valign='top'>
107
+ <tr valign='top'>
86
108
  <td class="attr-name"><%= h const.name %></td>
87
109
  <td>=</td>
88
110
  <td class="attr-value"><%= h const.value %></td>
89
- </tr>
90
- <% unless (description = const.description).empty? %>
91
- <tr valign='top'>
92
- <td>&nbsp;</td>
93
- <td colspan="2" class="attr-desc"><%= description %></td>
94
- </tr>
111
+ </tr>
112
+ <% if const.comment %>
113
+ <tr valign='top'>
114
+ <td>&nbsp;</td>
115
+ <td colspan="2" class="attr-desc"><%= const.description.strip %></td>
116
+ </tr>
117
+ <% end %>
95
118
  <% end %>
96
- <% end %>
97
- </table>
119
+ </table>
98
120
  <% end %>
99
121
 
100
- <% unless context.attributes.empty? %>
101
- <div class="sectiontitle">Attributes</div>
102
- <table border='0' cellpadding='5'>
103
- <% context.each_attribute do |attrib| %>
104
- <tr valign='top'>
122
+
123
+ <% unless attributes.empty? %>
124
+ <!-- Section attributes -->
125
+ <div class="sectiontitle">Attributes</div>
126
+ <table border='0' cellpadding='5'>
127
+ <% attributes.each do |attrib| %>
128
+ <tr valign='top'>
105
129
  <td class='attr-rw'>
106
- [<%= attrib.rw %>]
130
+ [<%= attrib.rw %>]
107
131
  </td>
108
132
  <td class='attr-name'><%= h attrib.name %></td>
109
133
  <td class='attr-desc'><%= attrib.description.strip %></td>
110
- </tr>
134
+ </tr>
111
135
  <% end %>
112
- </table>
136
+ </table>
113
137
  <% end %>
114
138
 
115
- <% context.methods_by_type.each do |type, visibilities|
139
+
140
+ <!-- Methods -->
141
+ <%
142
+ context.methods_by_type(section).each do |type, visibilities|
116
143
  next if visibilities.empty?
144
+
117
145
  visibilities.each do |visibility, methods|
118
- next if methods.empty?
119
- next unless visibility == :public || visibility == :protected || methods.any? {|m| m.force_documentation }
120
- %>
121
- <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
122
- <% methods.each do |method| %>
123
- <div class="method">
124
- <div class="title method-title" id="<%= method.aref %>">
125
- <% if method.call_seq %>
126
- <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
127
- <% else %>
128
- <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
129
- <% end %>
130
- </div>
131
- <% unless (description = method.description).empty? %>
132
- <div class="description">
133
- <%= description %>
134
- </div>
135
- <% end %>
136
- <% unless method.aliases.empty? %>
137
- <div class="aka">
138
- This method is also aliased as
139
- <% method.aliases.each do |aka| %>
140
- <a href="<%= context.aref_to aka.path %>"><%= h aka.name %></a>
141
- <% end %>
142
- </div>
143
- <% end %>
144
- <% if method.token_stream %>
145
- <% markup = method.sdoc_markup_code %>
146
- <div class="sourcecode">
147
- <p class="source-link">
148
- Source: <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
149
- <%
150
- if markup =~ /File\s(\S+), line (\d+)/
151
- path = $1
152
- line = $2.to_i
153
- end
154
- %>
155
- <%
156
- if options.github && path
157
- github = github_url(path)
158
- if github
159
- %>
160
- | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
161
- <% end end %>
162
- </p>
163
- <div id="<%= method.aref %>_source" class="dyn-source">
164
- <pre><%= markup %></pre>
165
- </div>
166
- </div>
146
+ next if methods.empty?
147
+ %>
148
+ <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
149
+ <% methods.each do |method| %>
150
+ <div class="method">
151
+ <div class="title method-title" id="<%= method.aref %>">
152
+ <% if method.call_seq %>
153
+ <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
154
+ <% else %>
155
+ <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
156
+ <% end %>
157
+ </div>
158
+
159
+ <% unless method.comment %>
160
+ <div class="description">
161
+ <%= method.description.strip %>
162
+ </div>
163
+ <% end %>
164
+
165
+ <% unless method.aliases.empty? %>
166
+ <div class="aka">
167
+ Also aliased as: <%= method.aliases.map do |aka|
168
+ if aka.parent then # HACK lib/rexml/encodings
169
+ %{<a href="#{context.aref_to aka.path}">#{h aka.name}</a>}
170
+ else
171
+ h aka.name
172
+ end
173
+ end.join ", " %>
174
+ </div>
175
+ <% end %>
176
+
177
+ <% if method.token_stream %>
178
+ <% markup = method.sdoc_markup_code %>
179
+ <div class="sourcecode">
180
+ <%
181
+ # generate github link
182
+ github = if options.github
183
+ if markup =~ /File\s(\S+), line (\d+)/
184
+ path = $1
185
+ line = $2.to_i
186
+ end
187
+ path && github_url(path)
188
+ else
189
+ false
190
+ end
191
+ %>
192
+ <p class="source-link">
193
+ Source:
194
+ <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
195
+ <% if github %>
196
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
167
197
  <% end %>
198
+ </p>
199
+ <div id="<%= method.aref %>_source" class="dyn-source">
200
+ <pre><%= markup %></pre>
201
+ </div>
168
202
  </div>
169
- <% end
170
- end
171
- end
172
- %>
203
+ <% end %>
204
+ </div>
205
+ <% end #methods.each %>
206
+ <% end #visibilities.each %>
207
+ <% end #context.methods_by_type %>
208
+ <% end #context.each_section %>
173
209
  </div>
@@ -200,6 +200,15 @@ pre
200
200
  border-bottom: 1px solid #000;
201
201
  }
202
202
 
203
+ .contenttitle {
204
+ margin-top: 4em;
205
+ margin-bottom: 1.3em;
206
+ margin-left: -0.9em;
207
+ font-size: 1.6em;
208
+ padding: 0 0 0.25em 0;
209
+ font-weight: bold;
210
+ }
211
+
203
212
  .attr-rw {
204
213
  padding-right: 1em;
205
214
  text-align: center;
@@ -1,173 +1,209 @@
1
1
  <div id="content">
2
- <% unless (desc = context.description).empty? %>
2
+ <% unless (description = context.description).empty? %>
3
3
  <div class="description">
4
- <%= desc %>
4
+ <%= description %>
5
5
  </div>
6
- <% end %>
6
+ <% end %>
7
+
7
8
 
8
- <% unless context.requires.empty? %>
9
+ <% unless context.requires.empty? %>
10
+ <!-- File only: requires -->
9
11
  <div class="sectiontitle">Required Files</div>
10
12
  <ul>
11
- <% context.requires.each do |req| %>
13
+ <% context.requires.each do |req| %>
12
14
  <li><%= h req.name %></li>
13
- <% end %>
15
+ <% end %>
14
16
  </ul>
15
- <% end %>
17
+ <% end %>
18
+
16
19
 
17
- <% sections = context.sections.select { |section| section.title } %>
18
- <% unless sections.empty? %>
19
- <div class="sectiontitle">Contents</div>
20
+ <% sections = context.sections.select { |s| s.title }.sort_by{ |s| s.title.to_s } %>
21
+ <% unless sections.empty? then %>
22
+ <!-- Sections -->
23
+ <div class="sectiontitle">Sections</div>
20
24
  <ul>
21
- <% sections.each do |section| %>
22
- <li><a href="#<%= section.sequence %>"><%= h section.title %></a></li>
23
- <% end %>
25
+ <% sections.each do |section| %>
26
+ <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
27
+ <% end %>
24
28
  </ul>
25
- <% end %>
29
+ <% end %>
26
30
 
27
- <%
28
- list = context.method_list
29
- list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
30
- %>
31
- <% unless list.empty? %>
31
+
32
+ <% unless context.classes_and_modules.empty? %>
33
+ <!-- Namespace -->
34
+ <div class="sectiontitle">Namespace</div>
35
+ <ul>
36
+ <% (context.modules.sort + context.classes.sort).each do |mod| %>
37
+ <li>
38
+ <span class="type"><%= mod.type.upcase %></span>
39
+ <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a>
40
+ </li>
41
+ <% end %>
42
+ </ul>
43
+ <% end %>
44
+
45
+
46
+ <% unless context.method_list.empty? %>
47
+ <!-- Method ref -->
32
48
  <div class="sectiontitle">Methods</div>
33
49
  <dl class="methods">
34
- <% each_letter_group(list) do |group| %>
50
+ <% each_letter_group(context.method_list) do |group| %>
35
51
  <dt><%= group[:name] %></dt>
36
52
  <dd>
37
- <ul>
38
- <% group[:methods].each_with_index do |method, i| %>
39
- <li><a href="#<%= method.aref %>"><%= method.name %></a><%= ',' unless group[:methods].size == i+1 %></li>
40
- <% end %>
41
- </ul>
53
+ <ul>
54
+ <% group[:methods].each_with_index do |method, i| %>
55
+ <%
56
+ comma = group[:methods].size == i+1 ? '' : ','
57
+ %>
58
+ <li>
59
+ <a href="#<%= method.aref %>"><%= h method.name %></a><%= comma %>
60
+ </li>
61
+ <% end %>
62
+ </ul>
42
63
  </dd>
43
- <% end %>
64
+ <% end %>
44
65
  </dl>
45
- <% end %>
66
+ <% end %>
46
67
 
47
- <% unless context.includes.empty? %>
68
+ <% unless context.includes.empty? %>
69
+ <!-- Includes -->
48
70
  <div class="sectiontitle">Included Modules</div>
49
71
  <ul>
50
- <% context.includes.each do |inc| %>
72
+ <% context.includes.each do |inc| %>
51
73
  <li>
52
- <% unless String === inc.module %>
53
- <a href="<%= context.aref_to inc.module.path %>"><%= h inc.module.full_name %></a>
54
- <% else %>
55
- <span><%= h inc.name %></span>
56
- <% end %>
57
- START:includes
74
+ <% unless String === inc.module %>
75
+ <a href="<%= context.aref_to inc.module.path %>">
76
+ <%= h inc.module.full_name %>
77
+ </a>
78
+ <% else %>
79
+ <%= h inc.name %>
80
+ <% end %>
58
81
  </li>
59
- <% end %>
82
+ <% end %>
60
83
  </ul>
61
- <% end %>
84
+ <% end %>
62
85
 
63
- <% sections.each do |section| %>
64
- <div class="sectiontitle"><a name="<%= h section.sequence %>"><%= h section.title %></a></div>
65
- <% unless (description = section.description).empty? %>
66
- <div class="description">
67
- <%= description %>
68
- </div>
69
- <% end %>
86
+
87
+
88
+ <% context.each_section do |section, constants, attributes| %>
89
+
90
+ <% if section.title then %>
91
+ <div class="contenttitle" id="<%= h section.aref %>">
92
+ <%= h section.title %>
93
+ </div>
70
94
  <% end %>
71
95
 
72
- <% unless context.classes_and_modules.empty? %>
73
- <div class="sectiontitle">Classes and Modules</div>
74
- <ul>
75
- <% (context.modules.sort + context.classes.sort).each do |mod| %>
76
- <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a></li>
77
- <% end %>
78
- </ul>
96
+ <% if section.comment then %>
97
+ <div class="description">
98
+ <%= section.description %>
99
+ </div>
79
100
  <% end %>
80
101
 
81
- <% unless context.constants.empty? %>
82
- <div class="sectiontitle">Constants</div>
83
- <table border='0' cellpadding='5'>
102
+ <% unless constants.empty? %>
103
+ <!-- Section constants -->
104
+ <div class="sectiontitle">Constants</div>
105
+ <table border='0' cellpadding='5'>
84
106
  <% context.each_constant do |const| %>
85
- <tr valign='top'>
107
+ <tr valign='top'>
86
108
  <td class="attr-name"><%= h const.name %></td>
87
109
  <td>=</td>
88
110
  <td class="attr-value"><%= h const.value %></td>
89
- </tr>
90
- <% unless (description = const.description).empty? %>
91
- <tr valign='top'>
92
- <td>&nbsp;</td>
93
- <td colspan="2" class="attr-desc"><%= description %></td>
94
- </tr>
111
+ </tr>
112
+ <% if const.comment %>
113
+ <tr valign='top'>
114
+ <td>&nbsp;</td>
115
+ <td colspan="2" class="attr-desc"><%= const.description.strip %></td>
116
+ </tr>
117
+ <% end %>
95
118
  <% end %>
96
- <% end %>
97
- </table>
119
+ </table>
98
120
  <% end %>
99
121
 
100
- <% unless context.attributes.empty? %>
101
- <div class="sectiontitle">Attributes</div>
102
- <table border='0' cellpadding='5'>
103
- <% context.each_attribute do |attrib| %>
104
- <tr valign='top'>
122
+
123
+ <% unless attributes.empty? %>
124
+ <!-- Section attributes -->
125
+ <div class="sectiontitle">Attributes</div>
126
+ <table border='0' cellpadding='5'>
127
+ <% attributes.each do |attrib| %>
128
+ <tr valign='top'>
105
129
  <td class='attr-rw'>
106
- [<%= attrib.rw %>]
130
+ [<%= attrib.rw %>]
107
131
  </td>
108
132
  <td class='attr-name'><%= h attrib.name %></td>
109
133
  <td class='attr-desc'><%= attrib.description.strip %></td>
110
- </tr>
134
+ </tr>
111
135
  <% end %>
112
- </table>
136
+ </table>
113
137
  <% end %>
114
138
 
115
- <% context.methods_by_type.each do |type, visibilities|
139
+
140
+ <!-- Methods -->
141
+ <%
142
+ context.methods_by_type(section).each do |type, visibilities|
116
143
  next if visibilities.empty?
144
+
117
145
  visibilities.each do |visibility, methods|
118
- next if methods.empty?
119
- next unless visibility == :public || visibility == :protected || methods.any? {|m| m.force_documentation }
120
- %>
121
- <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
122
- <% methods.each do |method| %>
123
- <div class="method">
124
- <div class="title method-title" id="<%= method.aref %>">
125
- <% if method.call_seq %>
126
- <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
127
- <% else %>
128
- <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
129
- <% end %>
130
- </div>
131
- <% unless (description = method.description).empty? %>
132
- <div class="description">
133
- <%= description %>
134
- </div>
135
- <% end %>
136
- <% unless method.aliases.empty? %>
137
- <div class="aka">
138
- This method is also aliased as
139
- <% method.aliases.each do |aka| %>
140
- <a href="<%= context.aref_to aka.path %>"><%= h aka.name %></a>
141
- <% end %>
142
- </div>
143
- <% end %>
144
- <% if method.token_stream %>
145
- <% markup = method.sdoc_markup_code %>
146
- <div class="sourcecode">
147
- <p class="source-link">
148
- Source: <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
149
- <%
150
- if markup =~ /File\s(\S+), line (\d+)/
151
- path = $1
152
- line = $2.to_i
153
- end
154
- %>
155
- <%
156
- if options.github && path
157
- github = github_url(path)
158
- if github
159
- %>
160
- | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
161
- <% end end %>
162
- </p>
163
- <div id="<%= method.aref %>_source" class="dyn-source">
164
- <pre><%= markup %></pre>
165
- </div>
166
- </div>
146
+ next if methods.empty?
147
+ %>
148
+ <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
149
+ <% methods.each do |method| %>
150
+ <div class="method">
151
+ <div class="title method-title" id="<%= method.aref %>">
152
+ <% if method.call_seq %>
153
+ <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
154
+ <% else %>
155
+ <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
156
+ <% end %>
157
+ </div>
158
+
159
+ <% unless method.comment %>
160
+ <div class="description">
161
+ <%= method.description.strip %>
162
+ </div>
163
+ <% end %>
164
+
165
+ <% unless method.aliases.empty? %>
166
+ <div class="aka">
167
+ Also aliased as: <%= method.aliases.map do |aka|
168
+ if aka.parent then # HACK lib/rexml/encodings
169
+ %{<a href="#{context.aref_to aka.path}">#{h aka.name}</a>}
170
+ else
171
+ h aka.name
172
+ end
173
+ end.join ", " %>
174
+ </div>
175
+ <% end %>
176
+
177
+ <% if method.token_stream %>
178
+ <% markup = method.sdoc_markup_code %>
179
+ <div class="sourcecode">
180
+ <%
181
+ # generate github link
182
+ github = if options.github
183
+ if markup =~ /File\s(\S+), line (\d+)/
184
+ path = $1
185
+ line = $2.to_i
186
+ end
187
+ path && github_url(path)
188
+ else
189
+ false
190
+ end
191
+ %>
192
+ <p class="source-link">
193
+ Source:
194
+ <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
195
+ <% if github %>
196
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
167
197
  <% end %>
198
+ </p>
199
+ <div id="<%= method.aref %>_source" class="dyn-source">
200
+ <pre><%= markup %></pre>
201
+ </div>
168
202
  </div>
169
- <% end
170
- end
171
- end
172
- %>
203
+ <% end %>
204
+ </div>
205
+ <% end #methods.each %>
206
+ <% end #visibilities.each %>
207
+ <% end #context.methods_by_type %>
208
+ <% end #context.each_section %>
173
209
  </div>
@@ -187,6 +187,15 @@ pre
187
187
  border-bottom: 1px solid #000;
188
188
  }
189
189
 
190
+ .contenttitle {
191
+ margin-top: 4em;
192
+ margin-bottom: 1.3em;
193
+ margin-left: -0.9em;
194
+ font-size: 1.6em;
195
+ padding: 0 0 0.25em 0;
196
+ font-weight: bold;
197
+ }
198
+
190
199
  .attr-rw {
191
200
  padding-right: 1em;
192
201
  text-align: center;
@@ -214,14 +214,17 @@ class RDoc::Generator::SDoc
214
214
  end
215
215
 
216
216
  ### Recursivly build class tree structure
217
- def generate_class_tree_level(classes)
217
+ def generate_class_tree_level(classes, visited = {})
218
218
  tree = []
219
- classes.select{|c| c.with_documentation? }.sort.each do |klass|
219
+ classes.select do |klass|
220
+ !visited[klass] && klass.with_documentation?
221
+ end.sort.each do |klass|
222
+ visited[klass] = true
220
223
  item = [
221
224
  klass.name,
222
225
  klass.document_self_or_methods ? klass.path : '',
223
226
  klass.module? ? '' : (klass.superclass ? " < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}" : ''),
224
- generate_class_tree_level(klass.classes_and_modules)
227
+ generate_class_tree_level(klass.classes_and_modules, visited)
225
228
  ]
226
229
  tree << item
227
230
  end
@@ -259,6 +262,7 @@ class RDoc::Generator::SDoc
259
262
  @files.select { |file|
260
263
  file.document_self
261
264
  }.sort.each do |file|
265
+ debug_msg " #{file.path}"
262
266
  index[:searchIndex].push( search_string(file.name) )
263
267
  index[:longSearchIndex].push( search_string(file.path) )
264
268
  index[:info].push([
@@ -275,11 +279,11 @@ class RDoc::Generator::SDoc
275
279
  ### Add classes to search +index+ array
276
280
  def add_class_search_index(index)
277
281
  debug_msg " generating class search index"
278
-
279
- @classes.select { |klass|
282
+ @classes.uniq.select { |klass|
280
283
  klass.document_self_or_methods
281
284
  }.sort.each do |klass|
282
285
  modulename = klass.module? ? '' : (klass.superclass ? (String === klass.superclass ? klass.superclass : klass.superclass.full_name) : '')
286
+ debug_msg " #{klass.parent.full_name}::#{klass.name}"
283
287
  index[:searchIndex].push( search_string(klass.name) )
284
288
  index[:longSearchIndex].push( search_string(klass.parent.full_name) )
285
289
  files = klass.in_files.map{ |file| file.absolute_name }
@@ -298,7 +302,7 @@ class RDoc::Generator::SDoc
298
302
  def add_method_search_index(index)
299
303
  debug_msg " generating method search index"
300
304
 
301
- list = @classes.map do |klass|
305
+ list = @classes.uniq.map do |klass|
302
306
  klass.method_list
303
307
  end.flatten.sort do |a, b|
304
308
  a.name == b.name ?
@@ -312,6 +316,7 @@ class RDoc::Generator::SDoc
312
316
  end
313
317
 
314
318
  list.each do |method|
319
+ debug_msg " #{method.full_name}"
315
320
  index[:searchIndex].push( search_string(method.name) + '()' )
316
321
  index[:longSearchIndex].push( search_string(method.parent.full_name) )
317
322
  index[:info].push([
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "sdoc"
5
- s.version = "0.3.8"
5
+ s.version = "0.3.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Vladimir Kolesnikov"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 8
10
- version: 0.3.8
9
+ - 9
10
+ version: 0.3.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vladimir Kolesnikov