sdoc 1.1.0 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -2
  3. data/CHANGELOG.md +29 -0
  4. data/README.md +18 -0
  5. data/config.ru +30 -0
  6. data/lib/rdoc/generator/template/rails/_head.rhtml +39 -6
  7. data/lib/rdoc/generator/template/rails/_panel.rhtml +14 -0
  8. data/lib/rdoc/generator/template/rails/class.rhtml +8 -7
  9. data/lib/rdoc/generator/template/rails/file.rhtml +6 -3
  10. data/lib/rdoc/generator/template/rails/index.rhtml +25 -5
  11. data/lib/rdoc/generator/template/rails/resources/css/main.css +8 -4
  12. data/lib/rdoc/generator/template/rails/resources/css/panel.css +18 -14
  13. data/lib/rdoc/generator/template/rails/resources/i/arrow-down-current.svg +8 -0
  14. data/lib/rdoc/generator/template/rails/resources/i/arrow-right-current.svg +8 -0
  15. data/lib/rdoc/generator/template/rails/resources/js/jquery-3.5.1.min.js +2 -0
  16. data/lib/rdoc/generator/template/rails/resources/js/main.js +22 -6
  17. data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +25 -6
  18. data/lib/rdoc/generator/template/rails/resources/js/turbolinks.js +6 -0
  19. data/lib/rdoc/generator/template/rails/search_index.rhtml +5 -2
  20. data/lib/rdoc/generator/template/sdoc/class.rhtml +2 -4
  21. data/lib/rdoc/generator/template/sdoc/file.rhtml +2 -4
  22. data/lib/rdoc/generator/template/sdoc/index.rhtml +2 -4
  23. data/lib/rdoc/generator/template/sdoc/resources/panel/index.html +1 -1
  24. data/lib/rdoc/generator/template/sdoc/search_index.rhtml +5 -2
  25. data/lib/sdoc/generator.rb +14 -6
  26. data/lib/sdoc/templatable.rb +5 -1
  27. data/lib/sdoc/version.rb +1 -1
  28. data/sdoc.gemspec +2 -0
  29. metadata +23 -5
  30. data/lib/rdoc/generator/template/rails/resources/js/jquery-1.3.2.min.js +0 -19
  31. data/lib/rdoc/generator/template/rails/resources/panel/index.html +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19f36e49016466f31b053d9a66c757e33998e7023ddad39f2d86f46834fd4784
4
- data.tar.gz: 36b2ca06033e0caecb8b5bbcf61210a5bd7139b1f66919b112c1af738fa3d0b0
3
+ metadata.gz: b8d4b29d6331f29ea069228638d3acdf6f0cda3894526984025b3ae62eea2523
4
+ data.tar.gz: 7d5d3d5048e21d0cfa869d28a3963289efa457b6d52ca38c852f486ba33a382a
5
5
  SHA512:
6
- metadata.gz: 837f60a6d4880c4fa5e1000c5216377a1827aab83f0ec2ecffccd903533215a3b4a972beec2a2ec0c3a9332bde5d05477f3c066da950d8eda3776f41f950f5fc
7
- data.tar.gz: 965695dcc2e8e9c2e8ea1a608be79549767a719f607721f3364a72b5b5398c48ccd6f9d19d992954565fcf40b9d31922083a98e30760ad628b1558e1315c5e57
6
+ metadata.gz: fe1810f968c179d72c4d22bdcb79097217566c52f4cc50ac2904e443a0dddc205065e06f9bcaea18be36e485a95a565bea96103e45503fffbbfaec8c4482db21
7
+ data.tar.gz: 24fa176a0ed31025b545f80652b936fa224be2bfa013b6ff5969eb3ee33d6221f2066ec48901cafc5cc8effbbe4281b17f120c5833574eac915693ff3bf0dd89
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  before_install:
4
- - gem update --system
5
- - gem install bundler
4
+ - gem update --system || gem update --system 2.7.8
5
+ - gem install bundler || gem install bundler -v 1.17.3
6
6
  rvm:
7
7
  - 1.9.3
8
8
  - 2.0.0
@@ -11,6 +11,7 @@ rvm:
11
11
  - 2.3.7
12
12
  - 2.4.4
13
13
  - 2.5.1
14
+ - 2.6.0
14
15
  - ruby-head
15
16
  - jruby-head
16
17
  matrix:
@@ -22,6 +23,7 @@ matrix:
22
23
  - { rvm: 2.3.7, env: rdoc=master }
23
24
  - { rvm: 2.4.4, env: rdoc=master }
24
25
  - { rvm: 2.5.1, env: rdoc=master }
26
+ - { rvm: 2.6.0, env: rdoc=master }
25
27
  - { rvm: ruby-head, env: rdoc=master }
26
28
  - { rvm: jruby-head, env: rdoc=master }
27
29
  notifications:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ 2.0.4
