sdoc 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +37 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +15 -1
- data/README.md +14 -4
- data/Rakefile +54 -2
- data/config.ru +3 -3
- data/lib/rdoc/generator/template/rails/_head.rhtml +2 -19
- data/lib/rdoc/generator/template/rails/_panel.rhtml +3 -3
- data/lib/rdoc/generator/template/rails/class.rhtml +4 -2
- data/lib/rdoc/generator/template/rails/file.rhtml +4 -2
- data/lib/rdoc/generator/template/rails/index.rhtml +4 -3
- data/lib/rdoc/generator/template/rails/resources/css/main.css +29 -4
- data/lib/rdoc/generator/template/rails/resources/css/panel.css +2 -2
- data/lib/rdoc/generator/template/rails/resources/css/reset.css +0 -1
- data/lib/rdoc/generator/template/rails/resources/js/main.js +17 -0
- data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +9 -12
- data/lib/rdoc/generator/template/sdoc/class.rhtml +2 -2
- data/lib/rdoc/generator/template/sdoc/file.rhtml +2 -2
- data/lib/rdoc/generator/template/sdoc/resources/css/reset.css +0 -1
- data/lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js +0 -10
- data/lib/sdoc/merge.rb +5 -28
- data/lib/sdoc/version.rb +1 -1
- data/netlify.toml +39 -0
- data/spec/helpers_spec.rb +2 -2
- data/spec/rdoc_generator_spec.rb +9 -9
- metadata +4 -4
- data/.travis.yml +0 -31
- data/lib/rdoc/generator/template/merge/index.rhtml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 002ca37375a4f9d51c68f2c7ac421cec8c4baf74171615627e828fbf8947bc48
|
4
|
+
data.tar.gz: 06f44cb76f359c63d97a0b9e5c0eb5c5b06277c700928006e2e390c05955eb17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b48d64b1e6c87db2088e56c692ed31c8f85fef24e640b18a5c4f609966f7d0b912d78a2e2a973bfffc2bbbecf1ffb3bfb5f16adeecc69780f3e7286850a8f92a
|
7
|
+
data.tar.gz: 9e59249e7ea77c4057c1a741e9d4dd6c6fe058ba63fe976d88e20806520d7ce8b219aa5b04acc0943b8f91b0abfb11d97e9fb2d28360381cf893a5c7f8ec3b7f
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
schedule:
|
6
|
+
- cron: '0 0 * * *'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-20.04
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby:
|
14
|
+
- '2.1'
|
15
|
+
- '2.2'
|
16
|
+
- '2.3'
|
17
|
+
- '2.4'
|
18
|
+
- '2.5'
|
19
|
+
- '2.6'
|
20
|
+
- '2.7'
|
21
|
+
- '3.0'
|
22
|
+
- 'ruby-head'
|
23
|
+
- 'jruby-head'
|
24
|
+
- 'truffleruby-head'
|
25
|
+
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v1
|
28
|
+
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
33
|
+
bundler-cache: true
|
34
|
+
|
35
|
+
- name: Test
|
36
|
+
run: |
|
37
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
Master
|
2
|
+
======
|
3
|
+
|
4
|
+
2.2.0
|
5
|
+
=====
|
6
|
+
|
7
|
+
* #161 Add 'skip to content' link and improve shortcut keys [@MikeRogers0](https://github.com/MikeRogers0)
|
8
|
+
* #170 Fix link hovers in headings [@tlatsas](https://github.com/tlatsas)
|
9
|
+
* #169 Fix clearing search results [@mikdiet](https://github.com/mikdiet)
|
10
|
+
* #167 Update Merge script to work with sdoc v2 [@mikdiet](https://github.com/mikdiet)
|
11
|
+
* #160 Remove outline from reset stylesheet [@p8](https://github.com/p8)
|
12
|
+
* #159 Remove TAB override in panel [@p8](https://github.com/p8)
|
13
|
+
* #157 Move to GitHub action for tests [@MikeRogers0](https://github.com/MikeRogers0)
|
14
|
+
* #155 Fix Ctrl+C copying [Jan Schär](https://github.com/jscissr)
|
15
|
+
|
1
16
|
2.1.0
|
2
17
|
=====
|
3
18
|
|
@@ -91,4 +106,3 @@ Bug Fixes
|
|
91
106
|
[Compare v0.3.20...v0.4.0](https://github.com/voloko/sdoc/compare/v0.3.20...v0.4.0)
|
92
107
|
|
93
108
|
No friendly log for this version yet, but PRs are welcome!
|
94
|
-
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SDoc
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Tests](https://github.com/zzak/sdoc/actions/workflows/test.yml/badge.svg)](https://github.com/zzak/sdoc/actions/workflows/test.yml)
|
4
4
|
|
5
5
|
**Powering http://api.rubyonrails.org/**
|
6
6
|
|
@@ -92,15 +92,25 @@ As maintainer of both projects, I'll see if I can identify the root of the cause
|
|
92
92
|
|
93
93
|
## Contributing
|
94
94
|
|
95
|
-
If you'd like to contribute you can generate the Rails documentation by running:
|
95
|
+
If you'd like to contribute you can generate the Rails main branch documentation by running:
|
96
96
|
|
97
97
|
```bash
|
98
98
|
rake test:rails
|
99
99
|
```
|
100
100
|
|
101
|
-
|
102
|
-
Since the task doesn't do any file filtering it contains a lot of extra pages.
|
101
|
+
You can generate the Ruby default branch documentation by running:
|
103
102
|
|
103
|
+
```bash
|
104
|
+
rake test:ruby
|
105
|
+
```
|
106
|
+
|
107
|
+
You can generate merged Rails and Ruby documentation by running:
|
108
|
+
|
109
|
+
```bash
|
110
|
+
rake test:merged
|
111
|
+
```
|
112
|
+
|
113
|
+
The generated documentation will be put into `doc/public` directory.
|
104
114
|
To view the just generated documentation start up a rack application by running:
|
105
115
|
|
106
116
|
```bash
|
data/Rakefile
CHANGED
@@ -12,22 +12,74 @@ task :default => :test
|
|
12
12
|
task :spec => :test
|
13
13
|
|
14
14
|
require 'sdoc'
|
15
|
+
require 'sdoc/merge'
|
15
16
|
require 'rdoc/task'
|
16
17
|
|
17
18
|
rails = File.expand_path "rails"
|
19
|
+
ruby = File.expand_path "ruby"
|
18
20
|
|
19
21
|
directory rails do
|
20
22
|
sh "git clone --depth=1 https://github.com/rails/rails"
|
21
23
|
end
|
22
24
|
|
25
|
+
directory ruby do
|
26
|
+
sh "git clone --depth=1 https://github.com/ruby/ruby"
|
27
|
+
end
|
28
|
+
|
23
29
|
namespace :test do
|
24
|
-
|
30
|
+
desc 'Deletes all generated test documentation'
|
31
|
+
task :reset_docs do
|
32
|
+
FileUtils.remove_dir(File.expand_path('doc'), force: true)
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Generates test rails documentation'
|
36
|
+
task :rails => [rails, :generate_rails] do
|
37
|
+
FileUtils.mv(
|
38
|
+
File.expand_path('doc/rails'),
|
39
|
+
File.expand_path('doc/public')
|
40
|
+
)
|
41
|
+
end
|
25
42
|
|
26
|
-
RDoc::Task.new(:
|
43
|
+
RDoc::Task.new(:generate_rails) do |rdoc|
|
27
44
|
rdoc.rdoc_dir = 'doc/rails'
|
28
45
|
rdoc.generator = 'sdoc'
|
29
46
|
rdoc.template = 'rails'
|
47
|
+
rdoc.title = 'Ruby on Rails'
|
48
|
+
rdoc.main = 'rails/README.md'
|
49
|
+
rdoc.options << '--exclude=test'
|
30
50
|
|
31
51
|
rdoc.rdoc_files.include("rails/")
|
32
52
|
end
|
53
|
+
|
54
|
+
desc 'Generates test ruby documentation'
|
55
|
+
task :ruby => [ruby, :generate_ruby] do
|
56
|
+
FileUtils.mv(
|
57
|
+
File.expand_path('doc/ruby'),
|
58
|
+
File.expand_path('doc/public')
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
RDoc::Task.new(:generate_ruby) do |rdoc|
|
63
|
+
rdoc.rdoc_dir = 'doc/ruby'
|
64
|
+
rdoc.generator = 'sdoc'
|
65
|
+
rdoc.template = 'rails'
|
66
|
+
rdoc.title = 'Ruby'
|
67
|
+
rdoc.main = 'ruby/README.md'
|
68
|
+
|
69
|
+
rdoc.rdoc_files.include("ruby/")
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'Generates merged test documentation'
|
73
|
+
task :merged => [rails, :generate_rails, ruby, :generate_ruby, :merge]
|
74
|
+
|
75
|
+
task :merge do
|
76
|
+
SDoc::Merge.new.merge(
|
77
|
+
[
|
78
|
+
'--title', 'Rails + Ruby',
|
79
|
+
'--op', 'doc/public',
|
80
|
+
'--names', 'rails, ruby',
|
81
|
+
'doc/rails', 'doc/ruby'
|
82
|
+
]
|
83
|
+
)
|
84
|
+
end
|
33
85
|
end
|
data/config.ru
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#
|
6
6
|
require 'bundler/setup'
|
7
7
|
|
8
|
-
root = "doc/
|
8
|
+
root = "doc/public"
|
9
9
|
unless Dir.exists?(root)
|
10
10
|
puts <<~MESSAGE
|
11
11
|
Could not find any docs in #{root}.
|
@@ -16,12 +16,12 @@ unless Dir.exists?(root)
|
|
16
16
|
end
|
17
17
|
|
18
18
|
use Rack::Static,
|
19
|
-
:urls => ["/files", "/images", "/js", "/css", "/panel", "/i", "/classes"],
|
19
|
+
:urls => ["/files", "/images", "/js", "/css", "/panel", "/i", "/classes", "/ruby", "/rails"],
|
20
20
|
:root => root
|
21
21
|
run lambda { |env|
|
22
22
|
[
|
23
23
|
200,
|
24
|
-
{
|
24
|
+
{
|
25
25
|
'Content-Type' => 'text/html',
|
26
26
|
'Cache-Control' => 'public, max-age=86400'
|
27
27
|
},
|
@@ -17,23 +17,6 @@
|
|
17
17
|
<script src="<%= rel_prefix %>/js/searcher.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
|
18
18
|
<script src="<%= rel_prefix %>/panel/tree.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
|
19
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
20
|
|
21
|
+
<meta name="data-rel-prefix" content="<%= rel_prefix %>/">
|
22
|
+
<meta name="data-tree-keys" content='<%= tree_keys %>'>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<input type="checkbox" id="hamburger" class="panel_checkbox">
|
2
2
|
<label class="panel_mobile_button" for="hamburger"><span></span> Menu</label>
|
3
|
-
<
|
3
|
+
<nav class="panel panel_tree" id="panel" data-turbolinks-permanent>
|
4
4
|
<div class="header">
|
5
|
-
<input type="text" placeholder="Search for a class, method, ..." autosave="searchdoc" results="10" id="search" autocomplete="off" tabindex="-1" />
|
5
|
+
<input type="text" placeholder="Search (/) for a class, method, ..." autosave="searchdoc" results="10" id="search" autocomplete="off" tabindex="-1" />
|
6
6
|
<label class="panel_mobile_button_close" for="hamburger"><span></span> Close</label>
|
7
7
|
</div>
|
8
8
|
<div class="tree">
|
@@ -14,4 +14,4 @@
|
|
14
14
|
</ul>
|
15
15
|
</div>
|
16
16
|
<a href="links.html" id="links">index</a>
|
17
|
-
</
|
17
|
+
</nav>
|
@@ -18,6 +18,8 @@
|
|
18
18
|
</head>
|
19
19
|
|
20
20
|
<body>
|
21
|
+
<a class="sr-only sr-only-focusable" href="#content" data-turbolinks="false">Skip to Content</a>
|
22
|
+
<a class="sr-only sr-only-focusable" href="#search" data-turbolinks="false">Skip to Search</a>
|
21
23
|
|
22
24
|
<%= include_template '_panel.rhtml' %>
|
23
25
|
|
@@ -45,8 +47,8 @@
|
|
45
47
|
</ul>
|
46
48
|
</div>
|
47
49
|
|
48
|
-
<
|
50
|
+
<main id="bodyContent">
|
49
51
|
<%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
|
50
|
-
</
|
52
|
+
</main>
|
51
53
|
</body>
|
52
54
|
</html>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
</head>
|
9
9
|
|
10
10
|
<body>
|
11
|
+
<a class="sr-only sr-only-focusable" href="#content" data-turbolinks="false">Skip to Content</a>
|
12
|
+
<a class="sr-only sr-only-focusable" href="#search" data-turbolinks="false">Skip to Search</a>
|
11
13
|
|
12
14
|
<%= include_template '_panel.rhtml' %>
|
13
15
|
|
@@ -32,8 +34,8 @@
|
|
32
34
|
</ul>
|
33
35
|
</div>
|
34
36
|
|
35
|
-
<
|
37
|
+
<main id="bodyContent">
|
36
38
|
<%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
|
37
|
-
</
|
39
|
+
</main>
|
38
40
|
</body>
|
39
41
|
</html>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
</head>
|
9
9
|
|
10
10
|
<body>
|
11
|
+
<a class="sr-only sr-only-focusable" href="#content" data-turbolinks="false">Skip to Content</a>
|
12
|
+
<a class="sr-only sr-only-focusable" href="#search" data-turbolinks="false">Skip to Search</a>
|
11
13
|
|
12
14
|
<%= include_template '_panel.rhtml' %>
|
13
15
|
|
@@ -24,9 +26,8 @@
|
|
24
26
|
</ul>
|
25
27
|
</div>
|
26
28
|
|
27
|
-
<
|
29
|
+
<main id="bodyContent">
|
28
30
|
<%= include_template '_context.rhtml', {:context => index } %>
|
29
|
-
</
|
31
|
+
</main>
|
30
32
|
</body>
|
31
33
|
</html>
|
32
|
-
|
@@ -31,10 +31,6 @@ h1 a, h2 a, .banner a {
|
|
31
31
|
color: #fff;
|
32
32
|
}
|
33
33
|
|
34
|
-
h1 a:hover, h2 a:hover {
|
35
|
-
color: #fff;
|
36
|
-
}
|
37
|
-
|
38
34
|
p {
|
39
35
|
margin-bottom: 1em;
|
40
36
|
text-align: justify;
|
@@ -378,3 +374,32 @@ p code {
|
|
378
374
|
margin-bottom: 1px;
|
379
375
|
padding: 0 5px;
|
380
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
|
+
}
|
@@ -98,7 +98,7 @@
|
|
98
98
|
left: -100%;
|
99
99
|
width: 100%;
|
100
100
|
bottom: 0;
|
101
|
-
visibility: hidden;
|
101
|
+
visibility: hidden;
|
102
102
|
}
|
103
103
|
|
104
104
|
.panel_checkbox:checked ~ .panel {
|
@@ -113,7 +113,7 @@
|
|
113
113
|
}
|
114
114
|
}
|
115
115
|
|
116
|
-
.panel_tree .
|
116
|
+
.panel_tree .result,
|
117
117
|
.panel_results .tree
|
118
118
|
{
|
119
119
|
display: none;
|
@@ -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
|
};
|
@@ -481,4 +479,3 @@ Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
|
|
481
479
|
return 5 + 18 * level + 'px';
|
482
480
|
}
|
483
481
|
});
|
484
|
-
|
@@ -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();
|
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
|
-
|
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 + '/'
|
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
|
141
|
-
|
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
|
|
data/lib/sdoc/version.rb
CHANGED
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/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
|
data/spec/rdoc_generator_spec.rb
CHANGED
@@ -8,12 +8,12 @@ describe RDoc::Generator::SDoc do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should find sdoc generator" do
|
11
|
-
RDoc::RDoc::GENERATORS.must_include 'sdoc'
|
11
|
+
_(RDoc::RDoc::GENERATORS).must_include 'sdoc'
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should use sdoc generator" do
|
15
|
-
@options.generator.must_equal RDoc::Generator::SDoc
|
16
|
-
@options.generator_name.must_equal 'sdoc'
|
15
|
+
_(@options.generator).must_equal RDoc::Generator::SDoc
|
16
|
+
_(@options.generator_name).must_equal 'sdoc'
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should parse github option" do
|
@@ -23,8 +23,8 @@ describe RDoc::Generator::SDoc do
|
|
23
23
|
@parser.parse %w[--github]
|
24
24
|
end
|
25
25
|
|
26
|
-
err.wont_match(/^invalid options/)
|
27
|
-
@options.github.must_equal true
|
26
|
+
_(err).wont_match(/^invalid options/)
|
27
|
+
_(@options.github).must_equal true
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should parse github short-hand option" do
|
@@ -34,15 +34,15 @@ describe RDoc::Generator::SDoc do
|
|
34
34
|
@parser.parse %w[-g]
|
35
35
|
end
|
36
36
|
|
37
|
-
err.wont_match(/^invalid options/)
|
38
|
-
@options.github.must_equal true
|
37
|
+
_(err).wont_match(/^invalid options/)
|
38
|
+
_(@options.github).must_equal true
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should display SDoc version on -v or --version" do
|
42
42
|
out_full = `./bin/sdoc --version`
|
43
43
|
out_short = `./bin/sdoc -v`
|
44
44
|
|
45
|
-
out_short.strip.must_equal SDoc::VERSION
|
46
|
-
out_full.strip.must_equal SDoc::VERSION
|
45
|
+
_(out_short.strip).must_equal SDoc::VERSION
|
46
|
+
_(out_full.strip).must_equal SDoc::VERSION
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kolesnikov
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-
|
14
|
+
date: 2021-05-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rdoc
|
@@ -50,8 +50,8 @@ extensions: []
|
|
50
50
|
extra_rdoc_files:
|
51
51
|
- README.md
|
52
52
|
files:
|
53
|
+
- ".github/workflows/test.yml"
|
53
54
|
- ".gitignore"
|
54
|
-
- ".travis.yml"
|
55
55
|
- CHANGELOG.md
|
56
56
|
- Gemfile
|
57
57
|
- LICENSE
|
@@ -61,7 +61,6 @@ files:
|
|
61
61
|
- bin/sdoc-merge
|
62
62
|
- config.ru
|
63
63
|
- lib/rdoc/discover.rb
|
64
|
-
- lib/rdoc/generator/template/merge/index.rhtml
|
65
64
|
- lib/rdoc/generator/template/rails/_context.rhtml
|
66
65
|
- lib/rdoc/generator/template/rails/_head.rhtml
|
67
66
|
- lib/rdoc/generator/template/rails/_panel.rhtml
|
@@ -113,6 +112,7 @@ files:
|
|
113
112
|
- lib/sdoc/merge.rb
|
114
113
|
- lib/sdoc/templatable.rb
|
115
114
|
- lib/sdoc/version.rb
|
115
|
+
- netlify.toml
|
116
116
|
- sdoc.gemspec
|
117
117
|
- spec/helpers_spec.rb
|
118
118
|
- spec/rdoc_generator_spec.rb
|
data/.travis.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
before_install:
|
4
|
-
- gem update --system || gem update --system 2.7.8
|
5
|
-
- gem install bundler || gem install bundler -v 1.17.3
|
6
|
-
rvm:
|
7
|
-
- 1.9.3
|
8
|
-
- 2.0.0
|
9
|
-
- 2.1.0
|
10
|
-
- 2.2.10
|
11
|
-
- 2.3.7
|
12
|
-
- 2.4.4
|
13
|
-
- 2.5.1
|
14
|
-
- 2.6.0
|
15
|
-
- ruby-head
|
16
|
-
- jruby-head
|
17
|
-
matrix:
|
18
|
-
allow_failures:
|
19
|
-
- env: rdoc=master
|
20
|
-
- rvm: jruby-head
|
21
|
-
include:
|
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 }
|
27
|
-
- { rvm: ruby-head, env: rdoc=master }
|
28
|
-
- { rvm: jruby-head, env: rdoc=master }
|
29
|
-
notifications:
|
30
|
-
email:
|
31
|
-
- mail@zzak.io
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<title><%= @title %></title>
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
7
|
-
</head>
|
8
|
-
<frameset cols="300,*" frameborder="1" border="1" bordercolor="#999999" framespacing="1">
|
9
|
-
<frame src="panel/index.html" title="Search" name="panel" />
|
10
|
-
<frame src="<%= index_path %>" name="docwin" />
|
11
|
-
</frameset>
|
12
|
-
</html>
|