sdoc 2.0.1 → 2.2.0

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +37 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +42 -5
  5. data/README.md +22 -4
  6. data/Rakefile +54 -2
  7. data/config.ru +30 -0
  8. data/lib/rdoc/generator/template/rails/_context.rhtml +5 -5
  9. data/lib/rdoc/generator/template/rails/_head.rhtml +2 -19
  10. data/lib/rdoc/generator/template/rails/_panel.rhtml +6 -3
  11. data/lib/rdoc/generator/template/rails/class.rhtml +7 -4
  12. data/lib/rdoc/generator/template/rails/file.rhtml +7 -4
  13. data/lib/rdoc/generator/template/rails/index.rhtml +10 -10
  14. data/lib/rdoc/generator/template/rails/resources/css/main.css +37 -10
  15. data/lib/rdoc/generator/template/rails/resources/css/panel.css +125 -8
  16. data/lib/rdoc/generator/template/rails/resources/css/reset.css +0 -1
  17. data/lib/rdoc/generator/template/rails/resources/i/arrow-down-current.svg +8 -0
  18. data/lib/rdoc/generator/template/rails/resources/i/arrow-right-current.svg +8 -0
  19. data/lib/rdoc/generator/template/rails/resources/js/main.js +17 -0
  20. data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +9 -21
  21. data/lib/rdoc/generator/template/rails/search_index.rhtml +6 -2
  22. data/lib/rdoc/generator/template/sdoc/class.rhtml +5 -6
  23. data/lib/rdoc/generator/template/sdoc/file.rhtml +5 -6
  24. data/lib/rdoc/generator/template/sdoc/index.rhtml +3 -4
  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 +2 -1
  28. data/lib/rdoc/generator/template/sdoc/search_index.rhtml +6 -2
  29. data/lib/sdoc/merge.rb +5 -28
  30. data/lib/sdoc/version.rb +1 -1
  31. data/netlify.toml +39 -0
  32. data/sdoc.gemspec +2 -1
  33. data/spec/helpers_spec.rb +2 -2
  34. data/spec/rdoc_generator_spec.rb +9 -9
  35. metadata +8 -5
  36. data/.travis.yml +0 -31
  37. data/lib/rdoc/generator/template/merge/index.rhtml +0 -12
@@ -7,8 +7,10 @@ body {
7
7
  line-height: 1.25em;
8
8
  }
9
9
 
10
- .banner, #bodyContent {
11
- margin-left: 300px;
10
+ @media (min-width: 40em) {
11
+ .banner, #bodyContent {
12
+ margin-left: 300px;
13
+ }
12
14
  }
13
15
 
14
16
  a:link, a:active, a:visited, a:hover {
@@ -29,10 +31,6 @@ h1 a, h2 a, .banner a {
29
31
  color: #fff;
30
32
  }
31
33
 
32
- h1 a:hover, h2 a:hover {
33
- color: #fff;
34
- }
35
-
36
34
  p {
37
35
  margin-bottom: 1em;
38
36
  text-align: justify;
@@ -125,20 +123,20 @@ ol li
125
123
  padding: 1em;
126
124
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
127
125
  }
128
- .banner h1
126
+ .banner h2
129
127
  {
130
128
  font-size: 1.2em;
131
129
  margin: 0;
132
130
  }
133
131
 
134
- .banner h1 .type
132
+ .banner h2 .type
135
133
  {
136
134
  font-size: 0.833em;
137
135
  display:block;
138
136
  }
139
137
 
140
- .banner h1 .type,
141
- .banner h1 .parent
138
+ .banner h2 .type,
139
+ .banner h2 .parent
142
140
  {
143
141
  color: #CCC;
144
142
  }
@@ -376,3 +374,32 @@ p code {
376
374
  margin-bottom: 1px;
377
375
  padding: 0 5px;
378
376
  }
377
+
378
+ .sr-only {
379
+ position: absolute;
380
+ width: 1px;
381
+ height: 1px;
382
+ padding: 0;
383
+ overflow: hidden;
384
+ clip: rect(0,0,0,0);
385
+ white-space: nowrap;
386
+ border: 0;
387
+ }
388
+ .sr-only-focusable:active,
389
+ .sr-only-focusable:focus {
390
+ position: fixed;
391
+ top: 10%;
392
+ width: auto;
393
+ height: auto;
394
+ overflow: visible;
395
+ clip: auto;
396
+ white-space: normal;
397
+ padding: 2rem;
398
+ border: 4px solid #990000;
399
+ border-radius: 1rem;
400
+ box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 15%) !important;
401
+ left: 40%;
402
+ z-index: 100;
403
+ background: #fff;
404
+ font-size: 2rem;
405
+ }
@@ -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,10 +172,10 @@
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
- overflow-y: scroll;
178
+ overflow-y: auto;
61
179
  overflow-x: hidden;
