sdoc 2.2.0 → 2.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 002ca37375a4f9d51c68f2c7ac421cec8c4baf74171615627e828fbf8947bc48
4
- data.tar.gz: 06f44cb76f359c63d97a0b9e5c0eb5c5b06277c700928006e2e390c05955eb17
3
+ metadata.gz: 7e1e62c13ff0c78005bc5325e9d984bf418b1f565146f91612010e29d4383361
4
+ data.tar.gz: e8eac1d34aaa80065ef4f8847c97f8a98d25be9356fe56a6284e2a7bfe9a1802
5
5
  SHA512:
6
- metadata.gz: b48d64b1e6c87db2088e56c692ed31c8f85fef24e640b18a5c4f609966f7d0b912d78a2e2a973bfffc2bbbecf1ffb3bfb5f16adeecc69780f3e7286850a8f92a
7
- data.tar.gz: 9e59249e7ea77c4057c1a741e9d4dd6c6fe058ba63fe976d88e20806520d7ce8b219aa5b04acc0943b8f91b0abfb11d97e9fb2d28360381cf893a5c7f8ec3b7f
6
+ metadata.gz: a1bbbd123bcc7d34a56f6102f825168ac1315472fe0a779d3731c30de0d45645398ab504de0e6cd6c74b277676ab68173c2a1f94a8deeddc60bcbb78ead1f8a1
7
+ data.tar.gz: 87c0fa01e9068653b9f030a43ea4126d0f1de564f4efc138350660b0d51bdc8d0bab71cd6fad881f2b65ae8c134f66e920debd2204d03783360c8d8840cd320a
@@ -2,6 +2,8 @@ name: Tests
2
2
 
3
3
  on:
4
4
  push:
5
+ pull_request:
6
+ branches: [ master ]
5
7
  schedule:
6
8
  - cron: '0 0 * * *'
7
9
 
@@ -31,6 +33,7 @@ jobs:
31
33
  with:
32
34
  ruby-version: ${{ matrix.ruby }}
33
35
  bundler-cache: true
36
+ cache-version: 2
34
37
 
35
38
  - name: Test
36
39
  run: |
data/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  Master
2
2
  ======
3
3
 
4
+ 2.3.2
5
+ =====
6
+
7
+ * #184 Add support for rdoc 6.4.0 [@p8](https://github.com/p8)
8
+
9
+ 2.3.1
10
+ =====
11
+
12
+ * #183 Remove unsupported browser detection [@p8](https://github.com/p8)
13
+ * #182 Use window.location instead of Turbolinks.visit if protocol is 'file:' [@p8](https://github.com/p8)
14
+
15
+ 2.3.0
16
+ =====
17
+
18
+ * #178 Don't use rdoc 6.4.0 for now [@p8](https://github.com/p8)
19
+ * #177 Remove rake version constraint for ruby head [@p8](https://github.com/p8)
20
+ * #176 Make sidepanel work with relative paths/URLs [@p8](https://github.com/p8)
21
+ * #175 Avoid displaying source toggler for ghost methods [Robin Dupret](https://github.com/robin850)
22
+ * #174 Suppress unused variable warnings [Masataka Pocke Kuwabara](https://github.com/pocke)
23
+
4
24
  2.2.0
5
25
  =====
6
26
 
data/Gemfile CHANGED
@@ -2,9 +2,15 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rake", "< 11"
6
- gem "minitest"
5
+ gem "rack"
6
+ gem "rake"
7
7
  gem "hoe"
8
+ gem "minitest"
9
+
10
+
11
+ if RUBY_VERSION.to_f <= 2.5
12
+ gem "psych", "< 4.0"
13
+ end
8
14
 
9
15
  if ENV["rdoc"] == "master"
10
16
  gem "rdoc", :github => "ruby/rdoc"
