sdoc 2.0.4 → 2.3.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +38 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +37 -1
  5. data/Gemfile +8 -2
  6. data/README.md +14 -4
  7. data/Rakefile +54 -2
  8. data/config.ru +3 -3
  9. data/lib/rdoc/generator/template/rails/_context.rhtml +16 -8
  10. data/lib/rdoc/generator/template/rails/_head.rhtml +14 -39
  11. data/lib/rdoc/generator/template/rails/_panel.rhtml +6 -3
  12. data/lib/rdoc/generator/template/rails/class.rhtml +5 -2
  13. data/lib/rdoc/generator/template/rails/file.rhtml +5 -2
  14. data/lib/rdoc/generator/template/rails/index.rhtml +5 -3
  15. data/lib/rdoc/generator/template/rails/resources/css/main.css +33 -6
  16. data/lib/rdoc/generator/template/rails/resources/css/panel.css +121 -4
  17. data/lib/rdoc/generator/template/rails/resources/css/reset.css +0 -1
  18. data/lib/rdoc/generator/template/rails/resources/js/main.js +17 -0
  19. data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +18 -18
  20. data/lib/rdoc/generator/template/rails/search_index.rhtml +1 -0
  21. data/lib/rdoc/generator/template/sdoc/_context.rhtml +11 -3
  22. data/lib/rdoc/generator/template/sdoc/class.rhtml +3 -2
  23. data/lib/rdoc/generator/template/sdoc/file.rhtml +3 -2
  24. data/lib/rdoc/generator/template/sdoc/index.rhtml +1 -0
  25. data/lib/rdoc/generator/template/sdoc/resources/css/reset.css +0 -1
  26. data/lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js +0 -10
  27. data/lib/rdoc/generator/template/sdoc/resources/panel/index.html +1 -0
  28. data/lib/rdoc/generator/template/sdoc/search_index.rhtml +1 -0
  29. data/lib/sdoc/generator.rb +3 -3
  30. data/lib/sdoc/merge.rb +5 -28
  31. data/lib/sdoc/templatable.rb +1 -1
  32. data/lib/sdoc/version.rb +1 -1
  33. data/netlify.toml +39 -0
  34. data/sdoc.gemspec +1 -3
  35. data/spec/helpers_spec.rb +2 -2
  36. data/spec/rdoc_generator_spec.rb +9 -9
  37. metadata +9 -17
  38. data/.travis.yml +0 -31
  39. data/lib/rdoc/generator/template/merge/index.rhtml +0 -12
@@ -1,18 +1,119 @@
1
1
  /* Panel (begin) */
2
+ .panel_checkbox, .panel_mobile_button, .panel_mobile_button_close
3
+ {
4
+ display: none;
5
+ }
6
+
7
+ @media (max-width: 39.99em) {
8
+ .panel_mobile_button {
9
+ display: block;
10
+ height: 40px;
11
+ position: sticky;
12
+ top: 0;
13
+ background: #000;
14
+ color: #fff;
15
+ padding-right: 10px;
16
+ text-align: right;
17
+ line-height: 40px;
18
+ cursor: pointer;
19
+ z-index: 2;
20
+ }
21
+ .panel_checkbox:checked ~ .panel_mobile_button {
22
+ }
23
+
24
+ .panel_checkbox:checked ~ .panel .panel_mobile_button_close {
25
+ display: block;
26
+ height: 40px;
27
+ position: absolute;
28
+ top: 0;
29
+ right: 10px;
30
+ z-index: 3000;
31
+ text-align: right;
32
+ line-height: 40px;
33
+ cursor: pointer;
34
+ }
35
+ }
36
+
37
+ .panel_mobile_button span {
38
+ position: relative;
39
+ display: inline-block;
40
+ width: 1em;
41
+ height: 0.55em;
42
+ margin-right: 0.3em;
43
+ border-top: 0.1em solid #fff;
44
+ border-bottom: 0.1em solid #fff;
45
+ }
46
+
47
+ .panel_mobile_button span:before {
48
+ content: "";
49
+ position: absolute;
50
+ top: 0.25em;
51
+ left: 0px;
52
+ width: 100%;
53
+ border-top: 0.1em solid #fff;
54
+ }
55
+
56
+ .panel_mobile_button_close span {
57
+ position: relative;
58
+ display: inline-block;
59
+ width: 1em;
60
+ height: 0.625em;
61
+ }
62
+
63
+ .panel_mobile_button_close span:before, .panel_mobile_button_close span:after {
64
+ content: "";
65
+ position: absolute;
66
+ top: 0.2em;
67
+ left: 0px;
68
+ width: 100%;
69
+ border-top: 0.1em solid #000;
70
+ }
71
+
72
+ .panel_mobile_button_close span:before {
73
+ transform: rotate(45deg);
74
+ }
75
+
76
+ .panel_mobile_button_close span:after {
77
+ transform: rotate(-45deg);
78
+ }
79
+
2
80
  .panel
