sdoc 1.0.0.rc3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -10
- data/Gemfile +1 -1
- data/Rakefile +0 -2
- data/lib/rdoc/generator/template/rails/_context.rhtml +6 -6
- data/lib/rdoc/generator/template/rails/class.rhtml +0 -0
- data/lib/rdoc/generator/template/rails/file.rhtml +0 -0
- data/lib/rdoc/generator/template/rails/index.rhtml +0 -0
- data/lib/rdoc/generator/template/rails/resources/css/main.css +11 -0
- data/lib/rdoc/generator/template/rails/resources/css/panel.css +0 -0
- data/lib/rdoc/generator/template/rails/resources/css/reset.css +0 -0
- data/lib/rdoc/generator/template/rails/resources/js/highlight.pack.js +0 -0
- data/lib/rdoc/generator/template/rails/resources/js/jquery-1.3.2.min.js +0 -0
- data/lib/rdoc/generator/template/rails/resources/js/main.js +0 -0
- data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +0 -0
- data/lib/rdoc/generator/template/rails/resources/panel/index.html +0 -0
- data/lib/rdoc/generator/template/sdoc/_context.rhtml +5 -5
- data/lib/rdoc/generator/template/sdoc/class.rhtml +0 -0
- data/lib/rdoc/generator/template/sdoc/file.rhtml +0 -0
- data/lib/rdoc/generator/template/sdoc/index.rhtml +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/css/main.css +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/css/panel.css +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/css/reset.css +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/i/arrows.png +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/i/results_bg.png +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/i/tree_bg.png +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/highlight.pack.js +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/jquery-1.3.2.min.js +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/main.js +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js +0 -0
- data/lib/rdoc/generator/template/sdoc/resources/panel/index.html +0 -0
- data/lib/sdoc.rb +0 -2
- data/lib/sdoc/generator.rb +0 -74
- data/lib/sdoc/github.rb +13 -14
- data/lib/sdoc/helpers.rb +1 -1
- data/lib/sdoc/version.rb +1 -1
- data/sdoc.gemspec +1 -1
- data/spec/helpers_spec.rb +6 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29716368d7c072908ecc4b13c04570fe435166e6
|
4
|
+
data.tar.gz: 706d48301caebca63b188da2033a7dee963bfaa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94539d716999ecf5b07ba5b93a2974e5fdc22b8f231449195c70129a74856e4ce9ef68bfff8d80ded0bcf4852b14be66110510fa62a7a4200dc04620f3ce0203
|
7
|
+
data.tar.gz: 42a050c73aa5ab6fc403d3b4f37fd66261b9edb78b974ec2bf2b76289f9734e3ce8b4e8a348a0d6e0743b89ff924dcf571cddf1a078ddbe051fc5f310eb90abc
|
data/.travis.yml
CHANGED
@@ -6,24 +6,22 @@ rvm:
|
|
6
6
|
- 1.9.3
|
7
7
|
- 2.0.0
|
8
8
|
- 2.1.0
|
9
|
-
- 2.2.
|
10
|
-
- 2.3.
|
11
|
-
- 2.4.
|
9
|
+
- 2.2.9
|
10
|
+
- 2.3.6
|
11
|
+
- 2.4.2
|
12
|
+
- 2.5.0
|
12
13
|
- ruby-head
|
13
|
-
- jruby-19mode
|
14
14
|
- jruby-head
|
15
15
|
matrix:
|
16
16
|
allow_failures:
|
17
17
|
- env: rdoc=master
|
18
18
|
- rvm: jruby-head
|
19
19
|
include:
|
20
|
-
- { rvm:
|
21
|
-
- { rvm: 2.
|
22
|
-
- { rvm: 2.
|
23
|
-
- { rvm: 2.
|
24
|
-
- { rvm: 2.3.0, env: rdoc=master }
|
20
|
+
- { rvm: 2.2.9, env: rdoc=master }
|
21
|
+
- { rvm: 2.3.6, env: rdoc=master }
|
22
|
+
- { rvm: 2.4.2, env: rdoc=master }
|
23
|
+
- { rvm: 2.5.0, env: rdoc=master }
|
25
24
|
- { rvm: ruby-head, env: rdoc=master }
|
26
|
-
- { rvm: jruby-19mode, env: rdoc=master }
|
27
25
|
- { rvm: jruby-head, env: rdoc=master }
|
28
26
|
notifications:
|
29
27
|
email:
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -103,7 +103,7 @@
|
|
103
103
|
<!-- Section constants -->
|
104
104
|
<div class="sectiontitle">Constants</div>
|
105
105
|
<table border='0' cellpadding='5'>
|
106
|
-
<%
|
106
|
+
<% constants.each do |const| %>
|
107
107
|
<tr valign='top'>
|
108
108
|
<td class="attr-name"><%= h const.name %></td>
|
109
109
|
<td>=</td>
|
@@ -182,7 +182,7 @@
|
|
182
182
|
<% end %>
|
183
183
|
|
184
184
|
<% if method.token_stream %>
|
185
|
-
<% markup = method.
|
185
|
+
<% markup = method.markup_code %>
|
186
186
|
<div class="sourcecode">
|
187
187
|
<%
|
188
188
|
# generate github link
|
@@ -209,8 +209,8 @@
|
|
209
209
|
</div>
|
210
210
|
<% end %>
|
211
211
|
</div>
|
212
|
-
<% end
|
213
|
-
<% end
|
214
|
-
<% end
|
215
|
-
<% end
|
212
|
+
<% end %><%# methods.each %>
|
213
|
+
<% end %><%# visibilities.each %>
|
214
|
+
<% end %><%# context.methods_by_type %>
|
215
|
+
<% end %><%# context.each_section %>
|
216
216
|
</div>
|
File without changes
|
File without changes
|
File without changes
|
@@ -193,6 +193,7 @@ pre
|
|
193
193
|
margin: 2em;
|
194
194
|
margin-left: 3.5em;
|
195
195
|
margin-right: 3.5em;
|
196
|
+
max-width: 980px;
|
196
197
|
}
|
197
198
|
|
198
199
|
|
@@ -361,3 +362,13 @@ tt {
|
|
361
362
|
animation-name: highlight;
|
362
363
|
animation-duration: 1s;
|
363
364
|
}
|
365
|
+
|
366
|
+
p code {
|
367
|
+
background: #eeeeee;
|
368
|
+
border-radius: 2px;
|
369
|
+
border: 1px solid #dddddd;
|
370
|
+
font-family: Consolas, Menlo, Courier, monospace;
|
371
|
+
font-size: 14px;
|
372
|
+
margin-bottom: 1px;
|
373
|
+
padding: 0 5px;
|
374
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -182,7 +182,7 @@
|
|
182
182
|
<% end %>
|
183
183
|
|
184
184
|
<% if method.token_stream %>
|
185
|
-
<% markup = method.
|
185
|
+
<% markup = method.markup_code %>
|
186
186
|
<div class="sourcecode">
|
187
187
|
<%
|
188
188
|
# generate github link
|
@@ -209,8 +209,8 @@
|
|
209
209
|
</div>
|
210
210
|
<% end %>
|
211
211
|
</div>
|
212
|
-
<% end
|
213
|
-
<% end
|
214
|
-
<% end
|
215
|
-
<% end
|
212
|
+
<% end %><%# methods.each %>
|
213
|
+
<% end %><%# visibilities.each %>
|
214
|
+
<% end %><%# context.methods_by_type %>
|
215
|
+
<% end %><%# context.each_section %>
|
216
216
|
</div>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/sdoc.rb
CHANGED
data/lib/sdoc/generator.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'erb'
|
3
2
|
require 'pathname'
|
4
3
|
require 'fileutils'
|
@@ -20,77 +19,6 @@ class RDoc::Options
|
|
20
19
|
attr_accessor :search_index
|
21
20
|
end
|
22
21
|
|
23
|
-
class RDoc::AnyMethod
|
24
|
-
|
25
|
-
TITLE_AFTER = %w(def class module)
|
26
|
-
|
27
|
-
##
|
28
|
-
# Turns the method's token stream into HTML.
|
29
|
-
#
|
30
|
-
# Prepends line numbers if +add_line_numbers+ is true.
|
31
|
-
|
32
|
-
def sdoc_markup_code
|
33
|
-
return '' unless @token_stream
|
34
|
-
|
35
|
-
src = ""
|
36
|
-
starting_title = false
|
37
|
-
|
38
|
-
@token_stream.each do |t|
|
39
|
-
next unless t
|
40
|
-
|
41
|
-
style = case t
|
42
|
-
when RDoc::RubyToken::TkFLOAT then 'ruby-number'
|
43
|
-
when RDoc::RubyToken::TkINTEGER then 'ruby-number'
|
44
|
-
when RDoc::RubyToken::TkCONSTANT then 'ruby-constant'
|
45
|
-
when RDoc::RubyToken::TkKW then 'ruby-keyword'
|
46
|
-
when RDoc::RubyToken::TkIVAR then 'ruby-ivar'
|
47
|
-
when RDoc::RubyToken::TkOp then 'ruby-operator'
|
48
|
-
when RDoc::RubyToken::TkId then 'ruby-identifier'
|
49
|
-
when RDoc::RubyToken::TkNode then 'ruby-node'
|
50
|
-
when RDoc::RubyToken::TkCOMMENT then 'ruby-comment'
|
51
|
-
when RDoc::RubyToken::TkREGEXP then 'ruby-regexp'
|
52
|
-
when RDoc::RubyToken::TkSTRING then 'ruby-string'
|
53
|
-
when RDoc::RubyToken::TkVal then 'ruby-value'
|
54
|
-
end
|
55
|
-
|
56
|
-
if RDoc::RubyToken::TkId === t && starting_title
|
57
|
-
starting_title = false
|
58
|
-
style = 'ruby-keyword ruby-title'
|
59
|
-
end
|
60
|
-
|
61
|
-
if RDoc::RubyToken::TkKW === t && TITLE_AFTER.include?(t.text)
|
62
|
-
starting_title = true
|
63
|
-
end
|
64
|
-
|
65
|
-
text = CGI.escapeHTML t.text
|
66
|
-
|
67
|
-
if style then
|
68
|
-
src << "<span class=\"#{style}\">#{text}</span>"
|
69
|
-
else
|
70
|
-
src << text
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# dedent the source
|
75
|
-
indent = src.length
|
76
|
-
lines = src.lines.to_a
|
77
|
-
lines.shift if src =~ /\A.*#\ *File/i # remove '# File' comment
|
78
|
-
lines.each do |line|
|
79
|
-
if line =~ /^ *(?=\S)/
|
80
|
-
n = $&.length
|
81
|
-
indent = n if n < indent
|
82
|
-
break if n == 0
|
83
|
-
end
|
84
|
-
end
|
85
|
-
src.gsub!(/^#{' ' * indent}/, '') if indent > 0
|
86
|
-
|
87
|
-
add_line_numbers(src) if self.class.add_line_numbers
|
88
|
-
|
89
|
-
src
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
22
|
class RDoc::Generator::SDoc
|
95
23
|
RDoc::RDoc.add_generator self
|
96
24
|
|
@@ -121,8 +49,6 @@ class RDoc::Generator::SDoc
|
|
121
49
|
attr_reader :store
|
122
50
|
|
123
51
|
def self.setup_options(options)
|
124
|
-
@github = false
|
125
|
-
|
126
52
|
opt = options.option_parser
|
127
53
|
opt.separator nil
|
128
54
|
opt.separator "SDoc generator options:"
|
data/lib/sdoc/github.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
module SDoc::GitHub
|
2
2
|
def github_url(path)
|
3
|
+
return false unless have_git?
|
4
|
+
|
3
5
|
unless @github_url_cache.has_key? path
|
4
6
|
@github_url_cache[path] = false
|
5
7
|
file = @store.find_file_named(path)
|
6
8
|
if file
|
7
9
|
base_url = repository_url(path)
|
8
10
|
if base_url
|
9
|
-
|
10
|
-
|
11
|
-
relative_url = path_relative_to_repository(path)
|
12
|
-
@github_url_cache[path] = "#{base_url}#{sha1}#{relative_url}"
|
13
|
-
end
|
11
|
+
relative_url = path_relative_to_repository(path)
|
12
|
+
@github_url_cache[path] = "#{base_url}#{last_commit_sha1}#{relative_url}"
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
@@ -24,23 +23,23 @@ module SDoc::GitHub
|
|
24
23
|
@have_git
|
25
24
|
end
|
26
25
|
|
27
|
-
def
|
28
|
-
return
|
29
|
-
|
30
|
-
|
31
|
-
`git
|
26
|
+
def last_commit_sha1
|
27
|
+
return @sha1 if defined?(@sha1)
|
28
|
+
|
29
|
+
@sha1 = Dir.chdir(base_dir) do
|
30
|
+
`git rev-parse HEAD`.chomp
|
32
31
|
end
|
33
|
-
m = s.match(/commit\s+(\S+)/)
|
34
|
-
m ? m[1] : false
|
35
32
|
end
|
36
33
|
|
37
34
|
def repository_url(path)
|
38
|
-
return
|
35
|
+
return @repository_url if defined?(@repository_url)
|
36
|
+
|
39
37
|
s = Dir.chdir(File.join(base_dir, File.dirname(path))) do
|
40
38
|
`git config --get remote.origin.url`
|
41
39
|
end
|
40
|
+
|
42
41
|
m = s.match(%r{github.com[/:](.*)\.git$})
|
43
|
-
m ? "https://github.com/#{m[1]}/blob/" : false
|
42
|
+
@repository_url = m ? "https://github.com/#{m[1]}/blob/" : false
|
44
43
|
end
|
45
44
|
|
46
45
|
def path_relative_to_repository(path)
|
data/lib/sdoc/helpers.rb
CHANGED
@@ -21,7 +21,7 @@ module SDoc::Helpers
|
|
21
21
|
#
|
22
22
|
# strip_tags("<strong>Hello world</strong>") => "Hello world"
|
23
23
|
def strip_tags(text)
|
24
|
-
text.gsub(
|
24
|
+
text.gsub(%r{</?[^>]+?>}, "")
|
25
25
|
end
|
26
26
|
|
27
27
|
# Truncates a given string. It tries to take whole sentences to have
|
data/lib/sdoc/version.rb
CHANGED
data/sdoc.gemspec
CHANGED
@@ -22,7 +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", "
|
25
|
+
s.add_runtime_dependency("rdoc", ">= 5.0")
|
26
26
|
|
27
27
|
s.files = `git ls-files`.split("\n")
|
28
28
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
data/spec/helpers_spec.rb
CHANGED
@@ -10,10 +10,12 @@ describe SDoc::Helpers do
|
|
10
10
|
describe "#strip_tags" do
|
11
11
|
it "should strip out HTML tags from the given string" do
|
12
12
|
strings = [
|
13
|
-
[ %(<strong>Hello world</strong>),
|
14
|
-
[ %(<a href="Streams.html">Streams</a> are great),
|
15
|
-
[ %(<a href="
|
16
|
-
[ %(
|
13
|
+
[ %(<strong>Hello world</strong>), "Hello world" ],
|
14
|
+
[ %(<a href="Streams.html">Streams</a> are great), "Streams are great" ],
|
15
|
+
[ %(<a href="https://github.com?x=1&y=2#123">zzak/sdoc</a> Standalone), "zzak/sdoc Standalone" ],
|
16
|
+
[ %(<h1 id="module-AR::Cb-label-Foo+Bar">AR Cb</h1>), "AR Cb" ],
|
17
|
+
[ %(<a href="../Base.html">Base</a>), "Base" ],
|
18
|
+
[ %(Some<br>\ntext), "Some\ntext" ]
|
17
19
|
]
|
18
20
|
|
19
21
|
strings.each do |(html, stripped)|
|
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: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kolesnikov
|
@@ -11,20 +11,20 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rdoc
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '5.0'
|
30
30
|
description: rdoc generator html with javascript search index.
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: 1.3.6
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.6.
|
123
|
+
rubygems_version: 2.6.12
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: rdoc html with javascript search index.
|