sdoc 1.0.0.rc2 → 1.0.0.rc3

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/Rakefile +1 -0
  4. data/lib/rdoc/generator/template/rails/_context.rhtml +216 -0
  5. data/lib/rdoc/generator/template/rails/_head.rhtml +6 -0
  6. data/lib/rdoc/generator/template/rails/class.rhtml +50 -0
  7. data/lib/rdoc/generator/template/rails/file.rhtml +35 -0
  8. data/lib/rdoc/generator/template/rails/index.rhtml +11 -0
  9. data/lib/rdoc/generator/template/rails/resources/apple-touch-icon.png +0 -0
  10. data/lib/rdoc/generator/template/rails/resources/css/github.css +123 -0
  11. data/lib/rdoc/generator/template/rails/resources/css/main.css +363 -0
  12. data/lib/rdoc/generator/template/rails/resources/css/panel.css +360 -0
  13. data/lib/rdoc/generator/template/rails/resources/css/reset.css +48 -0
  14. data/lib/rdoc/generator/template/rails/resources/favicon.ico +0 -0
  15. data/lib/rdoc/generator/template/rails/resources/i/arrow-down.svg +8 -0
  16. data/lib/rdoc/generator/template/rails/resources/i/arrow-right.svg +8 -0
  17. data/lib/rdoc/generator/template/rails/resources/i/search.svg +12 -0
  18. data/lib/rdoc/generator/template/rails/resources/i/tree_bg.svg +8 -0
  19. data/lib/rdoc/generator/template/rails/resources/js/highlight.pack.js +1 -0
  20. data/lib/rdoc/generator/template/rails/resources/js/jquery-1.3.2.min.js +19 -0
  21. data/lib/rdoc/generator/template/rails/resources/js/main.js +25 -0
  22. data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +465 -0
  23. data/lib/rdoc/generator/template/rails/resources/panel/index.html +47 -0
  24. data/lib/rdoc/generator/template/rails/search_index.rhtml +8 -0
  25. data/lib/rdoc/generator/template/sdoc/_head.rhtml +0 -1
  26. data/lib/rdoc/generator/template/sdoc/class.rhtml +13 -0
  27. data/lib/rdoc/generator/template/sdoc/resources/css/main.css +11 -1
  28. data/lib/rdoc/generator/template/sdoc/resources/js/main.js +7 -1
  29. data/lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js +21 -2
  30. data/lib/sdoc/helpers.rb +22 -0
  31. data/lib/sdoc/version.rb +1 -1
  32. data/spec/helpers_spec.rb +30 -0
  33. metadata +7 -7
  34. data/lib/rdoc/generator/template/sdoc/resources/js/jquery-effect.js +0 -593
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd8f108539b22e091aee84678e782138bb18aa53
4
- data.tar.gz: 6155efbb4da708d34160dd72c7b3d6cc961713fc
3
+ metadata.gz: 120a6beabf68f2666569422df6ec1016eed0bd0c
4
+ data.tar.gz: 031417023b90f2454f88667848fecd9d681e244a
5
5
  SHA512:
6
- metadata.gz: 1f279d16a4661525a966e664a26572e787e53383c91dd050a8a24037b277fd005394c48cb0856d495a15b36928c035d50872c28909fce411440b540639c81572
7
- data.tar.gz: 5ed8e231e52ac56ba9f959780cb2307637e35d85d02b193de0d369b67af50bd512d0235bc800d1037e1b7f0c84489168d5c99eb5fa24f1dfacd873affcd686da
6
+ metadata.gz: ba5f3f336a41df54bb8354d422c01a7a7b039f9924f24563dfb0577b7540cb0ba131c239ab3d074bd2acc136adc05b7fdcc616a0d0409c525dcc1c1f18f62447
7
+ data.tar.gz: f405fc8f95d5c64fbcb0686b30f790dca1374f70d066dfde434425aa9e0a76131acf1898b8c86b0443a8f5bde3cd01498e6f7ea225d39080526ead3008cd7410
data/.gitignore CHANGED
@@ -6,4 +6,4 @@ doc
6
6
  Gemfile.lock
7
7
  /.rake_tasks~