3
81
  {
4
82
  position: fixed;
83
+ top: 0;
5
84
  width: 300px;
6
85
  height: 100%;
7
86
  background: #FFF;
8
- z-index: 2;
87
+ z-index: 10;
9
88
  font-family: "Helvetica Neue", "Arial", sans-serif;
10
89
  overflow-x: hidden;
11
90
  border-right: 1px #ccc solid;
12
91
  line-height: 1;
13
92
  }
14
93
 
15
- .panel_tree .results,
94
+ @media (max-width: 39.99em) {
95
+ .panel
96
+ {
97
+ transition: left 0s ease-in-out;
98
+ left: -100%;
99
+ width: 100%;
100
+ bottom: 0;
101
+ visibility: hidden;
102
+ }
103
+
104
+ .panel_checkbox:checked ~ .panel {
105
+ left: 0%;
106
+ transition: left 0.3s ease-in-out;
107
+ visibility: visible;
108
+ }
109
+
110
+ .panel_checkbox:checked ~ #bodyContent {
111
+ visibility: hidden;
112
+ display: none;
113
+ }
114
+ }
115
+
116
+ .panel_tree .result,
16
117
  .panel_results .tree
17
118
  {
18
119
  display: none;
@@ -27,11 +128,19 @@
27
128
  height: 40px;
28
129
  width: 300px;
29
130
  position: fixed;
131
+ position: sticky;
30
132
  left: 0; top: 0;
31
133
  z-index: 300;
32
134
  overflow-x: hidden;
33
135
  }
34
136
 
137
+ @media (max-width: 39.99em) {
138
+ .panel .header
139
+ {
140
+ width: 100%;
141
+ }
142
+ }
143
+
35
144
  .panel .header input
36
145
  {
37
146
  border: 0;
@@ -46,6 +155,15 @@
46
155
  outline: none;
47
156
  }
48
157
 
158
+ @media (max-width: 39.99em) {
159
+ .panel .header input
160
+ {
161
+ width: 70%;
162
+ width: calc(100% - 100px);
163
+ font-size: 16px;
164
+ }
165
+ }
166
+
49
167
  /* Header with search box (end) */
50
168
 
51
169
 
