voloko-sdoc 0.0.5 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/README +1 -1
  2. data/bin/sdoc +0 -1
  3. data/bin/sdoc-merge +12 -0
  4. data/lib/sdoc.rb +15 -7
  5. data/lib/sdoc/generator/shtml.rb +671 -0
  6. data/lib/sdoc/generator/template/shtml/_context.rhtml +163 -0
  7. data/lib/sdoc/generator/template/shtml/class.rhtml +46 -0
  8. data/lib/sdoc/generator/template/shtml/file.rhtml +37 -0
  9. data/lib/sdoc/generator/template/shtml/index.rhtml +14 -0
  10. data/lib/sdoc/generator/template/shtml/resources/css/main.css +191 -0
  11. data/lib/sdoc/{generators/template/shtml/resources/css/master-frameset.css → generator/template/shtml/resources/css/panel.css} +83 -2
  12. data/lib/sdoc/{generators → generator}/template/shtml/resources/css/reset.css +0 -0
  13. data/lib/sdoc/{generators → generator}/template/shtml/resources/i/arrows.png +0 -0
  14. data/lib/sdoc/{generators → generator}/template/shtml/resources/i/results_bg.png +0 -0
  15. data/lib/sdoc/{generators → generator}/template/shtml/resources/i/tree_bg.png +0 -0
  16. data/lib/sdoc/{generators → generator}/template/shtml/resources/js/jquery-1.3.2.min.js +0 -0
  17. data/lib/sdoc/generator/template/shtml/resources/js/main.js +34 -0
  18. data/lib/sdoc/generator/template/shtml/resources/js/searchdoc.js +600 -0
  19. data/lib/sdoc/{generators/template/shtml/resources/panel.html → generator/template/shtml/resources/panel/index.html} +6 -6
  20. data/lib/sdoc/github.rb +64 -0
  21. data/lib/sdoc/merge.rb +166 -0
  22. metadata +117 -19
  23. data/lib/sdoc/code_objects.rb +0 -17
  24. data/lib/sdoc/generators/shtml_generator.rb +0 -354
  25. data/lib/sdoc/generators/template/shtml/resources/js/searchdoc.js +0 -595
  26. data/lib/sdoc/generators/template/shtml/shtml.rb +0 -615
  27. data/lib/sdoc/options.rb +0 -61
  28. data/test/options_test.rb +0 -33
  29. data/test/sdoc_test.rb +0 -7