62
180
  z-index: 2;
63
181
  }
@@ -220,11 +338,10 @@
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%;
227
- overflow-y: scroll;
344
+ overflow-y: auto;
228
345
  overflow-x: hidden;
229
346
  z-index: 30;
230
347
  }
@@ -320,13 +437,13 @@
320
437
 
321
438
  .panel .tree ul li.current .icon
322
439
  {
323
- background: url(../i/arrow-right.svg);
440
+ background: url(../i/arrow-down-current.svg);
324
441
  background-size: 10px;
325
442
  }
326
443
 
327
444
  .panel .tree ul li.current.closed .icon
328
445
  {
329
- background: url(../i/arrow-down.svg);
446
+ background: url(../i/arrow-right-current.svg);
330
447
  background-size: 10px;
331
448
  }
332
449
 
@@ -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;
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
3
+ viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
4
+ <style type="text/css">
5
+ .st0{fill:#FFFFFF;}
6
+ </style>
7
+ <polygon class="st0" points="27.8,3.1 0.6,3.1 14.2,26.2 "/>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
3
+ viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
4
+ <style type="text/css">
5
+ .st0{fill:#FFFFFF;}
6
+ </style>
7
+ <polygon class="st0" points="2.6,1.1 2.6,28.2 25.8,14.6 "/>
8
+ </svg>
@@ -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, $('meta[name="data-rel-prefix"]').attr("content"));
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
  };
@@ -336,20 +334,17 @@ Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
336
334
  };
337
335
 
338
336
  this.select = function($li) {
339
- console.log("select")
340
337
  this.highlight($li);
341
338
  var path = $li[0].searchdoc_tree_data.path;
342
339
  if (path) this.panel.open(path);
343
340
  };
344
341
 
345
342
  this.highlight = function($li) {
346
- console.log("highlight")
347
343
  if (this.$current) this.$current.removeClass('current');
348
344
  this.$current = $li.addClass('current');
349
345
  };
350
346
 
351
347
  this.toggle = function($li) {
352
- console.log("toggle " + !$li.hasClass('closed'))
353
348
  var closed = !$li.hasClass('closed'),
354
349
  children = $li[0].searchdoc_tree_data.children;
355
350
  $li.toggleClass('closed');
@@ -359,27 +354,21 @@ Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
359
354
  };
360
355
 
361
356
  this.moveRight = function() {
362
- console.log("moveRight")
363
357
  if (!this.$current) {
364
- console.log("moveRight -> highlight")
365
358
  this.highlight(this.$list.find('li:first'));
366
359
  return;
367
360
  }
368
361
  if (this.$current.hasClass('closed')) {
369
- console.log("moveRight -> toggle")
370
362
  this.toggle(this.$current);
371
363
  }
372
364
  };
373
365
 
374
366
  this.moveLeft = function() {
375
- console.log("moveLeft")
376
367
  if (!this.$current) {
377
- console.log("moveLeft -> highlight")
378
368
  this.highlight(this.$list.find('li:first'));
379
369
  return;
380
370
  }
381
371
  if (!this.$current.hasClass('closed')) {
382
- console.log("moveLeft -> toggle")
383
372
  this.toggle(this.$current);
384
373
  } else {
385
374
  var level = this.$current[0].searchdoc_tree_data.level;
@@ -490,4 +479,3 @@ Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
490
479
  return 5 + 18 * level + 'px';
491
480
  }
492
481
  });
493
-