sdoc 0.2.12.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.
Files changed (45) hide show
  1. data/LICENSE +21 -0
  2. data/README.rdoc +38 -0
  3. data/Rakefile +37 -0
  4. data/VERSION.yml +4 -0
  5. data/bin/sdoc +11 -0
  6. data/bin/sdoc-merge +12 -0
  7. data/lib/rdoc/discover.rb +1 -0
  8. data/lib/sdoc.rb +23 -0
  9. data/lib/sdoc/c_parser_fix.rb +31 -0
  10. data/lib/sdoc/generator/shtml.rb +314 -0
  11. data/lib/sdoc/generator/template/direct/_context.rhtml +172 -0
  12. data/lib/sdoc/generator/template/direct/class.rhtml +40 -0
  13. data/lib/sdoc/generator/template/direct/file.rhtml +30 -0
  14. data/lib/sdoc/generator/template/direct/index.rhtml +14 -0
  15. data/lib/sdoc/generator/template/direct/resources/css/main.css +263 -0
  16. data/lib/sdoc/generator/template/direct/resources/css/panel.css +383 -0
  17. data/lib/sdoc/generator/template/direct/resources/css/reset.css +53 -0
  18. data/lib/sdoc/generator/template/direct/resources/i/arrows.png +0 -0
  19. data/lib/sdoc/generator/template/direct/resources/i/results_bg.png +0 -0
  20. data/lib/sdoc/generator/template/direct/resources/i/tree_bg.png +0 -0
  21. data/lib/sdoc/generator/template/direct/resources/js/jquery-1.3.2.min.js +19 -0
  22. data/lib/sdoc/generator/template/direct/resources/js/jquery-effect.js +593 -0
  23. data/lib/sdoc/generator/template/direct/resources/js/main.js +22 -0
  24. data/lib/sdoc/generator/template/direct/resources/js/searchdoc.js +620 -0
  25. data/lib/sdoc/generator/template/direct/resources/panel/index.html +71 -0
  26. data/lib/sdoc/generator/template/merge/index.rhtml +14 -0
  27. data/lib/sdoc/generator/template/shtml/_context.rhtml +164 -0
  28. data/lib/sdoc/generator/template/shtml/class.rhtml +46 -0
  29. data/lib/sdoc/generator/template/shtml/file.rhtml +37 -0
  30. data/lib/sdoc/generator/template/shtml/index.rhtml +14 -0
  31. data/lib/sdoc/generator/template/shtml/resources/css/main.css +191 -0
  32. data/lib/sdoc/generator/template/shtml/resources/css/panel.css +383 -0
  33. data/lib/sdoc/generator/template/shtml/resources/css/reset.css +53 -0
  34. data/lib/sdoc/generator/template/shtml/resources/i/arrows.png +0 -0
  35. data/lib/sdoc/generator/template/shtml/resources/i/results_bg.png +0 -0
  36. data/lib/sdoc/generator/template/shtml/resources/i/tree_bg.png +0 -0
  37. data/lib/sdoc/generator/template/shtml/resources/js/jquery-1.3.2.min.js +19 -0
  38. data/lib/sdoc/generator/template/shtml/resources/js/main.js +34 -0
  39. data/lib/sdoc/generator/template/shtml/resources/js/searchdoc.js +620 -0
  40. data/lib/sdoc/generator/template/shtml/resources/panel/index.html +71 -0
  41. data/lib/sdoc/github.rb +64 -0
  42. data/lib/sdoc/helpers.rb +26 -0
  43. data/lib/sdoc/merge.rb +217 -0
  44. data/lib/sdoc/templatable.rb +58 -0
  45. metadata +117 -0
@@ -0,0 +1,71 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
+ <head>
7
+ <title>layout</title>
8
+ <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" charset="utf-8" />
9
+ <link rel="stylesheet" href="../css/panel.css" type="text/css" media="screen" charset="utf-8" />
10
+ <script src="search_index.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="tree.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="../js/searchdoc.js" type="text/javascript" charset="utf-8"></script>
14
+ <script type="text/javascript" charset="utf-8">
15
+ //<![CDATA[
16
+ function placeholder() {
17
+ if (jQuery.browser.safari) return;
18
+ $('#search-label').click(function() {
19
+ $('#search').focus();
20
+ $('#search-label').hide();
21
+ });
22
+
23
+ $('#search').focus(function() {
24
+ $('#search-label').hide();
25
+ });
26
+ $('#search').blur(function() {
27
+ this.value == '' && $('#search-label').show()
28
+ });
29
+
30
+ $('#search')[0].value == '' && $('#search-label').show();
31
+ }
32
+ $(function() {
33
+ placeholder();
34
+ var panel = new Searchdoc.Panel($('#panel'), search_data, tree, top.frames[1]);
35
+ $('#search').focus();
36
+
37
+ var s = window.parent.location.search.match(/\?q=(.*)$/);
38
+ if (s) {
39
+ s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
40
+ if (s.length > 0)
41
+ {
42
+ $('#search').val(s);
43
+ panel.search(s, true);
44
+ }
45
+ }
46
+ })
47
+ //]]>
48
+ </script>
49
+ </head>
50
+ <body>
51
+ <div class="panel panel_tree" id="panel">
52
+ <div class="header">
53
+ <div>
54
+ <label for="search" id="search-label" style="display: none">Search</label>
55
+ <table>
56
+ <tr><td>
57
+ <input type="Search" placeholder="Search" autosave="searchdoc" results="10" id="search" autocomplete="off"/>
58
+ </td></tr>
59
+ </table></div>
60
+ </div>
61
+ <div class="tree">
62
+ <ul>
63
+ </ul>
64
+ </div>
65
+ <div class="result">
66
+ <ul>
67
+ </ul>
68
+ </div>
69
+ </div>
70
+ </body>
71
+ </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=utf-8"/>
7
+
8
+ <title><%= @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,164 @@
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 @options.show_all || 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
+ <%# TODO delete this dirty hack when documentation for example for JavaScriptHelper will not be cutted off by <script> tag %>
127
+ <%= description.gsub('<script>'){ |m| h(m) } %>
128
+ </div>
129
+ <% end %>
130
+ <% unless method.aliases.empty? %>
131
+ <div class="aka">
132
+ This method is also aliased as
133
+ <% method.aliases.each do |aka| %>
134
+ <a href="<%= context.aref_to aka.path %>"><%= h aka.name %></a>
135
+ <% end %>
136
+ </div>
137
+ <% end %>
138
+ <% if method.token_stream %>
139
+ <% markup = method.markup_code %>
140
+ <div class="sourcecode">
141
+ <p class="source-link">
142
+ Source: <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
143
+ <%
144
+ if markup =~ /File\s(\S+), line (\d+)/
145
+ path = $1
146
+ line = $2.to_i
147
+ end
148
+ github = github_url(path)
149
+ if github
150
+ %>
151
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
152
+ <% end %>
153
+ </p>
154
+ <div id="<%= method.aref %>_source" class="dyn-source">
155
+ <pre><%= method.markup_code %></pre>
156
+ </div>
157
+ </div>
158
+ <% end %>
159
+ </div>
160
+ <% end
161
+ end
162
+ end
163
+ %>
164
+ </div>
@@ -0,0 +1,46 @@
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/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="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/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=<%= @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,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
+ }