morph-sdoc 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.rvmrc +2 -0
  2. data/LICENSE +21 -0
  3. data/README.rdoc +37 -0
  4. data/Rakefile +51 -0
  5. data/VERSION.yml +5 -0
  6. data/bin/sdoc +11 -0
  7. data/bin/sdoc-merge +12 -0
  8. data/lib/rdoc/discover.rb +1 -0
  9. data/lib/sdoc.rb +16 -0
  10. data/lib/sdoc/c_parser_fix.rb +31 -0
  11. data/lib/sdoc/generator/shtml.rb +352 -0
  12. data/lib/sdoc/generator/template/direct/_context.rhtml +172 -0
  13. data/lib/sdoc/generator/template/direct/class.rhtml +40 -0
  14. data/lib/sdoc/generator/template/direct/file.rhtml +30 -0
  15. data/lib/sdoc/generator/template/direct/index.rhtml +14 -0
  16. data/lib/sdoc/generator/template/direct/resources/apple-touch-icon.png +0 -0
  17. data/lib/sdoc/generator/template/direct/resources/css/main.css +278 -0
  18. data/lib/sdoc/generator/template/direct/resources/css/panel.css +383 -0
  19. data/lib/sdoc/generator/template/direct/resources/css/reset.css +53 -0
  20. data/lib/sdoc/generator/template/direct/resources/favicon.ico +0 -0
  21. data/lib/sdoc/generator/template/direct/resources/i/arrows.png +0 -0
  22. data/lib/sdoc/generator/template/direct/resources/i/results_bg.png +0 -0
  23. data/lib/sdoc/generator/template/direct/resources/i/tree_bg.png +0 -0
  24. data/lib/sdoc/generator/template/direct/resources/js/jquery-1.3.2.min.js +19 -0
  25. data/lib/sdoc/generator/template/direct/resources/js/jquery-effect.js +593 -0
  26. data/lib/sdoc/generator/template/direct/resources/js/main.js +22 -0
  27. data/lib/sdoc/generator/template/direct/resources/js/searchdoc.js +628 -0
  28. data/lib/sdoc/generator/template/direct/resources/panel/index.html +71 -0
  29. data/lib/sdoc/generator/template/merge/index.rhtml +14 -0
  30. data/lib/sdoc/generator/template/shtml/_context.rhtml +164 -0
  31. data/lib/sdoc/generator/template/shtml/class.rhtml +46 -0
  32. data/lib/sdoc/generator/template/shtml/file.rhtml +37 -0
  33. data/lib/sdoc/generator/template/shtml/index.rhtml +14 -0
  34. data/lib/sdoc/generator/template/shtml/resources/apple-touch-icon.png +0 -0
  35. data/lib/sdoc/generator/template/shtml/resources/css/main.css +191 -0
  36. data/lib/sdoc/generator/template/shtml/resources/css/panel.css +383 -0
  37. data/lib/sdoc/generator/template/shtml/resources/css/reset.css +53 -0
  38. data/lib/sdoc/generator/template/shtml/resources/favicon.ico +0 -0
  39. data/lib/sdoc/generator/template/shtml/resources/i/arrows.png +0 -0
  40. data/lib/sdoc/generator/template/shtml/resources/i/results_bg.png +0 -0
  41. data/lib/sdoc/generator/template/shtml/resources/i/tree_bg.png +0 -0
  42. data/lib/sdoc/generator/template/shtml/resources/js/jquery-1.3.2.min.js +19 -0
  43. data/lib/sdoc/generator/template/shtml/resources/js/main.js +34 -0
  44. data/lib/sdoc/generator/template/shtml/resources/js/searchdoc.js +628 -0
  45. data/lib/sdoc/generator/template/shtml/resources/panel/index.html +71 -0
  46. data/lib/sdoc/github.rb +61 -0
  47. data/lib/sdoc/helpers.rb +26 -0
  48. data/lib/sdoc/json_backend.rb +15 -0
  49. data/lib/sdoc/merge.rb +217 -0
  50. data/lib/sdoc/options.rb +329 -0
  51. data/lib/sdoc/templatable.rb +58 -0
  52. data/sdoc.gemspec +93 -0
  53. metadata +151 -0