2
+ =====
3
+
4
+ * #149 Using HTML5 doctype accross all HTML files. [@MikeRogers0](https://github.com/MikeRogers0)
5
+ * #148 Fix overflow CSS property of panel elements. [@cveneziani](https://github.com/cveneziani)
6
+
7
+ 2.0.3
8
+ =====
9
+
10
+ * #147 Use @options.title for the index [@p8](https://github.com/p8)
11
+
12
+ 2.0.2
13
+ =====
14
+
15
+ * Remove accidental rack inclusion in gemspec
16
+
17
+ 2.0.1
18
+ =====
19
+
20
+ * #142 Fix arrow icons for selected panel items [@p8](https://github.com/p8)
21
+ * #141 Always use only one metatag for keywords [@p8](https://github.com/p8)
22
+ * #140 Use h2 instead of h1 for banner header [@p8](https://github.com/p8)
23
+
24
+ 2.0.0
25
+ =====
26
+
27
+ * #137 Replace frames based implementation with a css [@p8](https://github.com/p8)
28
+ * #132 Deprecate safe_level of ERB.new in Ruby 2.6
29
+
1
30
  1.1.0
2
31
  =====
3
32
 
data/README.md CHANGED
@@ -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/config.ru ADDED
@@ -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,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,31 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="<%= @options.charset %>">
5
4
  <title><%= @options.title %></title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
6
+ <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix, tree_keys: []} %>
6
7
  </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>
8
+
9
+ <body>
10
+
11
+ <%= include_template '_panel.rhtml' %>
12
+
13
+ <div class="banner">
14
+ <% if ENV['HORO_PROJECT_NAME'] %>
15
+ <span><%= ERB::Util.html_escape(ENV['HORO_PROJECT_NAME']) %> <%= ERB::Util.html_escape(ENV['HORO_PROJECT_VERSION']) %></span><br />
16
+ <% end %>
17
+ <h2>
18
+ <%= h index.name %>
19
+ </h2>
20
+ <ul class="files">
21
+ <li><%= h index.relative_name %></li>
22
+ <li>Last modified: <%= index.last_modified %></li>
23
+ </ul>
24
+ </div>
25
+
26
+ <div id="bodyContent">
27
+ <%= include_template '_context.rhtml', {:context => index } %>
28
+ </div>
29
+ </body>
11
30
  </html>
31
+
@@ -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,11 +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: hidden;
32
+ overflow-x: hidden;
33
33
  }
34
34
 
35
35
  .panel .header input
@@ -52,12 +52,12 @@
52
52
  /* Results (begin) */
53
53
  .panel .result
54
54
  {
55
- position: absolute;
56
- top: 40px;
55
+ position: relative;
57
56
  bottom: 0;
57
+ top: 40px;
58
58
  left: 0;
59
59
  width: 100%;
60
- overflow-y: scroll;
60
+ overflow-y: auto;
61
61
  overflow-x: hidden;
62
62
  z-index: 2;
63
63
  }
@@ -74,6 +74,7 @@
74
74
  overflow: hidden;
75
75
  padding: 4px 10px 0 10px;
76
76
  cursor: pointer;
77
+ margin: 0;
77
78
  }
78
79
 
79
80
  .panel .result ul li:nth-child(2n) {
@@ -85,6 +86,7 @@
85
86
  font-size: 13px;
86
87
  font-weight: normal;
87
88
  color: #333;
89
+ margin-top: 0;
88
90
  margin-bottom: 2px;
89
91
  white-space: nowrap;
90
92
  }
@@ -217,12 +219,12 @@
217
219
  .panel .tree
218
220
  {
219
221
  background: white;
220
- position: absolute;
222
+ position: relative;
221
223
  top: 40px;
222
224
  bottom: 0;
223
225
  left: 0;
224
226
  width: 100%;
225
- overflow-y: scroll;
227
+ overflow-y: auto;
226
228
  overflow-x: hidden;
227
229
  z-index: 30;
228
230
  }
@@ -239,6 +241,7 @@
239
241
  overflow: hidden;
240
242
  height: 30px;
241
243
  line-height: 100%;
244
+ margin: 0;
242
245
  }
243
246
 
244
247
 
@@ -274,6 +277,7 @@
274
277
  font-size: 13px;
275
278
  font-weight: normal;
276
279
  color: #000;
280
+ margin-top: 0;
277
281
  margin-bottom: 2px;
278
282
  white-space: nowrap;
279
283
  }
@@ -316,13 +320,13 @@
316
320
 
317
321
  .panel .tree ul li.current .icon
318
322
  {
319
- background: url(../i/arrow-right.svg);
323
+ background: url(../i/arrow-down-current.svg);
320
324
  background-size: 10px;
321
325
  }
322
326
 
323
327
  .panel .tree ul li.current.closed .icon
324
328
  {
325
- background: url(../i/arrow-down.svg);
329
+ background: url(../i/arrow-right-current.svg);
326
330
  background-size: 10px;
327
331
  }
328
332