sdoc 2.0.1 → 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 +42 -5
- data/README.md +22 -4
- data/Rakefile +54 -2
- data/config.ru +30 -0
- data/lib/rdoc/generator/template/rails/_context.rhtml +5 -5
- data/lib/rdoc/generator/template/rails/_head.rhtml +2 -19
- data/lib/rdoc/generator/template/rails/_panel.rhtml +6 -3
- data/lib/rdoc/generator/template/rails/class.rhtml +7 -4
- data/lib/rdoc/generator/template/rails/file.rhtml +7 -4
- data/lib/rdoc/generator/template/rails/index.rhtml +10 -10
- data/lib/rdoc/generator/template/rails/resources/css/main.css +37 -10
- data/lib/rdoc/generator/template/rails/resources/css/panel.css +125 -8
- data/lib/rdoc/generator/template/rails/resources/css/reset.css +0 -1
- data/lib/rdoc/generator/template/rails/resources/i/arrow-down-current.svg +8 -0
- data/lib/rdoc/generator/template/rails/resources/i/arrow-right-current.svg +8 -0
- data/lib/rdoc/generator/template/rails/resources/js/main.js +17 -0
- data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +9 -21
- data/lib/rdoc/generator/template/rails/search_index.rhtml +6 -2
- data/lib/rdoc/generator/template/sdoc/class.rhtml +5 -6
- data/lib/rdoc/generator/template/sdoc/file.rhtml +5 -6
- data/lib/rdoc/generator/template/sdoc/index.rhtml +3 -4
- 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/rdoc/generator/template/sdoc/resources/panel/index.html +2 -1
- data/lib/rdoc/generator/template/sdoc/search_index.rhtml +6 -2
- data/lib/sdoc/merge.rb +5 -28
- data/lib/sdoc/version.rb +1 -1
- data/netlify.toml +39 -0
- data/sdoc.gemspec +2 -1
- data/spec/helpers_spec.rb +2 -2
- data/spec/rdoc_generator_spec.rb +9 -9
- metadata +8 -5
- data/.travis.yml +0 -31
- data/lib/rdoc/generator/template/merge/index.rhtml +0 -12
@@ -1,5 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>File Index</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
</head>
|
3
7
|
<body>
|
4
8
|
<% @files.each do |file| %>
|
5
9
|
<a href="../<%= file.path %>"><%= file.relative_name %></a>
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
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">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
5
3
|
<head>
|
6
4
|
<title><%= h klass.full_name %></title>
|
7
5
|
<meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
8
7
|
<%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
|
9
8
|
|
10
9
|
<meta property="og:title" value="<%= klass.full_name %>">
|
@@ -45,8 +44,8 @@
|
|
45
44
|
<% end %>
|
46
45
|
</ul>
|
47
46
|
</div>
|
48
|
-
<
|
47
|
+
<main id="bodyContent">
|
49
48
|
<%= include_template '_context.rhtml', {:context => klass, :rel_prefix => rel_prefix} %>
|
50
|
-
</
|
49
|
+
</main>
|
51
50
|
</body>
|
52
51
|
</html>
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
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">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
5
3
|
<head>
|
6
4
|
<title><%= h file.name %></title>
|
7
5
|
<meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
8
7
|
<%= include_template '_head.rhtml', {:rel_prefix => rel_prefix} %>
|
9
8
|
</head>
|
10
9
|
|
@@ -22,8 +21,8 @@
|
|
22
21
|
</ul>
|
23
22
|
</div>
|
24
23
|
|
25
|
-
<
|
24
|
+
<main id="bodyContent">
|
26
25
|
<%= include_template '_context.rhtml', {:context => file, :rel_prefix => rel_prefix} %>
|
27
|
-
</
|
26
|
+
</main>
|
28
27
|
</body>
|
29
28
|
</html>
|
@@ -1,10 +1,9 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
5
3
|
<head>
|
6
4
|
<meta http-equiv="Content-Type" content="text/html; charset=<%= @options.charset %>" />
|
7
5
|
<title><%= @options.title %></title>
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
8
7
|
</head>
|
9
8
|
<frameset cols="300,*" frameborder="1" border="1" bordercolor="#999999" framespacing="1">
|
10
9
|
<frame src="panel/index.html" title="Search" name="panel" />
|
@@ -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();
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
|
-
<title>
|
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>
|
@@ -1,5 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>File Index</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
</head>
|
3
7
|
<body>
|
4
8
|
<% @files.each do |file| %>
|
5
9
|
<a href="../<%= file.path %>"><%= file.relative_name %></a>
|
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/sdoc.gemspec
CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.extra_rdoc_files = ["README.md"]
|
24
24
|
|
25
25
|
s.add_runtime_dependency("rdoc", ">= 5.0")
|
26
|
-
|
26
|
+
|
27
|
+
s.add_development_dependency("rack")
|
27
28
|
|
28
29
|
s.files = `git ls-files`.split("\n")
|
29
30
|
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
|
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.0
|
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:
|
14
|
+
date: 2021-05-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rdoc
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '0'
|
37
|
-
type: :
|
37
|
+
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
@@ -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
|
@@ -59,8 +59,8 @@ files:
|
|
59
59
|
- Rakefile
|
60
60
|
- bin/sdoc
|
61
61
|
- bin/sdoc-merge
|
62
|
+
- config.ru
|
62
63
|
- lib/rdoc/discover.rb
|
63
|
-
- lib/rdoc/generator/template/merge/index.rhtml
|
64
64
|
- lib/rdoc/generator/template/rails/_context.rhtml
|
65
65
|
- lib/rdoc/generator/template/rails/_head.rhtml
|
66
66
|
- lib/rdoc/generator/template/rails/_panel.rhtml
|
@@ -73,7 +73,9 @@ files:
|
|
73
73
|
- lib/rdoc/generator/template/rails/resources/css/panel.css
|
74
74
|
- lib/rdoc/generator/template/rails/resources/css/reset.css
|
75
75
|
- lib/rdoc/generator/template/rails/resources/favicon.ico
|
76
|
+
- lib/rdoc/generator/template/rails/resources/i/arrow-down-current.svg
|
76
77
|
- lib/rdoc/generator/template/rails/resources/i/arrow-down.svg
|
78
|
+
- lib/rdoc/generator/template/rails/resources/i/arrow-right-current.svg
|
77
79
|
- lib/rdoc/generator/template/rails/resources/i/arrow-right.svg
|
78
80
|
- lib/rdoc/generator/template/rails/resources/i/search.svg
|
79
81
|
- lib/rdoc/generator/template/rails/resources/i/tree_bg.svg
|
@@ -110,6 +112,7 @@ files:
|
|
110
112
|
- lib/sdoc/merge.rb
|
111
113
|
- lib/sdoc/templatable.rb
|
112
114
|
- lib/sdoc/version.rb
|
115
|
+
- netlify.toml
|
113
116
|
- sdoc.gemspec
|
114
117
|
- spec/helpers_spec.rb
|
115
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
|