voloko-sdoc 0.2.0 → 0.2.1

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,4 +1,4 @@
1
1
  ---
2
2
  :minor: 2
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 0
@@ -18,6 +18,7 @@ require 'rdoc/generator/markup'
18
18
 
19
19
  require 'sdoc/github'
20
20
  require 'sdoc/templatable'
21
+ require 'sdoc/helpers'
21
22
 
22
23
  class RDoc::ClassModule
23
24
  def with_documentation?
@@ -30,6 +31,7 @@ class RDoc::Generator::SHtml
30
31
  include ERB::Util
31
32
  include SDoc::GitHub
32
33
  include SDoc::Templatable
34
+ include SDoc::Helpers
33
35
 
34
36
  GENERATOR_DIRS = [File.join('sdoc', 'generator'), File.join('rdoc', 'generator')]
35
37
 
@@ -0,0 +1,170 @@
1
+ <div id="content">
2
+ <% unless (desc = context.description).empty? %>
3
+ <div class="description"><%= desc %></div>
4
+ <% end %>
5
+
6
+ <% unless context.requires.empty? %>
7
+ <div class="sectiontitle">Required Files</div>
8
+ <ul>
9
+ <% context.requires.each do |req| %>
10
+ <li><%= h req.name %></li>
11
+ <% end %>
12
+ </ul>
13
+ <% end %>
14
+
15
+ <% sections = context.sections.select { |section| section.title } %>
16
+ <% unless sections.empty? %>
17
+ <div class="sectiontitle">Contents</div>
18
+ <ul>
19
+ <% sections.each do |section| %>
20
+ <li><a href="#<%= section.sequence %>"><%= h section.title %></a></li>
21
+ <% end %>
22
+ </ul>
23
+ <% end %>
24
+
25
+ <%
26
+ list = context.method_list
27
+ unless @options.show_all
28
+ list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
29
+ end
30
+ %>
31
+ <% unless list.empty? %>
32
+ <div class="sectiontitle">Methods</div>
33
+ <dl class="methods">
34
+ <% each_letter_group(list) do |group| %>
35
+ <dt><%= group[:name] %></dt>
36
+ <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>
42
+ </dd>
43
+ <% end %>
44
+ </dl>
45
+ <% end %>
46
+
47
+ <% unless context.includes.empty? %>
48
+ <div class="sectiontitle">Included Modules</div>
49
+ <ul>
50
+ <% context.includes.each do |inc| %>
51
+ <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
58
+ </li>
59
+ <% end %>
60
+ </ul>
61
+ <% end %>
62
+
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 %>
70
+ <% end %>
71
+
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>
79
+ <% end %>
80
+
81
+ <% unless context.constants.empty? %>
82
+ <div class="sectiontitle">Constants</div>
83
+ <table border='0' cellpadding='5'>
84
+ <% context.each_constant do |const| %>
85
+ <tr valign='top'>
86
+ <td class="attr-name"><%= h const.name %></td>
87
+ <td>=</td>
88
+ <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>
95
+ <% end %>
96
+ <% end %>
97
+ </table>
98
+ <% end %>
99
+
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'>
105
+ <td class='attr-rw'>
106
+ [<%= attrib.rw %>]
107
+ </td>
108
+ <td class='attr-name'><%= h attrib.name %></td>
109
+ <td class='attr-desc'><%= attrib.description.strip %></td>
110
+ </tr>
111
+ <% end %>
112
+ </table>
113
+ <% end %>
114
+
115
+ <% context.methods_by_type.each do |type, visibilities|
116
+ next if visibilities.empty?
117
+ 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" 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.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
+ github = github_url(path)
155
+ if github
156
+ %>
157
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
158
+ <% end %>
159
+ </p>
160
+ <div id="<%= method.aref %>_source" class="dyn-source">
161
+ <pre><%= method.markup_code %></pre>
162
+ </div>
163
+ </div>
164
+ <% end %>
165
+ </div>
166
+ <% end
167
+ end
168
+ end
169
+ %>
170
+ </div>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="%charset%"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html>
5
+ <head>
6
+ <title><%= h klass.full_name %></title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
8
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/reset.css" %>" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/main.css" %>" type="text/css" media="screen" />
10
+ <script src="<%= "#{rel_prefix}/js/jquery-1.3.2.min.js" %>" type="text/javascript" charset="utf-8"></script>
11
+ <script src="<%= "#{rel_prefix}/js/jquery-effect.js" %>" type="text/javascript" charset="utf-8"></script>
12
+ <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8"></script>
13
+ </head>
14
+
15
+ <body>
16
+ <div class="banner">
17
+ <h1>
18
+ <span class="type"><%= klass.module? ? 'Module' : 'Class' %></span>
19
+ <%= h klass.full_name %>
20
+ <% if klass.type == 'class' %>
21
+ <span class="parent">&lt;
22
+ <% if String === klass.superclass %>
23
+ <%= klass.superclass %>
24
+ <% elsif !klass.superclass.nil? %>
25
+ <a href="<%= klass.aref_to klass.superclass.path %>"><%= h klass.superclass.full_name %></a>
26
+ <% end %>
27
+ </span>
28
+ <% end %>
29
+ </h1>
30
+ <ul class="files">
31
+ <% klass.in_files.each do |file| %>
32
+ <li><a href="<%= "#{rel_prefix}/#{h file.path}" %>"><%= h file.absolute_name %></a></li>
33
+ <% end %>
34
+ </ul>
35
+ </div>
36
+ <div id="bodyContent">
37
+ <%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
38
+ </div>
39
+ </body>
40
+ </html>
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="%charset%"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html>
5
+ <head>
6
+ <title><%= h file.name %></title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
8
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/reset.css" %>" type="text/css" media="screen" />
9
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/main.css" %>" type="text/css" media="screen" />
10
+ <script src="<%= "#{rel_prefix}/js/jquery-1.3.2.min.js" %>" type="text/javascript" charset="utf-8"></script>
11
+ <script src="<%= "#{rel_prefix}/js/jquery-effect.js" %>" type="text/javascript" charset="utf-8"></script>
12
+ <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8"></script>
13
+ </head>
14
+
15
+ <body>
16
+ <div class="banner">
17
+ <h1>
18
+ <span class="type">File</span> <%= h file.name %>
19
+ </h1>
20
+ <ul class="files">
21
+ <li><%= h file.relative_name %></li>
22
+ </ul>
23
+ </div>
24
+
25
+ <div id="bodyContent">
26
+ <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%"/>
7
+
8
+ <title><%= @options.title %></title>
9
+ </head>
10
+ <frameset cols="300,*" frameborder="1" border="1" bordercolor="#666666" framespacing="1">
11
+ <frame src="panel/index.html" title="Search" name="panel" />
12
+ <frame src="<%= index_path %>" name="docwin" />
13
+ </frameset>
14
+ </html>
@@ -0,0 +1,233 @@
1
+ body {
2
+ font-family: "Helvetica Neue", Arial, sans-serif;
3
+ background: #FFF;
4
+ color: #000;
5
+ margin: 0px;
6
+ font-size: 0.82em;
7
+ line-height: 1.25em;
8
+ }
9
+
10
+ a {
11
+ color: #00F;
12
+ text-decoration: none;
13
+ }
14
+
15
+ a:hover {
16
+ color: #333;
17
+ background: #FE8;
18
+ }
19
+
20
+ p {
21
+ margin-bottom: 1em;
22
+ }
23
+
24
+ h1 {
25
+ font-size: 2em;
26
+ font-weight: normal;
27
+ line-height: 1.2em;
28
+ }
29
+
30
+ h2 {
31
+ font-size: 1.6em;
32
+ margin: 1.8em 0 0.8em 0;
33
+ font-weight: normal;
34
+ line-height: 1.2em;
35
+ }
36
+
37
+ h3 {
38
+
39
+ }
40
+
41
+ h4 {
42
+ margin: 1.4em 0 0.5em 0;
43
+ font-size: 1em;
44
+ }
45
+
46
+ .clear
47
+ {
48
+ clear: both;
49
+ width: 0; height: 0;
50
+ }
51
+
52
+
53
+
54
+ li
55
+ {
56
+ margin: 0 0 0.5em 2em;
57
+ list-style: disc;
58
+ }
59
+
60
+ .banner
61
+ {
62
+ background: #DDF;
63
+ border-bottom: 1px solid #ccc;
64
+ padding: 1em 2em 0.5em 2em;
65
+ }
66
+ .banner h1
67
+ {
68
+ font-size: 1.2em;
69
+ }
70
+
71
+ .banner h1 .type
72
+ {
73
+ font-size: 0.833em;
74
+ display:block;
75
+ }
76
+
77
+ .banner h1 .type,
78
+ .banner h1 .parent
79
+ {
80
+ color: #666;
81
+ }
82
+
83
+ .banner ul
84
+ {
85
+ margin-top: 0.3em;
86
+ margin-bottom: 0;
87
+ font-size: 0.85em;
88
+ }
89
+
90
+ .banner li
91
+ {
92
+ list-style: none;
93
+ margin-left: 0;
94
+ margin-bottom: 0;
95
+ }
96
+
97
+ pre
98
+ {
99
+ margin-bottom: 1em;
100
+ }
101
+
102
+ .methods dt
103
+ {
104
+ width: 1em;
105
+ font-size: 1.5em;
106
+ color:#AAA;
107
+ position: absolute;
108
+ font-weight: normal;
109
+ }
110
+
111
+ .methods dd
112
+ {
113
+ margin-left: 2.5em;
114
+ min-height: 1.8em;
115
+ -height: 1.8em;
116
+ padding-bottom: 0.8em;
117
+ }
118
+
119
+
120
+ .methods ul li
121
+ {
122
+ margin-right: 0.7em;
123
+ margin-left: 0;
124
+ list-style: none;
125
+ display: inline;
126
+ }
127
+
128
+ #content {
129
+ margin: 2em;
130
+ margin-left: 3.5em;
131
+ margin-right: 3.5em;
132
+ }
133
+
134
+
135
+ .sectiontitle {
136
+ margin-top: 2em;
137
+ margin-bottom: 1.3em;
138
+ margin-left: -1.2em;
139
+ font-size: 1.2em;
140
+ padding: 0 0 0.25em 0;
141
+ font-weight: bold;
142
+ border-bottom: 1px solid #000;
143
+ }
144
+
145
+ .attr-rw {
146
+ padding-right: 1em;
147
+ text-align: center;
148
+ color: #055;
149
+ }
150
+
151
+ .attr-name {
152
+ font-weight: bold;
153
+ padding-right: 1em;
154
+ }
155
+
156
+ .attr-desc {
157
+ }
158
+
159
+ tt {
160
+ font-size: 1.15em;
161
+ }
162
+
163
+ .attr-value {
164
+ font-family: monospace;
165
+ padding-left: 1em;
166
+ font-size: 1.15em;
167
+ }
168
+
169
+ .dyn-source {
170
+ display: none;
171
+ background: #fffde8;
172
+ color: #000;
173
+ border: #ffe0bb dotted 1px;
174
+ margin: 0.5em 2em 0.5em 0;
175
+ padding: 0.5em;
176
+ }
177
+
178
+ .dyn-source .cmt {
179
+ color: #00F;
180
+ font-style: italic;
181
+ }
182
+
183
+ .dyn-source .kw {
184
+ color: #070;
185
+ font-weight: bold;
186
+ }
187
+
188
+ .description pre {
189
+ padding: 0.5em;
190
+ border: #ffe0bb dotted 1px;
191
+ background: #fffde8;
192
+ }
193
+
194
+ .method {
195
+ margin-bottom: 2em;
196
+ }
197
+ .method .description,
198
+ .method .sourcecode
199
+ {
200
+ margin-left: 1.2em;
201
+ }
202
+ .method h4
203
+ {
204
+ border-bottom: 1px dotted #999;
205
+ padding: 0 0 0.2em 0;
206
+ margin-bottom: 0.8em;
207
+ font-size: 1.1em;
208
+ color:#333;
209
+ }
210
+ .method .title {
211
+ border-bottom: 1px dotted #666;
212
+ padding: 0 0 0.15em 0;
213
+ margin: 0 0 0.5em 0;
214
+ font-size: 1.2em;
215
+ line-height: 1.25em;
216
+ }
217
+
218
+ .method .sourcecode p.source-link {
219
+ text-indent: 0em;
220
+ margin-top: 0.5em;
221
+ }
222
+
223
+ .method .aka {
224
+ margin-top: 0.3em;
225
+ margin-left: 1em;
226
+ font-style: italic;
227
+ text-indent: 2em;
228
+ }
229
+
230
+ .method .source-link
231
+ {
232
+ font-size: 0.85em;
233
+ }