@@ -0,0 +1,172 @@
1
+ <div id="content">
2
+ <% unless (desc = context.description).empty? %>
3
+ <div class="description">
4
+ <%= desc %>
5
+ </div>
6
+ <% end %>
7
+
8
+ <% unless context.requires.empty? %>
9
+ <div class="sectiontitle">Required Files</div>
10
+ <ul>
11
+ <% context.requires.each do |req| %>
12
+ <li><%= h req.name %></li>
13
+ <% end %>
14
+ </ul>
15
+ <% end %>
16
+
17
+ <% sections = context.sections.select { |section| section.title } %>
18
+ <% unless sections.empty? %>
19
+ <div class="sectiontitle">Contents</div>
20
+ <ul>
21
+ <% sections.each do |section| %>
22
+ <li><a href="#<%= section.sequence %>"><%= h section.title %></a></li>
23
+ <% end %>
24
+ </ul>
25
+ <% end %>
26
+
27
+ <%
28
+ list = context.method_list
29
+ unless @options.show_all
30
+ list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
31
+ end
32
+ %>
33
+ <% unless list.empty? %>
34
+ <div class="sectiontitle">Methods</div>
35
+ <dl class="methods">
36
+ <% each_letter_group(list) do |group| %>
37
+ <dt><%= group[:name] %></dt>
38
+ <dd>
39
+ <ul>
40
+ <% group[:methods].each_with_index do |method, i| %>
41
+ <li><a href="#<%= method.aref %>"><%= method.name %></a><%= ',' unless group[:methods].size == i+1 %></li>
42
+ <% end %>
43
+ </ul>
44
+ </dd>
45
+ <% end %>
46
+ </dl>
47
+ <% end %>
48
+
49
+ <% unless context.includes.empty? %>
50
+ <div class="sectiontitle">Included Modules</div>
51
+ <ul>
52
+ <% context.includes.each do |inc| %>
53
+ <li>
54
+ <% unless String === inc.module %>
55
+ <a href="<%= context.aref_to inc.module.path %>"><%= h inc.module.full_name %></a>
56
+ <% else %>
57
+ <span><%= h inc.name %></span>
58
+ <% end %>
59
+ START:includes
60
+ </li>
61
+ <% end %>
62
+ </ul>
63
+ <% end %>
64
+
65
+ <% sections.each do |section| %>
66
+ <div class="sectiontitle"><a name="<%= h section.sequence %>"><%= h section.title %></a></div>
67
+ <% unless (description = section.description).empty? %>
68
+ <div class="description">
69
+ <%= description %>
70
+ </div>
71
+ <% end %>
72
+ <% end %>
73
+
74
+ <% unless context.classes_and_modules.empty? %>
75
+ <div class="sectiontitle">Classes and Modules</div>
76
+ <ul>
77
+ <% (context.modules.sort + context.classes.sort).each do |mod| %>
78
+ <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a></li>
79
+ <% end %>
80
+ </ul>
81
+ <% end %>
82
+
83
+ <% unless context.constants.empty? %>
84
+ <div class="sectiontitle">Constants</div>
85
+ <table border='0' cellpadding='5'>
86
+ <% context.each_constant do |const| %>
87
+ <tr valign='top'>
88
+ <td class="attr-name"><%= h const.name %></td>
89
+ <td>=</td>
90
+ <td class="attr-value"><%= h const.value %></td>
91
+ </tr>
92
+ <% unless (description = const.description).empty? %>
93
+ <tr valign='top'>
94
+ <td>&nbsp;</td>
95
+ <td colspan="2" class="attr-desc"><%= description %></td>
96
+ </tr>
97
+ <% end %>
98
+ <% end %>
99
+ </table>
100
+ <% end %>
101
+
102
+ <% unless context.attributes.empty? %>
103
+ <div class="sectiontitle">Attributes</div>
104
+ <table border='0' cellpadding='5'>
105
+ <% context.each_attribute do |attrib| %>
106
+ <tr valign='top'>
107
+ <td class='attr-rw'>
108
+ [<%= attrib.rw %>]
109
+ </td>
110
+ <td class='attr-name'><%= h attrib.name %></td>
111
+ <td class='attr-desc'><%= attrib.description.strip %></td>
112
+ </tr>
113
+ <% end %>
114
+ </table>
115
+ <% end %>
116
+
117
+ <% context.methods_by_type.each do |type, visibilities|
118
+ next if visibilities.empty?
119
+ visibilities.each do |visibility, methods|
120
+ next if methods.empty?
121
+ next unless @options.show_all || visibility == :public || visibility == :protected || methods.any? {|m| m.force_documentation }
122
+ %>
123
+ <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
124
+ <% methods.each do |method| %>
125
+ <div class="method">
126
+ <div class="title" id="<%= method.aref %>">
127
+ <% if method.call_seq %>
128
+ <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
129
+ <% else %>
130
+ <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
131
+ <% end %>
132
+ </div>
133
+ <% unless (description = method.description).empty? %>
134
+ <div class="description">
135
+ <%= description %>
136
+ </div>
137
+ <% end %>
138
+ <% unless method.aliases.empty? %>
139
+ <div class="aka">
140
+ This method is also aliased as
141
+ <% method.aliases.each do |aka| %>
142
+ <a href="<%= context.aref_to aka.path %>"><%= h aka.name %></a>
143
+ <% end %>
144
+ </div>
145
+ <% end %>
146
+ <% if method.token_stream && @options.open_source %>
147
+ <% markup = method.markup_code %>
148
+ <div class="sourcecode">
149
+ <p class="source-link">
150
+ Source: <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
151
+ <%
152
+ if markup =~ /File\s(\S+), line (\d+)/
153
+ path = $1
154
+ line = $2.to_i
155
+ end
156
+ github = github_url(path)
157
+ if github
158
+ %>
159
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
160
+ <% end %>
161
+ </p>
162
+ <div id="<%= method.aref %>_source" class="dyn-source">
163
+ <pre><%= method.markup_code %></pre>
164
+ </div>
165
+ </div>
166
+ <% end %>
167
+ </div>
168
+ <% end
169
+ end
170
+ end
171
+ %>
172
+ </div>
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title><%= h klass.full_name %></title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.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,30 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title><%= h file.name %></title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.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
+ <%= h file.name %>
19
+ </h1>
20
+ <ul class="files">
21
+ <li><%= h file.relative_name %></li>
22
+ <li>Last modified: <%= file.file_stat.mtime %></li>
23
+ </ul>
24
+ </div>
25
+
26
+ <div id="bodyContent">
27
+ <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
28
+ </div>
29
+ </body>
30
+ </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=<%= @options.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,278 @@
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: 2.1em;
26
+ font-weight: normal;
27
+ line-height: 1.2em;
28
+ margin: 1.4em 0 0.7em 0;
29
+ }
30
+
31
+ h2 {
32
+ font-size: 1.6em;
33
+ margin: 1.8em 0 0.8em 0;
34
+ font-weight: normal;
35
+ line-height: 1.2em;
36
+ }
37
+
38
+ h3 {
39
+ font-size: 1.4em;
40
+ color:#555;
41
+ margin: 1.4em 0 0.7em 0;
42
+ font-weight: normal;
43
+ }
44
+
45
+ h4 {
46
+ margin: 1.4em 0 0.5em 0;
47
+ font-size: 1em;
48
+ }
49
+
50
+ table
51
+ {
52
+ margin-bottom: 1em;
53
+ }
54
+
55
+ td, th
56
+ {
57
+ padding: 0 0.7em 0.3em 0;
58
+ }
59
+
60
+ th
61
+ {
62
+ font-weight: bold;
63
+ }
64
+
65
+ .clear
66
+ {
67
+ clear: both;
68
+ width: 0; height: 0;
69
+ }
70
+
71
+ dt
72
+ {
73
+ margin-bottom: 0.3em;
74
+ font-weight: bold;
75
+ }
76
+
77
+ dd
78
+ {
79
+ margin-left: 2em;
80
+ margin-bottom: 1em;
81
+ }
82
+
83
+ dd p
84
+ {
85
+ margin-top: 0.6em;
86
+ }
87
+
88
+ li
89
+ {
90
+ margin: 0 0 0.5em 2em;
91
+ }
92
+
93
+ ul li
94
+ {
95
+ list-style: disc;
96
+ }
97
+
98
+ ol li
99
+ {
100
+ list-style: decimal;
101
+ }
102
+
103
+ .banner
104
+ {
105
+ background: #EDF3FE;
106
+ border-bottom: 1px solid #ccc;
107
+ padding: 1em 2em 0.5em 2em;
108
+ }
109
+ .banner h1
110
+ {
111
+ font-size: 1.2em;
112
+ margin: 0;
113
+ }
114
+
115
+ .banner h1 .type
116
+ {
117
+ font-size: 0.833em;
118
+ display:block;
119
+ }
120
+
121
+ .banner h1 .type,
122
+ .banner h1 .parent
123
+ {
124
+ color: #666;
125
+ }
126
+
127
+ .banner ul
128
+ {
129
+ margin-top: 0.3em;
130
+ margin-bottom: 0;
131
+ font-size: 0.85em;
132
+ }
133
+
134
+ .banner li
135
+ {
136
+ list-style: none;
137
+ margin-left: 0;
138
+ margin-bottom: 0;
139
+ }
140
+
141
+ pre
142
+ {
143
+ margin-bottom: 1em;
144
+ }
145
+
146
+ .methods dt
147
+ {
148
+ width: 1em;
149
+ font-size: 1.5em;
150
+ color:#AAA;
151
+ position: absolute;
152
+ font-weight: normal;
153
+ margin: 0;
154
+ }
155
+
156
+ .methods dd
157
+ {
158
+ margin-left: 2.5em;
159
+ min-height: 1.8em;
160
+ -height: 1.8em;
161
+ padding-bottom: 0.8em;
162
+ }
163
+
164
+
165
+ .methods ul li
166
+ {
167
+ margin-right: 0.7em;
168
+ margin-left: 0;
169
+ list-style: none;
170
+ display: inline;
171
+ }
172
+
173
+ #content {
174
+ margin: 2em;
175
+ margin-left: 3.5em;
176
+ margin-right: 3.5em;
177
+ }
178
+
179
+
180
+ .sectiontitle {
181
+ margin-top: 2em;
182
+ margin-bottom: 1.3em;
183
+ margin-left: -1.2em;
184
+ font-size: 1.2em;
185
+ padding: 0 0 0.25em 0;
186
+ font-weight: bold;
187
+ border-bottom: 1px solid #000;
188
+ }
189
+
190
+ .attr-rw {
191
+ padding-right: 1em;
192
+ text-align: center;
193
+ color: #055;
194
+ }
195
+
196
+ .attr-name {
197
+ font-weight: bold;
198
+ padding-right: 1em;
199
+ }
200
+
201
+ .attr-desc {
202
+ }
203
+
204
+ tt {
205
+ font-size: 1.15em;
206
+ }
207
+
208
+ .attr-value {
209
+ font-family: monospace;
210
+ padding-left: 1em;
211
+ font-size: 1.15em;
212
+ }
213
+
214
+ .dyn-source {
215
+ display: none;
216
+ background: #fffde8;
217
+ color: #000;
218
+ border: #ffe0bb dotted 1px;
219
+ margin: 0.5em 2em 0.5em 0;
220
+ padding: 0.5em;
221
+ }
222
+
223
+ .dyn-source .cmt {
224
+ color: #00F;
225
+ font-style: italic;
226
+ }
227
+
228
+ .dyn-source .kw {
229
+ color: #070;
230
+ font-weight: bold;
231
+ }
232
+
233
+ .description pre {
234
+ padding: 0.5em;
235
+ border: #ffe0bb dotted 1px;
236
+ background: #fffde8;
237
+ }
238
+
239
+ .method {
240
+ margin-bottom: 2em;
241
+ }
242
+ .method .description,
243
+ .method .sourcecode
244
+ {
245
+ margin-left: 1.2em;
246
+ }
247
+ .method h4
248
+ {
249
+ border-bottom: 1px dotted #999;
250
+ padding: 0 0 0.2em 0;
251
+ margin-bottom: 0.8em;
252
+ font-size: 1.1em;
253
+ color:#333;
254
+ }
255
+ .method .title {
256
+ border-bottom: 1px dotted #666;
257
+ padding: 0 0 0.15em 0;
258
+ margin: 0 0 0.5em 0;
259
+ font-size: 1.2em;
260
+ line-height: 1.25em;
261
+ }
262
+
263
+ .method .sourcecode p.source-link {
264
+ text-indent: 0em;
265
+ margin-top: 0.5em;
266
+ }
267
+
268
+ .method .aka {
269
+ margin-top: 0.3em;
270
+ margin-left: 1em;
271
+ font-style: italic;
272
+ text-indent: 2em;
273
+ }
274
+
275
+ .method .source-link
276
+ {
277
+ font-size: 0.85em;
278
+ }