@@ -0,0 +1,163 @@
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
+ <ul>
34
+ <% list.sort{ |a, b| a.name <=> b.name }.each do |method| %>
35
+ <li><a href="#<%= method.aref %>"><%= method.name %></a></li>
36
+ <% end %>
37
+ </ul>
38
+ <% end %>
39
+
40
+ <% unless context.includes.empty? %>
41
+ <div class="sectiontitle">Included Modules</div>
42
+ <ul>
43
+ <% context.includes.each do |inc| %>
44
+ <li>
45
+ <% unless String === inc.module %>
46
+ <a href="<%= context.aref_to inc.module.path %>"><%= h inc.module.full_name %></a>
47
+ <% else %>
48
+ <span><%= h inc.name %></span>
49
+ <% end %>
50
+ START:includes
51
+ </li>
52
+ <% end %>
53
+ </ul>
54
+ <% end %>
55
+
56
+ <% sections.each do |section| %>
57
+ <div class="sectiontitle"><a name="<%= h section.sequence %>"><%= h section.title %></a></div>
58
+ <% unless (description = section.description).empty? %>
59
+ <div class="description">
60
+ <%= description %>
61
+ </div>
62
+ <% end %>
63
+ <% end %>
64
+
65
+ <% unless context.classes_and_modules.empty? %>
66
+ <div class="sectiontitle">Classes and Modules</div>
67
+ <ul>
68
+ <% (context.modules.sort + context.classes.sort).each do |mod| %>
69
+ <li><span class="type"><%= mod.type.upcase %></span> <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a></li>
70
+ <% end %>
71
+ </ul>
72
+ <% end %>
73
+
74
+ <% unless context.constants.empty? %>
75
+ <div class="sectiontitle">Constants</div>
76
+ <table border='0' cellpadding='5'>
77
+ <% context.each_constant do |const| %>
78
+ <tr valign='top'>
79
+ <td class="attr-name"><%= h const.name %></td>
80
+ <td>=</td>
81
+ <td class="attr-value"><%= h const.value %></td>
82
+ </tr>
83
+ <% unless (description = const.description).empty? %>
84
+ <tr valign='top'>
85
+ <td>&nbsp;</td>
86
+ <td colspan="2" class="attr-desc"><%= description %></td>
87
+ </tr>
88
+ <% end %>
89
+ <% end %>
90
+ </table>
91
+ <% end %>
92
+
93
+ <% unless context.attributes.empty? %>
94
+ <div class="sectiontitle">Attributes</div>
95
+ <table border='0' cellpadding='5'>
96
+ <% context.each_attribute do |attrib| %>
97
+ <tr valign='top'>
98
+ <td class='attr-rw'>
99
+ [<%= attrib.rw %>]
100
+ </td>
101
+ <td class='attr-name'><%= h attrib.name %></td>
102
+ <td class='attr-desc'><%= attrib.description.strip %></td>
103
+ </tr>
104
+ <% end %>
105
+ </table>
106
+ <% end %>
107
+
108
+ <% context.methods_by_type.each do |type, visibilities|
109
+ next if visibilities.empty?
110
+ visibilities.each do |visibility, methods|
111
+ next if methods.empty?
112
+ next unless visibility == :public || visibility == :protected || methods.any? {|m| m.force_documentation }
113
+ %>
114
+ <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
115
+ <% methods.each do |method| %>
116
+ <div class="method">
117
+ <div class="title">
118
+ <% if method.call_seq %>
119
+ <a name="<%= method.aref %>"></a><b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
120
+ <% else %>
121
+ <a name="<%= method.aref %>"></a><b><%= h method.name %></b><%= h method.params %>
122
+ <% end %>
123
+ </div>
124
+ <% unless (description = method.description).empty? %>
125
+ <div class="description">
126
+ <%= description %>
127
+ </div>
128
+ <% end %>
129
+ <% unless method.aliases.empty? %>
130
+ <div class="aka">
131
+ This method is also aliased as
132
+ <% method.aliases.each do |aka| %>
133
+ <a href="<%= context.aref_to aka.path %>"><%= h aka.name %></a>
134
+ <% end %>
135
+ </div>
136
+ <% end %>
137
+ <% if method.token_stream %>
138
+ <% markup = method.markup_code %>
139
+ <div class="sourcecode">
140
+ <p class="source-link">
141
+ Source: <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
142
+ <%
143
+ if markup =~ /File\s(\S+), line (\d+)/
144
+ path = $1
145
+ line = $2.to_i
146
+ end
147
+ github = github_url(path)
148
+ if github
149
+ %>
150
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
151
+ <% end %>
152
+ </p>
153
+ <div id="<%= method.aref %>_source" class="dyn-source">
154
+ <pre><%= method.markup_code %></pre>
155
+ </div>
156
+ </div>
157
+ <% end %>
158
+ </div>
159
+ <% end
160
+ end
161
+ end
162
+ %>
163
+ </div>
@@ -0,0 +1,46 @@
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/main.css" %>" type="text/css" media="screen" />
9
+ <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8"></script>
10
+ </head>
11
+
12
+ <body>
13
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'>
14
+ <tr>
15
+ <td class="file-title"><span class="file-title-prefix"><%= klass.module? ? 'Module' : 'Class' %></span><br /><%= h klass.full_name %></td>
16
+ <td align="right">
17
+ <table cellspacing="0" cellpadding="2">
18
+ <tr valign="top">
19
+ <td>In:</td>
20
+ <td>
21
+ <% klass.in_files.each do |file| %>
22
+ <a href="<%= "#{rel_prefix}/#{h file.path}" %>"><%= h file.absolute_name %></a>
23
+ <% end %>
24
+ </td>
25
+ </tr>
26
+ <% if klass.type == 'class' %>
27
+ <tr>
28
+ <td>Parent:</td>
29
+ <td>
30
+ <% if String === klass.superclass %>
31
+ <%= klass.superclass %>
32
+ <% elsif !klass.superclass.nil? %>
33
+ <a href="<%= klass.aref_to klass.superclass.path %>"><%= h klass.superclass.full_name %></a>
34
+ <% end %>
35
+ </td>
36
+ </tr>
37
+ <% end %>
38
+ </table>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ <div id="bodyContent">
43
+ <%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
44
+ </div>
45
+ </body>
46
+ </html>
@@ -0,0 +1,37 @@
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/main.css" %>" type="text/css" media="screen" />
9
+ <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8"></script>
10
+ </head>
11
+
12
+ <body>
13
+ <table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
14
+ <tr><td>
15
+ <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
16
+ <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br /><%= h file.name %></td>
17
+ <td align="right">
18
+ <table border='0' cellspacing="0" cellpadding="2">
19
+ <tr>
20
+ <td>Path:</td>
21
+ <td><%= h file.relative_name %></td>
22
+ </tr>
23
+ <tr>
24
+ <td>Modified:</td>
25
+ <td><%= file.file_stat.mtime %></td>
26
+ </tr>
27
+ </table>
28
+ </td></tr>
29
+ </table>
30
+ </td></tr>
31
+ </table><br />
32
+
33
+ <div id="bodyContent">
34
+ <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
35
+ </div>
36
+ </body>
37
+ </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,191 @@
1
+ a {
2
+ color: #00F;
3
+ text-decoration: none;
4
+ }
5
+
6
+ a:hover {
7
+ color: #77F;
8
+ text-decoration: underline;
9
+ }
10
+
11
+ body, td, p {
12
+ font-family: "Bitstream Vera Sans", Verdana, Arial, Helvetica, sans-serif;
13
+ background: #FFF;
14
+ color: #000;
15
+ margin: 0px;
16
+ font-size: small;
17
+ }
18
+
19
+ p {
20
+ margin-top: 0.5em;
21
+ margin-bottom: 0.5em;
22
+ }
23
+
24
+ #content {
25
+ margin: 2em;
26
+ margin-left: 3.5em;
27
+ margin-right: 3.5em;
28
+ }
29
+
30
+ #description p {
31
+ margin-bottom: 0.5em;
32
+ }
33
+
34
+ .sectiontitle {
35
+ margin-top: 1em;
36
+ margin-bottom: 1em;
37
+ padding: 0.5em;
38
+ padding-left: 2em;
39
+ background: #005;
40
+ color: #FFF;
41
+ font-weight: bold;
42
+ }
43
+
44
+ .attr-rw {
45
+ padding-left: 1em;
46
+ padding-right: 1em;
47
+ text-align: center;
48
+ color: #055;
49
+ }
50
+
51
+ .attr-name {
52
+ font-weight: bold;
53
+ }
54
+
55
+ .attr-desc {
56
+ }
57
+
58
+ .attr-desc p {
59
+ margin-top: 0;
60
+ }
61
+
62
+ .attr-value {
63
+ font-family: monospace;
64
+ }
65
+
66
+ .file-title-prefix {
67
+ font-size: large;
68
+ }
69
+
70
+ .file-title {
71
+ font-size: large;
72
+ font-weight: bold;
73
+ background: #005;
74
+ color: #FFF;
75
+ }
76
+
77
+ .banner {
78
+ background: #005;
79
+ color: #FFF;
80
+ border: 1px solid black;
81
+ padding: 1em;
82
+ }
83
+
84
+ .banner td {
85
+ background: transparent;
86
+ color: #FFF;
87
+ }
88
+
89
+ h1 a, h2 a, .sectiontitle a, .banner a {
90
+ color: #FF0;
91
+ }
92
+
93
+ h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover {
94
+ color: #FF7;
95
+ }
96
+
97
+ .dyn-source {
98
+ display: none;
99
+ background: #fffde8;
100
+ color: #000;
101
+ border: #ffe0bb dotted 1px;
102
+ margin: 0.5em 2em 0.5em 2em;
103
+ padding: 0.5em;
104
+ }
105
+
106
+ .dyn-source .cmt {
107
+ color: #00F;
108
+ font-style: italic;
109
+ }
110
+
111
+ .dyn-source .kw {
112
+ color: #070;
113
+ font-weight: bold;
114
+ }
115
+
116
+ .method {
117
+ margin-left: 1em;
118
+ margin-right: 1em;
119
+ margin-bottom: 1em;
120
+ }
121
+
122
+ .description pre {
123
+ padding: 0.5em;
124
+ border: #ffe0bb dotted 1px;
125
+ background: #fffde8;
126
+ }
127
+
128
+ .method .title {
129
+ font-family: monospace;
130
+ font-size: large;
131
+ border-bottom: 1px dashed black;
132
+ margin-bottom: 0.3em;
133
+ padding-bottom: 0.1em;
134
+ }
135
+
136
+ .method .description, .method .sourcecode {
137
+ margin-left: 1em;
138
+ }
139
+
140
+ .description p, .sourcecode p {
141
+ margin-bottom: 0.5em;
142
+ }
143
+
144
+ .method .sourcecode p.source-link {
145
+ text-indent: 0em;
146
+ margin-top: 0.5em;
147
+ }
148
+
149
+ .method .aka {
150
+ margin-top: 0.3em;
151
+ margin-left: 1em;
152
+ font-style: italic;
153
+ text-indent: 2em;
154
+ }
155
+
156
+ h1 {
157
+ padding: 1em;
158
+ margin-left: -1.5em;
159
+ font-size: x-large;
160
+ font-weight: bold;
161
+ color: #FFF;
162
+ background: #007;
163
+ }
164
+
165
+ h2 {
166
+ padding: 0.5em 1em 0.5em 1em;
167
+ margin-left: -1.5em;
168
+ font-size: large;
169
+ font-weight: bold;
170
+ color: #FFF;
171
+ background: #009;
172
+ }
173
+
174
+ h3, h4, h5, h6 {
175
+ color: #220088;
176
+ border-bottom: #5522bb solid 1px;
177
+ }
178
+
179
+ .sourcecode > pre {
180
+ padding: 0.5em;
181
+ border: 1px dotted black;
182
+ background: #FFE;
183
+ }
184
+
185
+ dt {
186
+ font-weight: bold
187
+ }
188
+
189
+ dd {
190
+ margin-bottom: 0.7em;
191
+ }