@@ -54,7 +172,7 @@
54
172
  {
55
173
  position: relative;
56
174
  bottom: 0;
57
- top: 40px;
175
+ top: 0;
58
176
  left: 0;
59
177
  width: 100%;
60
178
  overflow-y: auto;
@@ -220,7 +338,6 @@
220
338
  {
221
339
  background: white;
222
340
  position: relative;
223
- top: 40px;
224
341
  bottom: 0;
225
342
  left: 0;
226
343
  width: 100%;
@@ -13,7 +13,6 @@ table, caption, tbody, tfoot, thead, tr, th, td {
13
13
  margin: 0;
14
14
  padding: 0;
15
15
  border: 0;
16
- outline: 0;
17
16
  font-size: 100%;
18
17
  vertical-align: baseline;
19
18
  background: transparent;
@@ -27,6 +27,23 @@ document.addEventListener("turbolinks:load", function() {
27
27
  });
28
28
  });
29
29
 
30
+ document.addEventListener("turbolinks:load", function() {
31
+ // Only initialize panel if not yet initialized
32
+ if(!$('#panel .tree ul li').length) {
33
+ $('#links').hide();
34
+ var panel = new Searchdoc.Panel($('#panel'), search_data, tree);
35
+ var s = window.location.search.match(/\?q=([^&]+)/);
36
+ if (s) {
37
+ s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
38
+ if (s.length > 0) {
39
+ $('#search').val(s);
40
+ panel.search(s, true);
41
+ }
42
+ }
43
+ panel.toggle(JSON.parse($('meta[name="data-tree-keys"]').attr("content")));
44
+ }
45
+ });
46
+
30
47
  // Keep scroll position for panel
31
48
  (function() {
32
49
  var scrollTop = 0;
@@ -32,10 +32,6 @@ Searchdoc.Navigation = new function() {
32
32
  case 74: // j
33
33
  case 75: // k
34
34
  case 76: // l
35
- case 67: // c - dvorak
36
- case 72: // h
37
- case 84: // t
38
- case 78: // n
39
35
  this.clearMoveTimeout();
40
36
  break;
41
37
  }
@@ -43,15 +39,14 @@ Searchdoc.Navigation = new function() {
43
39
 
44
40
  this.onkeydown = function(e) {
45
41
  if (!this.navigationActive) return;
42
+
46
43
  switch (e.keyCode) {
47
44
  case 37: //Event.KEY_LEFT:
48
45
  case 74: // j (qwerty)
49
- case 72: // h (dvorak)
50
46
  if (this.moveLeft()) e.preventDefault();
51
47
  break;
52
48
  case 38: //Event.KEY_UP:
53
49
  case 73: // i (qwerty)
54
- case 67: // c (dvorak)
55
50
  if (e.keyCode == 38 || e.ctrlKey) {
56
51
  if (this.moveUp()) e.preventDefault();
57
52
  this.startMoveTimeout(false);
@@ -59,28 +54,31 @@ Searchdoc.Navigation = new function() {
59
54
  break;
60
55
  case 39: //Event.KEY_RIGHT:
61
56
  case 76: // l (qwerty)
62
- case 78: // n (dvorak)
63
57
  if (this.moveRight()) e.preventDefault();
64
58
  break;
65
59
  case 40: //Event.KEY_DOWN:
66
60
  case 75: // k (qwerty)
67
- case 84: // t (dvorak)
68
61
  if (e.keyCode == 40 || e.ctrlKey) {
69
62
  if (this.moveDown()) e.preventDefault();
70
63
  this.startMoveTimeout(true);
71
64
  }
72
65
  break;
73
- case 9: //Event.KEY_TAB:
74
66
  case 13: //Event.KEY_RETURN:
67
+ if(e.target.dataset["turbolinks"]) { break; }
75
68
  if (this.$current) this.select(this.$current);
76
69
  break;
77
- case 83: // s (qwerty)
78
- case 79: // o (dvorak)
70
+ case 83: // s (qwerty) - Focuses search
79
71
  if (e.ctrlKey) {
80
72
  $('#search').focus();
81
73
  e.preventDefault();
82
74
  }
83
75
  break;
76
+ case 191: // / - Search by pressing "/"
77
+ if( !$('#search').is(":focus") ) {
78
+ $('#search').focus();
79
+ e.preventDefault();
80
+ }
81
+ break;
84
82
  }
85
83
  if (e.ctrlKey && e.shiftKey) this.select(this.$current);
86
84
  };
@@ -91,7 +89,6 @@ Searchdoc.Navigation = new function() {
91
89
  };
92
90
 
93
91
  this.startMoveTimeout = function(isDown) {
94
- if (!$.browser.mozilla && !$.browser.opera) return;
95
92
  if (this.moveTimeout) this.clearMoveTimeout();
96
93
  var _this = this;
97
94
 
@@ -137,11 +134,10 @@ function scrollIntoView(element, view) {
137
134
 
138
135
  // panel.js -----------------------------------------------
139
136
 
140
- Searchdoc.Panel = function(element, data, tree, prefix) {
137
+ Searchdoc.Panel = function(element, data, tree) {
141
138
  this.$element = $(element);
142
139
  this.$input = $('input', element).eq(0);
143
140
  this.$result = $('.result ul', element).eq(0);
144
- this.prefix = prefix;
145
141
  this.$current = null;
146
142
  this.$view = this.$result.parent();
147
143
  this.data = data;
@@ -234,12 +230,17 @@ Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
234
230
  };
235
231
 
236
232
  this.open = function(src) {
237
- Turbolinks.visit(this.prefix + src);
233
+ var location = $('meta[name="data-rel-prefix"]').attr("content") + src;
234
+ if (window.location.protocol === "file:") {
235
+ window.location.href = location;
236
+ } else {
237
+ Turbolinks.visit(location);
238
+ }
238
239
  if (this.highlight) this.highlight(src);
239
240
  };
240
241
 
241
242
  this.select = function() {
242
- this.open(this.$current.data('path'));
243
+ this.open(this.$current.attr('data-path'));
243
244
  };
244
245
 
245
246
  this.move = function(isDown) {
@@ -268,7 +269,7 @@ Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
268
269
  html += hlt(result.namespace) + '</p>';
269
270
  if (result.snippet) html += '<p class="snippet">' + stripHTML(result.snippet) + '</p>';
270
271
  li.innerHTML = html;
271
- jQuery.data(li, 'path', result.path);
272
+ $(li).attr('data-path', result.path)
272
273
  return li;
273
274
  }
274
275
 
@@ -481,4 +482,3 @@ Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
481
482
  return 5 + 18 * level + 'px';
482
483
  }
483
484
  });
484
-
@@ -2,6 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title>File Index</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
6
  </head>
6
7
  <body>
7
8
  <% @files.each do |file| %>
@@ -195,12 +195,20 @@
195
195
  else
196
196
  false
197
197
  end
198
+
199
+ ghost = method.instance_of?(RDoc::GhostMethod)
198
200
  %>
199
201
  <p class="source-link">
200
- Source:
201
- <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
202
+ <% if !ghost || github %> Source: <% end %>
203
+
204
+ <% unless ghost %>
205
+ <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
206
+ <% end %>
207
+
208
+ <% if !ghost && github %> | <% end %>
209
+
202
210
  <% if github %>
203
- | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
211
+ <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
204
212
  <% end %>
205
213
  </p>
206
214
  <div id="<%= method.aref %>_source" class="dyn-source">
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <title><%= h klass.full_name %></title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
7
  <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
7
8
 
8
9
  <meta property="og:title" value="<%= klass.full_name %>">
@@ -43,8 +44,8 @@
43
44
  <% end %>
44
45
  </ul>
45
46
  </div>
46
- <div id="bodyContent">
47
+ <main id="bodyContent">
47
48
  <%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
48
- </div>
49
+ </main>
49
50
  </body>
50
51
  </html>
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <title><%= h file.name %></title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
7
  <%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
7
8
  </head>
8
9
 
@@ -20,8 +21,8 @@
20
21
  </ul>
21
22
  </div>
22
23
 
23
- <div id="bodyContent">
24
+ <main id="bodyContent">
24
25
  <%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
25
- </div>
26
+ </main>
26
27
  </body>
27
28
  </html>
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
5
5
  <title><%= @options.title %></title>
6
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
7
  </head>
7
8
  <frameset cols="300,*" frameborder="1" border="1" bordercolor="#999999" framespacing="1">
8
9
  <frame src="panel/index.html" title="Search" name="panel" />
@@ -13,7 +13,6 @@ table, caption, tbody, tfoot, thead, tr, th, td {
13
13
  margin: 0;
14
14
  padding: 0;
15
15
  border: 0;
16
- outline: 0;
17
16
  font-size: 100%;
18
17
  vertical-align: baseline;
19
18
  background: transparent;
@@ -32,10 +32,6 @@ Searchdoc.Navigation = new function() {
32
32
  case 74: // j
33
33
  case 75: // k
34
34
  case 76: // l
35
- case 67: // c - dvorak
36
- case 72: // h
37
- case 84: // t
38
- case 78: // n
39
35
  this.clearMoveTimeout();
40
36
  break;
41
37
  }
@@ -46,12 +42,10 @@ Searchdoc.Navigation = new function() {
46
42
  switch (e.keyCode) {
47
43
  case 37: //Event.KEY_LEFT:
48
44
  case 74: // j (qwerty)
49
- case 72: // h (dvorak)
50
45
  if (this.moveLeft()) e.preventDefault();
51
46
  break;
52
47
  case 38: //Event.KEY_UP:
53
48
  case 73: // i (qwerty)
54
- case 67: // c (dvorak)
55
49
  if (e.keyCode == 38 || e.ctrlKey) {
56
50
  if (this.moveUp()) e.preventDefault();
57
51
  this.startMoveTimeout(false);
@@ -59,23 +53,19 @@ Searchdoc.Navigation = new function() {
59
53
  break;
60
54
  case 39: //Event.KEY_RIGHT:
61
55
  case 76: // l (qwerty)
62
- case 78: // n (dvorak)
63
56
  if (this.moveRight()) e.preventDefault();
64
57
  break;
65
58
  case 40: //Event.KEY_DOWN:
66
59
  case 75: // k (qwerty)
67
- case 84: // t (dvorak)
68
60
  if (e.keyCode == 40 || e.ctrlKey) {
69
61
  if (this.moveDown()) e.preventDefault();
70
62
  this.startMoveTimeout(true);
71
63
  }
72
64
  break;
73
- case 9: //Event.KEY_TAB:
74
65
  case 13: //Event.KEY_RETURN:
75
66
  if (this.$current) this.select(this.$current);
76
67
  break;
77
68
  case 83: // s (qwerty)
78
- case 79: // o (dvorak)
79
69
  if (e.ctrlKey) {
80
70
  $('#search').focus();
81
71
  e.preventDefault();
@@ -2,6 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title>Search Index</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
6
  <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" charset="utf-8" />
6
7
  <link rel="stylesheet" href="../css/panel.css" type="text/css" media="screen" charset="utf-8" />
7
8
  <script src="../js/search_index.js" type="text/javascript" charset="utf-8"></script>
@@ -2,6 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <title>File Index</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
6
  </head>
6
7
  <body>
7
8
  <% @files.each do |file| %>
@@ -118,7 +118,7 @@ class RDoc::Generator::SDoc
118
118
  debug_msg "Generating index file in #@outputdir"
119
119
  templatefile = @template_dir + 'index.rhtml'
120
120
  outfile = @outputdir + 'index.html'
121
- rel_prefix = @outputdir.relative_path_from( outfile.dirname )
121
+ rel_prefix = rel_prefix = @outputdir.relative_path_from( outfile.dirname )
122
122
 
123
123
  self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
124
124
  end
@@ -131,7 +131,7 @@ class RDoc::Generator::SDoc
131
131
  @classes.each do |klass|
132
132
  debug_msg " working on %s (%s)" % [ klass.full_name, klass.path ]
133
133
  outfile = @outputdir + klass.path
134
- rel_prefix = @outputdir.relative_path_from( outfile.dirname )
134
+ rel_prefix = rel_prefix = @outputdir.relative_path_from( outfile.dirname )
135
135
 
136
136
  debug_msg " rendering #{outfile}"
137
137
  self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
@@ -146,7 +146,7 @@ class RDoc::Generator::SDoc
146
146
  @files.each do |file|
147
147
  outfile = @outputdir + file.path
148
148
  debug_msg " working on %s (%s)" % [ file.full_name, outfile ]
149
- rel_prefix = @outputdir.relative_path_from( outfile.dirname )
149
+ rel_prefix = rel_prefix = @outputdir.relative_path_from( outfile.dirname )
150
150
 
151
151
  debug_msg " rendering #{outfile}"
152
152
  self.render_template( templatefile, binding(), outfile ) unless @options.dry_run
data/lib/sdoc/merge.rb CHANGED
@@ -3,11 +3,7 @@ require 'pathname'
3
3
  require 'fileutils'
4
4
  require 'json'
5
5
 
6
- require 'sdoc/templatable'
7
-
8
6
  class SDoc::Merge
9
- include SDoc::Templatable
10
-
11
7
  FLAG_FILE = "created.rid"
12
8
 
13
9
  def initialize()
@@ -20,9 +16,6 @@ class SDoc::Merge
20
16
 
21
17
  def merge(options)
22
18
  parse_options options
23
-
24
- @outputdir = Pathname.new( @op_dir )
25
-
26
19
  check_directories
27
20
  setup_output_dir
28
21
  setup_names
@@ -30,7 +23,7 @@ class SDoc::Merge
30
23
  copy_docs if @urls.empty?
31
24
  merge_search_index
32
25
  merge_tree
33
- generate_index_file
26
+ copy_index_file
34
27
  end
35
28
 
36
29
  def parse_options(options)
@@ -56,7 +49,6 @@ class SDoc::Merge
56
49
  end
57
50
  end
58
51
  opts.parse! options
59
- @template_dir = Pathname.new(RDoc::Options.new.template_dir_for 'merge')
60
52
  @directories = options.dup
61
53
  end
62
54
 
@@ -70,7 +62,7 @@ class SDoc::Merge
70
62
  subtree = JSON.parse(data, :max_nesting => 0)
71
63
  item = [
72
64
  name,
73
- url + '/' + extract_index_path(dir),
65
+ url + '/index.html',
74
66
  '',
75
67
  append_path(subtree, url)
76
68
  ]
@@ -137,24 +129,8 @@ class SDoc::Merge
137
129
  end
138
130
  end
139
131
 
140
- def extract_index_path dir
141
- filename = File.join dir, 'index.html'
142
- content = File.open(filename) { |f| f.read }
143
- match = content.match(/<frame\s+src="([^"]+)"\s+name="docwin"/mi)
144
- if match
145
- match[1]
146
- else
147
- ''
148
- end
149
- end
150
-
151
- def generate_index_file
152
- templatefile = @template_dir + 'index.rhtml'
153
- outfile = @outputdir + 'index.html'
154
- url = @urls.empty? ? @names[0] : @urls[0]
155
- index_path = url + '/' + extract_index_path(@directories[0])
156
-
157
- render_template templatefile, binding(), outfile
132
+ def copy_index_file
133
+ FileUtils.cp File.join(@directories[0], 'index.html'), @op_dir
158
134
  end
159
135
 
160
136
  def setup_names
@@ -178,6 +154,7 @@ class SDoc::Merge
178
154
  FileUtils.cp_r File.join(dir, item), File.join(@op_dir, name, item), :preserve => true
179
155
  end
180
156
  end
157
+ FileUtils.cp File.join(dir, 'index.html'), File.join(@op_dir, name)
181
158
  end
182
159
  end
183
160
 
@@ -28,7 +28,7 @@ module SDoc::Templatable
28
28
  ### current context. Adds all +local_assigns+ to context
29
29
  def include_template(template_name, local_assigns = {})
30
30
  source = local_assigns.keys.map { |key| "#{key} = local_assigns[:#{key}];" }.join
31
- templatefile = @template_dir + template_name
31
+ templatefile = templatefile = @template_dir + template_name
32
32
  eval("#{source};eval_template(templatefile, binding)")
33
33
  end
34
34
 
data/lib/sdoc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SDoc
2
- VERSION = '2.0.4'
2
+ VERSION = '2.3.1'
3
3
  end
data/netlify.toml ADDED
@@ -0,0 +1,39 @@
1
+ [build]
2
+ command = "rake install && sdoc -o doc/public -T rails -f sdoc"
3
+ publish = "doc/public"
4
+
5
+ [build.processing]
6
+ skip_processing = false
7
+ [build.processing.css]
8
+ bundle = true
9
+ minify = true
10
+ [build.processing.js]
11
+ bundle = true
12
+ minify = true
13
+ [build.processing.html]
14
+ pretty_urls = true
15
+ [build.processing.images]
16
+ compress = true
17
+
18
+ [[headers]]
19
+ for = "*"
20
+ [headers.values]
21
+ X-Frame-Options = "DENY"
22
+ X-XSS-Protection = "1; mode=block"
23
+ X-Content-Type-Options = "nosniff"
24
+ Content-Security-Policy = '''
25
+ object-src 'none';
26
+ worker-src 'none';
27
+ block-all-mixed-content;
28
+ upgrade-insecure-requests;'''
29
+ Strict-Transport-Security = "max-age=15552000; includeSubDomains"
30
+ Referrer-Policy = "no-referrer-when-downgrade"
31
+ Cache-Control = "public, max-age=604800, s-max-age=604800"
32
+
33
+ [[headers]]
34
+ for = "/"
35
+
36
+ [[headers]]
37
+ for = "/*.(png|jpg|js|css|svg|woff|ttf|eot|ico|woff2)"
38
+ [headers.values]
39
+ Cache-Control = "public, max-age=31536000, s-max-age=31536000"
data/sdoc.gemspec CHANGED
@@ -22,9 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.rdoc_options = ["--charset=UTF-8"]
23
23
  s.extra_rdoc_files = ["README.md"]
24
24
 
25
- s.add_runtime_dependency("rdoc", ">= 5.0")
26
-
27
- s.add_development_dependency("rack")
25
+ s.add_runtime_dependency("rdoc", ">= 5.0", "< 6.4.0")
28
26
 
29
27
  s.files = `git ls-files`.split("\n")
30
28
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
data/spec/helpers_spec.rb CHANGED
@@ -19,14 +19,14 @@ describe SDoc::Helpers do
19
19
  ]
20
20
 
21
21
  strings.each do |(html, stripped)|
22
- @helpers.strip_tags(html).must_equal stripped
22
+ _(@helpers.strip_tags(html)).must_equal stripped
23
23
  end
24
24
  end
25
25
  end
26
26
 
27
27
  describe "#truncate" do
28
28
  it "should truncate the given text around a given length" do
29
- @helpers.truncate("Hello world", length: 5).must_equal "Hello."
29
+ _(@helpers.truncate("Hello world", length: 5)).must_equal "Hello."
30
30
  end
31
31
  end
32
32
  end