8
8
  /*.gem
9
- rails/
9
+ /rails/
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ require 'rake/testtask'
7
7
 
8
8
  Rake::TestTask.new do |t|
9
9
  t.pattern = "spec/*_spec.rb"
10
+ t.libs << "spec"
10
11
  end
11
12
 
12
13
  task :default => :test
@@ -0,0 +1,216 @@
1
+ <div id="content">
2
+ <% unless (description = context.description).empty? %>
3
+ <div class="description">
4
+ <%= description %>
5
+ </div>
6
+ <% end %>
7
+
8
+
9
+ <% unless context.requires.empty? %>
10
+ <!-- File only: requires -->
11
+ <div class="sectiontitle">Required Files</div>
12
+ <ul>
13
+ <% context.requires.each do |req| %>
14
+ <li><%= h req.name %></li>
15
+ <% end %>
16
+ </ul>
17
+ <% end %>
18
+
19
+
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>
24
+ <ul>
25
+ <% sections.each do |section| %>
26
+ <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
27
+ <% end %>
28
+ </ul>
29
+ <% end %>
30
+
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 -->
48
+ <div class="sectiontitle">Methods</div>
49
+ <dl class="methods">
50
+ <% each_letter_group(context.method_list) do |group| %>
51
+ <dt><%= group[:name] %></dt>
52
+ <dd>
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>
63
+ </dd>
64
+ <% end %>
65
+ </dl>
66
+ <% end %>
67
+
68
+ <% unless context.includes.empty? %>
69
+ <!-- Includes -->
70
+ <div class="sectiontitle">Included Modules</div>
71
+ <ul>
72
+ <% context.includes.each do |inc| %>
73
+ <li>
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 %>
81
+ </li>
82
+ <% end %>
83
+ </ul>
84
+ <% end %>
85
+
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>
94
+ <% end %>
95
+
96
+ <% if section.comment then %>
97
+ <div class="description">
98
+ <%= section.description %>
99
+ </div>
100
+ <% end %>
101
+
102
+ <% unless constants.empty? %>
103
+ <!-- Section constants -->
104
+ <div class="sectiontitle">Constants</div>
105
+ <table border='0' cellpadding='5'>
106
+ <% context.each_constant do |const| %>
107
+ <tr valign='top'>
108
+ <td class="attr-name"><%= h const.name %></td>
109
+ <td>=</td>
110
+ <td class="attr-value"><%= h const.value %></td>
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 %>
118
+ <% end %>
119
+ </table>
120
+ <% end %>
121
+
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'>
129
+ <td class='attr-rw'>
130
+ [<%= attrib.rw %>]
131
+ </td>
132
+ <td class='attr-name'><%= h attrib.name %></td>
133
+ <td class='attr-desc'><%= attrib.description.strip %></td>
134
+ </tr>
135
+ <% end %>
136
+ </table>
137
+ <% end %>
138
+
139
+
140
+ <!-- Methods -->
141
+ <%
142
+ context.methods_by_type(section).each do |type, visibilities|
143
+ next if visibilities.empty?
144
+
145
+ visibilities.each do |visibility, methods|
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
+ <b><%= method.call_seq.gsub(/->/, '&rarr;').gsub(/\n(.)/, '<br />\1') %></b>
154
+ <% else %>
155
+ <b><%= h method.name %></b><%= h method.params %>
156
+ <% end %>
157
+ <a href="<%= "#{rel_prefix}/#{context.path}##{method.aref}"%>" name="<%= method.aref %>" class="permalink">Link</a>
158
+ </div>
159
+
160
+ <% if method.comment %>
161
+ <div class="description">
162
+ <%= method.description.strip %>
163
+ </div>
164
+ <% end %>
165
+
166
+ <% unless method.aliases.empty? %>
167
+ <div class="aka">
168
+ Also aliased as: <%= method.aliases.map do |aka|
169
+ if aka.parent then # HACK lib/rexml/encodings
170
+ %{<a href="#{context.aref_to aka.path}">#{h aka.name}</a>}
171
+ else
172
+ h aka.name
173
+ end
174
+ end.join ", " %>
175
+ </div>
176
+ <% end %>
177
+
178
+ <% if method.is_alias_for then %>
179
+ <div class="aka">
180
+ Alias for: <a href="<%= context.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
181
+ </div>
182
+ <% end %>
183
+
184
+ <% if method.token_stream %>
185
+ <% markup = method.sdoc_markup_code %>
186
+ <div class="sourcecode">
187
+ <%
188
+ # generate github link
189
+ github = if options.github
190
+ if markup =~ /File\s(\S+), line (\d+)/
191
+ path = $1
192
+ line = $2.to_i
193
+ end
194
+ path && github_url(path)
195
+ else
196
+ false
197
+ end
198
+ %>
199
+ <p class="source-link">
200
+ Source:
201
+ <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
202
+ <% if github %>
203
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
204
+ <% end %>
205
+ </p>
206
+ <div id="<%= method.aref %>_source" class="dyn-source">
207
+ <pre><%= markup %></pre>
208
+ </div>
209
+ </div>
210
+ <% end %>
211
+ </div>
212
+ <% end #methods.each %>
213
+ <% end #visibilities.each %>
214
+ <% end #context.methods_by_type %>
215
+ <% end #context.each_section %>
216
+ </div>
@@ -0,0 +1,6 @@
1
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/reset.css" %>" type="text/css" media="screen" />
2
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/main.css" %>" type="text/css" media="screen" />
3
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/github.css" %>" type="text/css" media="screen" />
4
+ <script src="<%= "#{rel_prefix}/js/jquery-1.3.2.min.js" %>" type="text/javascript" charset="utf-8"></script>
5
+ <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8"></script>
6
+ <script src="<%= "#{rel_prefix}/js/highlight.pack.js" %>" type="text/javascript" charset="utf-8"></script>
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= h klass.full_name %></title>
5
+ <meta charset="<%= @options.charset %>" />
6
+ <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
7
+
8
+ <meta property="og:title" value="<%= klass.full_name %>">
9
+
10
+ <% unless (description = klass.description).empty? %>
11
+ <% human_desc = truncate(strip_tags(description.gsub("\n", " ").strip)) %>
12
+ <meta name="description" content="<%= human_desc %>">
13
+ <meta property="og:description" content="<%= human_desc %>">
14
+ <% end %>
15
+
16
+ <meta name="keywords" content="<%= klass.full_name %> class">
17
+ <% unless klass.method_list.empty? %>
18
+ <meta name="keywords" content="<%= klass.method_list.map(&:name).join(", ") %>">
19
+ <% end %>
20
+ </head>
21
+
22
+ <body>
23
+ <div class="banner">
24
+ <% if ENV['HORO_PROJECT_NAME'] %>
25
+ <span><%= ERB::Util.html_escape(ENV['HORO_PROJECT_NAME']) %> <%= ERB::Util.html_escape(ENV['HORO_PROJECT_VERSION']) %></span><br />
26
+ <% end %>
27
+ <h1>
28
+ <span class="type"><%= klass.module? ? 'Module' : 'Class' %></span>
29
+ <%= h klass.full_name %>
30
+ <% if klass.type == 'class' %>
31
+ <span class="parent">&lt;
32
+ <% if String === klass.superclass %>
33
+ <%= klass.superclass %>
34
+ <% elsif !klass.superclass.nil? %>
35
+ <a href="<%= klass.aref_to klass.superclass.path %>"><%= h klass.superclass.full_name %></a>
36
+ <% end %>
37
+ </span>
38
+ <% end %>
39
+ </h1>
40
+ <ul class="files">
41
+ <% klass.in_files.each do |file| %>
42
+ <li><a href="<%= "#{rel_prefix}/#{h file.path}" %>"><%= h file.absolute_name %></a></li>
43
+ <% end %>
44
+ </ul>
45
+ </div>
46
+ <div id="bodyContent">
47
+ <%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
48
+ </div>
49
+ </body>
50
+ </html>
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= h file.name %></title>
5
+ <meta charset="<%= @options.charset %>" />
6
+ <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
7
+ </head>
8
+
9
+ <body>
10
+ <div class="banner">
11
+ <% if ENV['HORO_PROJECT_NAME'] %>
12
+ <span><%= ERB::Util.html_escape(ENV['HORO_PROJECT_NAME']) %> <%= ERB::Util.html_escape(ENV['HORO_PROJECT_VERSION']) %></span><br />
13
+ <% end %>
14
+ <h1>
15
+ <%= h file.name %>
16
+ </h1>
17
+ <ul class="files">
18
+ <%
19
+ github = github_url(file.relative_name) if options.github
20
+ %>
21
+ <li>
22
+ <%= h file.relative_name %>
23
+ <% if github %>
24
+ <a href="<%= github %>" target="_blank" class="github_url">on GitHub</a>
25
+ <% end %>
26
+ </li>
27
+ <li>Last modified: <%= file.file_stat.mtime %></li>
28
+ </ul>
29
+ </div>
30
+
31
+ <div id="bodyContent">
32
+ <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
33
+ </div>
34
+ </body>
35
+ </html>
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="<%= @options.charset %>">
5
+ <title><%= @options.title %></title>
6
+ </head>
7
+ <frameset cols="300,*" frameborder="1" border="1" bordercolor="#999999" framespacing="1">
8
+ <frame src="panel/index.html" title="Search" name="panel" />
9
+ <frame src="<%= index_path %>" name="docwin" />
10
+ </frameset>
11
+ </html>
@@ -0,0 +1,123 @@
1
+ /*
2
+
3
+ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
4
+
5
+ */
6
+
7
+ pre .comment,
8
+ pre .template_comment,
9
+ pre .diff .header,
10
+ pre .javadoc {
11
+ color: #998;
12
+ font-style: italic
13
+ }
14
+
15
+ pre .keyword,
16
+ pre .css .rule .keyword,
17
+ pre .winutils,
18
+ pre .javascript .title,
19
+ pre .lisp .title,
20
+ pre .subst {
21
+ color: #000;
22
+ font-weight: bold
23
+ }
24
+
25
+ pre .number,
26
+ pre .hexcolor {
27
+ color: #40a070
28
+ }
29
+
30
+ pre .string,
31
+ pre .tag .value,
32
+ pre .phpdoc,
33
+ pre .tex .formula {
34
+ color: #d14
35
+ }
36
+
37
+ pre .title,
38
+ pre .id {
39
+ color: #900;
40
+ font-weight: bold
41
+ }
42
+
43
+ pre .javascript .title,
44
+ pre .lisp .title,
45
+ pre .subst {
46
+ font-weight: normal
47
+ }
48
+
49
+ pre .class .title,
50
+ pre .haskell .label,
51
+ pre .tex .command {
52
+ color: #458;
53
+ font-weight: bold
54
+ }
55
+
56
+ pre .tag,
57
+ pre .tag .title,
58
+ pre .rules .property,
59
+ pre .django .tag .keyword {
60
+ color: #000080;
61
+ font-weight: normal
62
+ }
63
+
64
+ pre .attribute,
65
+ pre .variable,
66
+ pre .instancevar,
67
+ pre .lisp .body {
68
+ color: #008080
69
+ }
70
+
71
+ pre .regexp {
72
+ color: #009926
73
+ }
74
+
75
+ pre .class {
76
+ color: #458;
77
+ font-weight: bold
78
+ }
79
+
80
+ pre .symbol,
81
+ pre .ruby .symbol .string,
82
+ pre .ruby .symbol .keyword,
83
+ pre .ruby .symbol .keymethods,
84
+ pre .lisp .keyword,
85
+ pre .tex .special,
86
+ pre .input_number {
87
+ color: #990073
88
+ }
89
+
90
+ pre .builtin,
91
+ pre .built_in,
92
+ pre .lisp .title {
93
+ color: #0086b3
94
+ }
95
+
96
+ pre .preprocessor,
97
+ pre .pi,
98
+ pre .doctype,
99
+ pre .shebang,
100
+ pre .cdata {
101
+ color: #999;
102
+ font-weight: bold
103
+ }
104
+
105
+ pre .deletion {
106
+ background: #fdd
107
+ }
108
+
109
+ pre .addition {
110
+ background: #dfd
111
+ }
112
+
113
+ pre .diff .change {
114
+ background: #0086b3
115
+ }
116
+
117
+ pre .chunk {
118
+ color: #aaa
119
+ }
120
+
121
+ pre .tex .formula {
122
+ opacity: 0.5;
123
+ }