sdoc 1.0.0 → 2.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 29716368d7c072908ecc4b13c04570fe435166e6
4
- data.tar.gz: 706d48301caebca63b188da2033a7dee963bfaa8
2
+ SHA256:
3
+ metadata.gz: 234ba541d36b61d2b4bb680ab8df4e2463d4cc63f0517f160270a3e7a48f0f81
4
+ data.tar.gz: afae81f60c7f9218da174c06cb4d5799f7c0db8e5188c6dc49c54ea3bacb5dc3
5
5
  SHA512:
6
- metadata.gz: 94539d716999ecf5b07ba5b93a2974e5fdc22b8f231449195c70129a74856e4ce9ef68bfff8d80ded0bcf4852b14be66110510fa62a7a4200dc04620f3ce0203
7
- data.tar.gz: 42a050c73aa5ab6fc403d3b4f37fd66261b9edb78b974ec2bf2b76289f9734e3ce8b4e8a348a0d6e0743b89ff924dcf571cddf1a078ddbe051fc5f310eb90abc
6
+ metadata.gz: 3b24a3309f283113f8b0f0cd1e2e0d7711a40a293612599499f09b6d6793f25669e9aa0f9925ef9d844a31a89be30f296fdd8f47d3161a8f24629d5d2f41b99c
7
+ data.tar.gz: f5355d4fd9d7aa0478db5c6aa398502c1480ece246f811b795721471e15eddc74dafe7640cca5de2e32751a65d5fcea0d156933aa2eabc691d1daba222428fdd
@@ -1,15 +1,17 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  before_install:
4
- - gem install bundler
4
+ - gem update --system || gem update --system 2.7.8
5
+ - gem install bundler || gem install bundler -v 1.17.3
5
6
  rvm:
6
7
  - 1.9.3
7
8
  - 2.0.0
8
9
  - 2.1.0
9
- - 2.2.9
10
- - 2.3.6
11
- - 2.4.2
12
- - 2.5.0
10
+ - 2.2.10
11
+ - 2.3.7
12
+ - 2.4.4
13
+ - 2.5.1
14
+ - 2.6.0
13
15
  - ruby-head
14
16
  - jruby-head
15
17
  matrix:
@@ -17,10 +19,11 @@ matrix:
17
19
  - env: rdoc=master
18
20
  - rvm: jruby-head
19
21
  include:
20
- - { rvm: 2.2.9, env: rdoc=master }
21
- - { rvm: 2.3.6, env: rdoc=master }
22
- - { rvm: 2.4.2, env: rdoc=master }
23
- - { rvm: 2.5.0, env: rdoc=master }
22
+ - { rvm: 2.2.10, env: rdoc=master }
23
+ - { rvm: 2.3.7, env: rdoc=master }
24
+ - { rvm: 2.4.4, env: rdoc=master }
25
+ - { rvm: 2.5.1, env: rdoc=master }
26
+ - { rvm: 2.6.0, env: rdoc=master }
24
27
  - { rvm: ruby-head, env: rdoc=master }
25
28
  - { rvm: jruby-head, env: rdoc=master }
26
29
  notifications:
@@ -1,3 +1,44 @@
1
+ 2.0.3
2
+ =====
3
+
4
+ * Use @options.title for the index
5
+
6
+ 2.0.2
7
+ =====
8
+
9
+ * Remove accidental rack inclusion in gemspec
10
+
11
+ 2.0.1
12
+ =====
13
+
14
+ * #142 Fix arrow icons for selected panel items
15
+ * #141 Always use only one metatag for keywords
16
+ * #140 Use h2 instead of h1 for banner header
17
+
18
+ 2.0.0
19
+ =====
20
+
21
+ * #137 Replace frames based implementation with a css
22
+ * #132 Deprecate safe_level of ERB.new in Ruby 2.6
23
+
24
+ 1.1.0
25
+ =====
26
+
27
+ * #138 - Fix panel header overflow on Chrome
28
+ * 39e6cae9 - Display version using `-v` or `--version` flags
29
+
30
+ 1.0.0
31
+ =====
32
+
33
+ * #110 - Strip out HTML tags from search results description
34
+ * #109 - Add basic SEO tags
35
+ * #108 - Tiny refresh of the Rails theme
36
+ * e6f02b91 - Remove the jQuery effect library
37
+ * 73ace366 - Remove the `--without-search` option
38
+ * b1d429f2 - Produce HTML 5 output
39
+ * 38d06095 - Support only RDoc 5 and up
40
+ * #96 - Require at least Ruby 1.9.3
41
+
1
42
  0.4.2