@@ -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">
@@ -1,22 +1,14 @@
1
- <%
2
- # Turbolinks does not consider relative urls similar, resulting in page
3
- # reloads and losing the context of the panel. Emptying the rel_prefix makes
4
- # asset paths absolute. This breaks opening the docs locally. Maybe all
5
- # generated docs should be in the same folder?
6
- rel_prefix = ''
7
- %>
8
- <link rel="stylesheet" href="<%= "#{rel_prefix}/css/reset.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
9
- <link rel="stylesheet" href="<%= "#{rel_prefix}/css/panel.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
10
- <link rel="stylesheet" href="<%= "#{rel_prefix}/css/main.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
11
- <link rel="stylesheet" href="<%= "#{rel_prefix}/css/github.css" %>" type="text/css" media="screen" data-turbolinks-track="reload" />
12
- <script src="<%= "#{rel_prefix}/js/jquery-3.5.1.min.js" %>" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
13
- <script src="<%= "#{rel_prefix}/js/main.js" %>" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
14
- <script src="<%= "#{rel_prefix}/js/highlight.pack.js" %>" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
15
- <script src="<%= rel_prefix %>/js/turbolinks.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
16
- <script src="<%= rel_prefix %>/js/search_index.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
17
- <script src="<%= rel_prefix %>/js/searcher.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
18
- <script src="<%= rel_prefix %>/panel/tree.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
19
- <script src="<%= rel_prefix %>/js/searchdoc.js" type="text/javascript" charset="utf-8" data-turbolinks-track="reload"></script>
20
-
1
+ <link rel="stylesheet" href="<%= rel_prefix %>/css/reset.css" type="text/css" media="screen" />
2
+ <link rel="stylesheet" href="<%= rel_prefix %>/css/panel.css" type="text/css" media="screen" />
3
+ <link rel="stylesheet" href="<%= rel_prefix %>/css/main.css" type="text/css" media="screen" />
4
+ <link rel="stylesheet" href="<%= rel_prefix %>/css/github.css" type="text/css" media="screen" />
5
+ <script src="<%= rel_prefix %>/js/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
6
+ <script src="<%= rel_prefix %>/js/main.js" type="text/javascript" charset="utf-8"></script>
7
+ <script src="<%= rel_prefix %>/js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
8
+ <script src="<%= rel_prefix %>/js/turbolinks.js" type="text/javascript" charset="utf-8"></script>
9
+ <script src="<%= rel_prefix %>/js/search_index.js" type="text/javascript" charset="utf-8"></script>
10
+ <script src="<%= rel_prefix %>/js/searcher.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="<%= rel_prefix %>/panel/tree.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="<%= rel_prefix %>/js/searchdoc.js" type="text/javascript" charset="utf-8"></script>
21
13
  <meta name="data-rel-prefix" content="<%= rel_prefix %>/">
22
14
  <meta name="data-tree-keys" content='<%= tree_keys %>'>
@@ -31,7 +31,7 @@ document.addEventListener("turbolinks:load", function() {
31
31
  // Only initialize panel if not yet initialized
32
32
  if(!$('#panel .tree ul li').length) {
33
33
  $('#links').hide();
34
- var panel = new Searchdoc.Panel($('#panel'), search_data, tree, $('meta[name="data-rel-prefix"]').attr("content"));
34
+ var panel = new Searchdoc.Panel($('#panel'), search_data, tree);
35
35
  var s = window.location.search.match(/\?q=([^&]+)/);
36
36
  if (s) {
37
37
  s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
@@ -89,7 +89,6 @@ Searchdoc.Navigation = new function() {
89
89
  };
90
90
 
91
91
  this.startMoveTimeout = function(isDown) {
92
- if (!$.browser.mozilla && !$.browser.opera) return;
93
92
  if (this.moveTimeout) this.clearMoveTimeout();
94
93
  var _this = this;
95
94
 
@@ -135,11 +134,10 @@ function scrollIntoView(element, view) {
135
134
 
136
135
  // panel.js -----------------------------------------------
137
136
 
138
- Searchdoc.Panel = function(element, data, tree, prefix) {
137
+ Searchdoc.Panel = function(element, data, tree) {
139
138
  this.$element = $(element);
140
139
  this.$input = $('input', element).eq(0);
141
140
  this.$result = $('.result ul', element).eq(0);
142
- this.prefix = prefix;
143
141
  this.$current = null;
144
142
  this.$view = this.$result.parent();
145
143
  this.data = data;
@@ -232,12 +230,17 @@ Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
232
230
  };
233
231
 
234
232
  this.open = function(src) {
235
- 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
+ }
236
239
  if (this.highlight) this.highlight(src);
237
240
  };
238
241
 
239
242
  this.select = function() {
240
- this.open(this.$current.data('path'));
243
+ this.open(this.$current.attr('data-path'));
241
244
  };
242
245
 
243
246
  this.move = function(isDown) {
@@ -266,7 +269,7 @@ Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
266
269
  html += hlt(result.namespace) + '</p>';
267
270
  if (result.snippet) html += '<p class="snippet">' + stripHTML(result.snippet) + '</p>';
268
271
  li.innerHTML = html;
269
- jQuery.data(li, 'path', result.path);
272
+ $(li).attr('data-path', result.path)
270
273
  return li;
271
274
  }
272
275
 
@@ -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">
@@ -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
@@ -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.2.0'
2
+ VERSION = '2.3.2'
3
3
  end
data/sdoc.gemspec CHANGED
@@ -24,8 +24,6 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_runtime_dependency("rdoc", ">= 5.0")
26
26
 
27
- s.add_development_dependency("rack")
28
-
29
27
  s.files = `git ls-files`.split("\n")
30
28
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
31
29
  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.2.0
4
+ version: 2.3.2
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-05-21 00:00:00.000000000 Z
14
+ date: 2022-04-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rdoc
@@ -27,20 +27,6 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '5.0'
30
- - !ruby/object:Gem::Dependency
31
- name: rack
32
- requirement: !ruby/object:Gem::Requirement
33
- requirements:
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: '0'
37
- type: :development
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
30
  description: rdoc generator html with javascript search index.
45
31
  email: voloko@gmail.com mail@zzak.io
46
32
  executables:
@@ -137,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
123
  - !ruby/object:Gem::Version
138
124
  version: 1.3.6
139
125
  requirements: []
140
- rubygems_version: 3.0.3
126
+ rubygems_version: 3.0.3.1
141
127
  signing_key:
142
128
  specification_version: 4
143
129
  summary: rdoc html with javascript search index.