2
43
  =====
3
44
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SDoc
2
2
 
3
- [![Build Status](https://travis-ci.org/zzak/sdoc.png?branch=master)](https://travis-ci.org/zzak/sdoc)
3
+ [![Build Status](https://travis-ci.org/zzak/sdoc.svg?branch=master)](https://travis-ci.org/zzak/sdoc)
4
4
 
5
5
  **Powering http://api.rubyonrails.org/**
6
6
 
@@ -62,9 +62,9 @@ require 'sdoc' # and use your RDoc task the same way you used it before
62
62
  require 'rdoc/task' # ensure this file is also required in order to use `RDoc::Task`
63
63
 
64
64
  RDoc::Task.new do |rdoc|
65
- rdoc.rdoc_dir = 'doc/rdoc' # name of output directory
66
- rdoc.generator = 'sdoc' # explictly set the sdoc generator
67
- rdoc.template = 'rails' # template used on api.rubyonrails.org
65
+ rdoc.rdoc_dir = 'doc/rdoc' # name of output directory
66
+ rdoc.options << '--format=sdoc' # explictly set the sdoc generator
67
+ rdoc.template = 'rails' # template used on api.rubyonrails.org
68
68
  end
69
69
  ```
70
70
 
@@ -78,7 +78,7 @@ Alternatively you can pass this command a path to the project you wish to compil
78
78
 
79
79
  As mentioned before, SDoc is built on top of the RDoc project.
80
80
 
81
- If you notice any bugs in the output of your documentation, it may be RDoc's fault and should be [reported upstream](https://github.com/rdoc/rdoc/issues/new).
81
+ If you notice any bugs in the output of your documentation, it may be RDoc's fault and should be [reported upstream](https://github.com/ruby/rdoc/issues/new).
82
82
 
83
83
  An example of an SDoc bug would be:
84
84
 
@@ -90,6 +90,24 @@ Please feel free to still report issues here for both projects, especially if yo
90
90
 
91
91
  As maintainer of both projects, I'll see if I can identify the root of the cause :bow: :bow: :bow:
92
92
 
93
+ ## Contributing
94
+
95
+ If you'd like to contribute you can generate the Rails documentation by running:
96
+
97
+ ```bash
98
+ rake test:rails
99
+ ```
100
+
101
+ This task will generate documentation for the Rails master branch.
102
+ Since the task doesn't do any file filtering it contains a lot of extra pages.
103
+
104
+ To view the just generated documentation start up a rack application by running:
105
+
106
+ ```bash
107
+ rackup config.ru
108
+ ```
109
+
110
+ Then open http://localhost:9292 in the browser to view the documentation.
93
111
 
94
112
  ### Who?
95
113
 
data/bin/sdoc CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby -KU
1
+ #!/usr/bin/env ruby
2
2
  require 'sdoc'
3
3
 
4
4
  begin
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby -KU
1
+ #!/usr/bin/env ruby
2
2
  require File.dirname(__FILE__) + '/../lib/sdoc' # add extensions
3
3
  require 'sdoc/merge'
4
4
 
@@ -0,0 +1,30 @@
1
+ # Rack application for serving the documentation locally.
2
+ # After generating the documentation run:
3
+ #
4
+ # bundle exec rackup config.ru
5
+ #
6
+ require 'bundler/setup'
7
+
8
+ root = "doc/rails"
9
+ unless Dir.exists?(root)
10
+ puts <<~MESSAGE
11
+ Could not find any docs in #{root}.
12
+ Run the following command to generate sample documentation:
13
+ bundle exec rake test:rails
14
+ MESSAGE
15
+ exit
16
+ end
17
+
18
+ use Rack::Static,
19
+ :urls => ["/files", "/images", "/js", "/css", "/panel", "/i", "/classes"],
20
+ :root => root
21
+ run lambda { |env|
22
+ [
23
+ 200,
24
+ {
25
+ 'Content-Type' => 'text/html',
26
+ 'Cache-Control' => 'public, max-age=86400'
27
+ },
28
+ File.open("#{root}/index.html", File::RDONLY)
29
+ ]
30
+ }
@@ -1,5 +1,5 @@
1
1
  begin
2
- gem 'rdoc', '~> 5.0'
2
+ gem 'rdoc', '>= 5.0'
3
3
  require File.join(File.dirname(__FILE__), '/../sdoc')
4
4
  rescue Gem::LoadError
5
5
  end
@@ -1,6 +1,39 @@
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>
1
+ <%
2
+ # Turbolinks does not consider relative urls similar, resulting in page
3
+ # reloads and losing the context of the panel. Emptying the rel_prefix makes
4
+ # asset paths absolute. This breaks opening the docs locally. Maybe all
5
+ # generated docs should be in the same folder?
6
+ rel_prefix = ''
7
+ %>
8
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/reset.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
9
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/panel.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
10
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/main.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
11
+ <link rel="stylesheet" href="<%= "#{rel_prefix}/css/github.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
12
+ <script src="<%= "#{rel_prefix}/js/jquery-3.5.1.min.js" %>" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
13
+ <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
14
+ <script src="<%= "#{rel_prefix}/js/highlight.pack.js" %>" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
15
+ <script src="<%= rel_prefix %>/js/turbolinks.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
16
+ <script src="<%= rel_prefix %>/js/search_index.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
17
+ <script src="<%= rel_prefix %>/js/searcher.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
18
+ <script src="<%= rel_prefix %>/panel/tree.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
19
+ <script src="<%= rel_prefix %>/js/searchdoc.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
20
+ <script type="text/javascript" charset="utf-8">
21
+ document.addEventListener("turbolinks:load", function() {
22
+ // Only initialize panel if not yet initialized
23
+ if(!$('#panel .tree ul li').length) {
24
+ $('#links').hide();
25
+ var panel = new Searchdoc.Panel($('#panel'), search_data, tree, '<%= rel_prefix %>/');
26
+ $('#search').focus();
27
+ var s = window.location.search.match(/\?q=([^&]+)/);
28
+ if (s) {
29
+ s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
30
+ if (s.length > 0) {
31
+ $('#search').val(s);
32
+ panel.search(s, true);
33
+ }
34
+ }
35
+ panel.toggle(<%= tree_keys %>);
36
+ }
37
+ })
38
+ </script>
39
+
@@ -0,0 +1,14 @@
1
+ <div class="panel panel_tree" id="panel" data-turbolinks-permanent>
2
+ <div class="header">
3
+ <input type="text" placeholder="Search for a class, method, ..." autosave="searchdoc" results="10" id="search" autocomplete="off" />
4
+ </div>
5
+ <div class="tree">
6
+ <ul>
7
+ </ul>
8
+ </div>
9
+ <div class="result">
10
+ <ul>
11
+ </ul>
12
+ </div>
13
+ <a href="links.html" id="links">index</a>
14
+ </div>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <title><%= h klass.full_name %></title>
5
5
  <meta charset="<%= @options.charset %>" />
6
- <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
6
+ <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix, :tree_keys => klass.full_name.split('::') } %>
7
7
 
8
8
  <meta property="og:title" value="<%= klass.full_name %>">
9
9
 
@@ -13,18 +13,18 @@
13
13
  <meta property="og:description" content="<%= human_desc %>">
14
14
  <% end %>
15
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 %>
16
+ <meta name="keywords" content="<%= klass.full_name %> class, <%= klass.method_list.map(&:name).join(", ") %>">
20
17
  </head>
21
18
 
22
19
  <body>
20
+
21
+ <%= include_template '_panel.rhtml' %>
22
+
23
23
  <div class="banner">
24
24
  <% if ENV['HORO_PROJECT_NAME'] %>
25
25
  <span><%= ERB::Util.html_escape(ENV['HORO_PROJECT_NAME']) %> <%= ERB::Util.html_escape(ENV['HORO_PROJECT_VERSION']) %></span><br />
26
26
  <% end %>
27
- <h1>
27
+ <h2>
28
28
  <span class="type"><%= klass.module? ? 'Module' : 'Class' %></span>
29
29
  <%= h klass.full_name %>
30
30
  <% if klass.type == 'class' %>
@@ -36,13 +36,14 @@
36
36
  <% end %>
37
37
  </span>
38
38
  <% end %>
39
- </h1>
39
+ </h2>
40
40
  <ul class="files">
41
41
  <% klass.in_files.each do |file| %>
42
42
  <li><a href="<%= "#{rel_prefix}/#{h file.path}" %>"><%= h file.absolute_name %></a></li>
43
43
  <% end %>
44
44
  </ul>
45
45
  </div>
46
+
46
47
  <div id="bodyContent">
47
48
  <%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
48
49
  </div>
@@ -3,17 +3,20 @@
3
3
  <head>
4
4
  <title><%= h file.name %></title>
5
5
  <meta charset="<%= @options.charset %>" />
6
- <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
6
+ <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix, :tree_keys => [] } %>
7
7
  </head>
8
8
 
9
9
  <body>
10
+
11
+ <%= include_template '_panel.rhtml' %>
12
+
10
13
  <div class="banner">
11
14
  <% if ENV['HORO_PROJECT_NAME'] %>
12
15
  <span><%= ERB::Util.html_escape(ENV['HORO_PROJECT_NAME']) %> <%= ERB::Util.html_escape(ENV['HORO_PROJECT_VERSION']) %></span><br />
13
16
  <% end %>
14
- <h1>
17
+ <h2>
15
18
  <%= h file.name %>
16
- </h1>
19
+ </h2>
17
20
  <ul class="files">
18
21
  <%
19
22
  github = github_url(file.relative_name) if options.github
@@ -1,11 +1,33 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
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">
3
5
  <head>
4
- <meta charset="<%= @options.charset %>">
5
6
  <title><%= @options.title %></title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
8
+ <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix, tree_keys: []} %>
6
9
  </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>
10
+
11
+ <body>
12
+
13
+ <%= include_template '_panel.rhtml' %>
14
+
15
+ <div class="banner">
16
+ <% if ENV['HORO_PROJECT_NAME'] %>
17
+ <span><%= ERB::Util.html_escape(ENV['HORO_PROJECT_NAME']) %> <%= ERB::Util.html_escape(ENV['HORO_PROJECT_VERSION']) %></span><br />
18
+ <% end %>
19
+ <h2>
20
+ <%= h index.name %>
21
+ </h2>
22
+ <ul class="files">
23
+ <li><%= h index.relative_name %></li>
24
+ <li>Last modified: <%= index.last_modified %></li>
25
+ </ul>
26
+ </div>
27
+
28
+ <div id="bodyContent">
29
+ <%= include_template '_context.rhtml', {:context => index } %>
30
+ </div>
31
+ </body>
11
32
  </html>
33
+
@@ -7,6 +7,10 @@ body {
7
7
  line-height: 1.25em;
8
8
  }
9
9
 
10
+ .banner, #bodyContent {
11
+ margin-left: 300px;
12
+ }
13
+
10
14
  a:link, a:active, a:visited, a:hover {
11
15
  color: #CC0000;
12
16
  text-decoration: none;
@@ -121,20 +125,20 @@ ol li
121
125
  padding: 1em;
122
126
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
123
127
  }
124
- .banner h1
128
+ .banner h2
125
129
  {
126
130
  font-size: 1.2em;
127
131
  margin: 0;
128
132
  }
129
133
 
130
- .banner h1 .type
134
+ .banner h2 .type
131
135
  {
132
136
  font-size: 0.833em;
133
137
  display:block;
134
138
  }
135
139
 
136
- .banner h1 .type,
137
- .banner h1 .parent
140
+ .banner h2 .type,
141
+ .banner h2 .parent
138
142
  {
139
143
  color: #CCC;
140
144
  }
@@ -1,15 +1,15 @@
1
1
  /* Panel (begin) */
2
2
  .panel
3
3
  {
4
- position: absolute;
5
- width: 100%;
4
+ position: fixed;
5
+ width: 300px;
6
6
  height: 100%;
7
- top: 0;
8
- left: 0;
9
7
  background: #FFF;
10
8
  z-index: 2;
11
9
  font-family: "Helvetica Neue", "Arial", sans-serif;
12
10
  overflow-x: hidden;
11
+ border-right: 1px #ccc solid;
12
+ line-height: 1;
13
13
  }
14
14
 
15
15
  .panel_tree .results,
@@ -25,10 +25,11 @@
25
25
  background-position: 5px;
26
26
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
27
27
  height: 40px;
28
- width: 100%;
29
- position: absolute;
28
+ width: 300px;
29
+ position: fixed;
30
30
  left: 0; top: 0;
31
31
  z-index: 300;
32
+ overflow-x: hidden;
32
33
  }
33
34
 
34
35
  .panel .header input
@@ -51,9 +52,9 @@
51
52
  /* Results (begin) */
52
53
  .panel .result
53
54
  {
54
- position: absolute;
55
- top: 40px;
55
+ position: relative;
56
56
  bottom: 0;
57
+ top: 40px;
57
58
  left: 0;
58
59
  width: 100%;
59
60
  overflow-y: scroll;
@@ -73,6 +74,7 @@
73
74
  overflow: hidden;
74
75
  padding: 4px 10px 0 10px;
75
76
  cursor: pointer;
77
+ margin: 0;
76
78
  }
77
79
 
78
80
  .panel .result ul li:nth-child(2n) {
@@ -84,6 +86,7 @@
84
86
  font-size: 13px;
85
87
  font-weight: normal;
86
88
  color: #333;
89
+ margin-top: 0;
87
90
  margin-bottom: 2px;
88
91
  white-space: nowrap;
89
92
  }
@@ -216,7 +219,7 @@
216
219
  .panel .tree
217
220
  {
218
221
  background: white;
219
- position: absolute;
222
+ position: relative;
220
223
  top: 40px;
221
224
  bottom: 0;
222
225
  left: 0;
@@ -238,6 +241,7 @@
238
241
  overflow: hidden;
239
242
  height: 30px;
240
243
  line-height: 100%;
244
+ margin: 0;
241
245
  }
242
246
 
243
247
 
@@ -273,6 +277,7 @@
273
277
  font-size: 13px;
274
278
  font-weight: normal;
275
279
  color: #000;
280
+ margin-top: 0;
276
281
  margin-bottom: 2px;
277
282
  white-space: nowrap;
278
283
  }
@@ -315,13 +320,13 @@
315
320
 
316
321
  .panel .tree ul li.current .icon
317
322
  {
318
- background: url(../i/arrow-right.svg);
323
+ background: url(../i/arrow-down-current.svg);
319
324
  background-size: 10px;
320
325
  }
321
326
 
322
327
  .panel .tree ul li.current.closed .icon
323
328
  {
324
- background: url(../i/arrow-down.svg);
329
+ background: url(../i/arrow-right-current.svg);
325
330
  background-size: 10px;
326
331
  }
327
332