bitclust-core 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 813fd0a958a2ff7b7f259e9b5062320fe4843e83
4
- data.tar.gz: 3bf8717df91192350fb707e2786e562cbc348d7c
3
+ metadata.gz: 225e62375e6846b326301d1189046131860d338a
4
+ data.tar.gz: 3971f2a4f69e7e961b4bd9383ca3dd1314206a78
5
5
  SHA512:
6
- metadata.gz: 429bcf55db96845ff5a694c28c034f1467aa3e545c95f2aa6a5d49956211c604aef052efd13c760a4094d3e4aa1fb55e4d6e9ee219457420d2ad15fc1c7f8d8c
7
- data.tar.gz: 2d3fb710287a7ccc05a007c399633ac3a583f2e48644ccb6346d93315251798810940ad0f4921b15e87bca2a62d639eb7596046752f02956d2440981bcf44027
6
+ metadata.gz: ac99e00ae2d24e250c754408433cdcdc1265993c8cedb90054db22acb8af9a245a5cc57a22ef215b6fe561a2928d3285fca6b44eb533c08b602e6835dea1c0aa
7
+ data.tar.gz: cfb571a4a3c54fdc54864fbc089048cf69cd9102b8bd0c45f93fc73f13459b73b49a872e1993e3cf7aa955a779a84503e4d4513d9ffb77d2c0c15ecadc142680
data/README CHANGED
@@ -5,7 +5,7 @@ About
5
5
  -----
6
6
 
7
7
  BitClust is the Next-Generation Ruby reference manual interface.
8
- For more details, see https://bugs.ruby-lang.org/projects/rurema/wiki/BitClust .
8
+ For more details, https://github.com/rurema/doctree/wiki/BitClust .
9
9
 
10
10
 
11
11
  License
data/bitclust.gemspec CHANGED
@@ -1,6 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require 'rake'
4
3
  require "bitclust/version"
5
4
 
6
5
  Gem::Specification.new do |s|
@@ -17,9 +16,9 @@ EOD
17
16
 
18
17
  s.rubyforge_project = ""
19
18
 
20
- s.files = FileList["ChangeLog", "Gemfile", "README", "Rakefile", "bitclust.gemspec",
21
- "data/**/*", "lib/**/*.rb", "theme/**/*"].exclude("*~")
22
- s.test_files = FileList["test/**/*.rb"].exclude("*~")
19
+ s.files = Dir["ChangeLog", "Gemfile", "README", "Rakefile", "bitclust.gemspec",
20
+ "data/**/*", "lib/**/*.rb", "theme/**/*"].reject {|f| f =~ /.*~/ }
21
+ s.test_files = Dir["test/**/*.rb"].reject {|f| f =~ /.*~/ }
23
22
  s.executables = ["bitclust"]
24
23
  s.require_paths = ["lib"]
25
24
 
@@ -5,6 +5,9 @@
5
5
  <meta http-equiv="Content-Language" content="ja-JP">
6
6
  <link rel="stylesheet" type="text/css" href="<%=h css_url() %>">
7
7
  <link rel="icon" type="image/png" href="<%=h favicon_url() %>">
8
+ <% if @conf[:canonical_base_url] %>
9
+ <link rel="canonical" href="<%= canonical_url() %>">
10
+ <% end %>
8
11
  <title><%=h @title %> (Ruby <%=h ruby_version %>)</title>
9
12
  </head>
10
13
  <body>
@@ -214,13 +214,13 @@ module BitClust
214
214
  end
215
215
 
216
216
  def included_modules
217
- list = ancestors().select {|c| c.module? }
217
+ list = ancestors().select(&:module?)
218
218
  list.delete self
219
219
  list
220
220
  end
221
221
 
222
222
  def extended_modules
223
- ancestors().select {|c| c.class? }.map {|c| c.extended }.flatten
223
+ ancestors().select(&:class?).map(&:extended).flatten
224
224
  end
225
225
 
226
226
  def entries(level = 0)
@@ -254,7 +254,7 @@ module BitClust
254
254
  mf = []
255
255
  c = []; v = []
256
256
  added = []
257
- entries(level).sort_by{|e| e.name}.each do |m|
257
+ entries(level).sort_by(&:name).each do |m|
258
258
  case m.kind
259
259
  when :defined, :redefined
260
260
  case m.type
@@ -280,42 +280,42 @@ module BitClust
280
280
 
281
281
  def singleton_methods(level = 0)
282
282
  # FIXME: inheritance
283
- entries(level).select {|m| m.singleton_method? }.sort_by {|entry| entry.sort_key }
283
+ entries(level).select(&:singleton_method?).sort_by(&:sort_key)
284
284
  end
285
285
 
286
286
  def public_singleton_methods(level = 0)
287
287
  # FIXME: inheritance
288
- entries(level).select {|m| m.public_singleton_method? }.sort_by {|entry| entry.sort_key }
288
+ entries(level).select(&:public_singleton_method?).sort_by(&:sort_key)
289
289
  end
290
290
 
291
291
  def instance_methods(level = 0)
292
292
  # FIXME: inheritance
293
- entries(level).select {|m| m.instance_method? }.sort_by {|entry| entry.sort_key }
293
+ entries(level).select(&:instance_method?).sort_by(&:sort_key)
294
294
  end
295
295
 
296
296
  def private_singleton_methods(level = 0)
297
297
  # FIXME: inheritance
298
- entries(level).select {|m| m.private_singleton_method? }.sort_by {|entry| entry.sort_key }
298
+ entries(level).select(&:private_singleton_method?).sort_by(&:sort_key)
299
299
  end
300
300
 
301
301
  def public_instance_methods(level = 0)
302
302
  # FIXME: inheritance
303
- entries(level).select {|m| m.public_instance_method? }.sort_by {|entry| entry.sort_key }
303
+ entries(level).select(&:public_instance_method?).sort_by(&:sort_key)
304
304
  end
305
305
 
306
306
  def private_instance_methods(level = 0)
307
307
  # FIXME: inheritance
308
- entries(level).select {|m| m.private_instance_method? }.sort_by {|entry| entry.sort_key }
308
+ entries(level).select(&:private_instance_method?).sort_by(&:sort_key)
309
309
  end
310
310
 
311
311
  alias private_methods private_instance_methods
312
312
 
313
313
  def constants(level = 0)
314
- entries(level).select {|m| m.constant? }.sort_by {|entry| entry.sort_key }
314
+ entries(level).select(&:constant?).sort_by(&:sort_key)
315
315
  end
316
316
 
317
317
  def special_variables
318
- entries().select {|m| m.special_variable? }.sort_by {|entry| entry.sort_key }
318
+ entries().select(&:special_variable?).sort_by(&:sort_key)
319
319
  end
320
320
 
321
321
  def singleton_method?(name, inherit = true)
@@ -170,7 +170,6 @@ module BitClust
170
170
  def item_list(level = 0, indent = true)
171
171
  open_tag = nil
172
172
  close_tag = nil
173
- pattern = nil
174
173
  case @f.peek
175
174
  when /\A(\s+)\*\s/
176
175
  open_tag = "<ul>"
@@ -428,6 +427,8 @@ module BitClust
428
427
  rfc_link(arg)
429
428
  when 'ruby-list', 'ruby-dev', 'ruby-ext', 'ruby-talk', 'ruby-core'
430
429
  blade_link(type, arg)
430
+ when 'feature', 'bug'
431
+ bugs_link(type, arg)
431
432
  else
432
433
  "[[#{escape_html(link)}]]"
433
434
  end
@@ -517,6 +518,13 @@ module BitClust
517
518
  %Q(<a class="external" href="#{escape_html(url)}">#{escape_html("#{m[1]}(#{m[2]})")}</a>)
518
519
  end
519
520
 
521
+ BUGS_URL = "https://bugs.ruby-lang.org/issues/%s"
522
+
523
+ def bugs_link(type, id)
524
+ url = sprintf(BUGS_URL, id)
525
+ %Q(<a class="external" href="#{escape_html(url)}">[#{type}##{id}]</a>)
526
+ end
527
+
520
528
  def rdoc_url(method_id, version)
521
529
  cname, tmark, mname, libname = methodid2specparts(method_id)
522
530
  tchar = typemark2char(tmark) == 'i' ? 'i' : 'c'
@@ -166,6 +166,10 @@ module BitClust
166
166
  raise unless %r!\A[-\w/]+\z! =~ name
167
167
  "#{@cgi_url}/#{name}"
168
168
  end
169
+
170
+ def canonical_url(current_url)
171
+ current_url
172
+ end
169
173
  end
170
174
 
171
175
 
@@ -327,6 +331,14 @@ module BitClust
327
331
  @urlmapper.favicon_url
328
332
  end
329
333
 
334
+ def current_url
335
+ raise NotImplementedError, "Must implement this method in subclass"
336
+ end
337
+
338
+ def canonical_url
339
+ @urlmapper.canonical_url(current_url)
340
+ end
341
+
330
342
  def opensearchdescription_url
331
343
  @urlmapper.opensearchdescription_url
332
344
  end
@@ -452,6 +464,10 @@ module BitClust
452
464
  def body
453
465
  run_template('library-index')
454
466
  end
467
+
468
+ def current_url
469
+ @urlmapper.library_index_url
470
+ end
455
471
  end
456
472
 
457
473
  class LibraryScreen < EntryBoundScreen
@@ -473,6 +489,10 @@ module BitClust
473
489
  draw_treed_entries(roots, tree, &block)
474
490
  end
475
491
 
492
+ def current_url
493
+ @urlmapper.library_url(@entry.name)
494
+ end
495
+
476
496
  private
477
497
 
478
498
  def draw_treed_entries(entries, tree, indent = 0, &block)
@@ -487,6 +507,10 @@ module BitClust
487
507
  def body
488
508
  run_template('class-index')
489
509
  end
510
+
511
+ def current_url
512
+ @urlmapper.class_url(@entries.first.name)
513
+ end
490
514
  end
491
515
 
492
516
  class OpenSearchDescriptionScreen < TemplateScreen
@@ -529,6 +553,10 @@ module BitClust
529
553
  def body
530
554
  run_template('class')
531
555
  end
556
+
557
+ def current_url
558
+ @urlmapper.class_url(@entry.name)
559
+ end
532
560
  end
533
561
 
534
562
  class MethodScreen < TemplateScreen
@@ -549,18 +577,32 @@ module BitClust
549
577
  def body
550
578
  run_template('method')
551
579
  end
580
+
581
+ def current_url
582
+ ent = @entries.first
583
+ spec = ent ? ent.spec_string : ""
584
+ @urlmapper.method_url(spec)
585
+ end
552
586
  end
553
587
 
554
588
  class FunctionScreen < EntryBoundScreen
555
589
  def body
556
590
  run_template('function')
557
591
  end
592
+
593
+ def current_url
594
+ @urlmapper.function_url(@entry.name)
595
+ end
558
596
  end
559
597
 
560
598
  class FunctionIndexScreen < IndexScreen
561
599
  def body
562
600
  run_template('function-index')
563
601
  end
602
+
603
+ def current_url
604
+ @urlmapper.function_index_url
605
+ end
564
606
  end
565
607
 
566
608
  class DocScreen < EntryBoundScreen
@@ -581,5 +623,9 @@ module BitClust
581
623
  h = {:force => true, :catalog => message_catalog() }.merge(@conf)
582
624
  RDCompiler.new(@urlmapper, @hlevel, h)
583
625
  end
626
+
627
+ def current_url
628
+ @urlmapper.document_url(@entry.name)
629
+ end
584
630
  end
585
631
  end
@@ -19,7 +19,8 @@ module BitClust
19
19
  @prepare = nil
20
20
  @cleanup = nil
21
21
  @purge = nil
22
- @versions = ["2.0.0", "2.1.0", "2.2.0"]
22
+ @versions = ["2.1.0", "2.2.0", "2.3.0"]
23
+ @update = true
23
24
  @parser.banner = "Usage: #{File.basename($0, '.*')} setup [options]"
24
25
  @parser.on('--prepare', 'Prepare config file and checkout repository. Do not create database.') {
25
26
  @prepare = true
@@ -33,6 +34,9 @@ module BitClust
33
34
  @parser.on('--versions=V1,V2,...', "Specify versions. [#{@versions.join(',')}]") {|versions|
34
35
  @versions = versions.split(",")
35
36
  }
37
+ @parser.on('--no-update', 'Do not update document repository') {
38
+ @update = false
39
+ }
36
40
  end
37
41
 
38
42
  def exec(argv, options)
@@ -112,6 +116,7 @@ module BitClust
112
116
 
113
117
  succeeded = false
114
118
  if (rubydoc_dir + ".git").exist?
119
+ return unless @update
115
120
  Dir.chdir(rubydoc_dir) do
116
121
  succeeded = system("git", "pull", "--rebase")
117
122
  end
@@ -27,6 +27,7 @@ module BitClust
27
27
  @bitclust_html_base = ""
28
28
  @suffix = h[:suffix]
29
29
  @fs_casesensitive = h[:fs_casesensitive]
30
+ @canonical_base_url = h[:canonical_base_url]
30
31
  end
31
32
 
32
33
  def library_url(name)
@@ -74,6 +75,10 @@ module BitClust
74
75
  @bitclust_html_base + "/function/#{html_filename("index", @suffix)}"
75
76
  end
76
77
 
78
+ def canonical_url(current_url)
79
+ (@canonical_base_url + "/#{current_url}").sub(@bitclust_html_base, "").sub(/([^:])\/\/+/, "\\1/")
80
+ end
81
+
77
82
  def encodename_package(str)
78
83
  if @fs_casesensitive
79
84
  encodename_url(str)
@@ -117,6 +122,9 @@ module BitClust
117
122
  @parser.on('--fs-casesensitive', 'Filesystem is case-sensitive') do
118
123
  @fs_casesensitive = true
119
124
  end
125
+ @parser.on('--canonical-base-url=URL', 'Canonical base URL') do |url|
126
+ @canonical_base_url = url
127
+ end
120
128
  @parser.on('--[no-]quiet', 'Be quiet') do |quiet|
121
129
  @verbose = !quiet
122
130
  end
@@ -187,7 +195,8 @@ module BitClust
187
195
  :favicon_url => 'rurema.png',
188
196
  :cgi_url => '',
189
197
  :tochm_mode => true,
190
- :fs_casesensitive => @fs_casesensitive
198
+ :fs_casesensitive => @fs_casesensitive,
199
+ :canonical_base_url => @canonical_base_url
191
200
  }
192
201
  @manager_config[:urlmapper] = URLMapperEx.new(@manager_config)
193
202
  @urlmapper = @manager_config[:urlmapper]
@@ -1,3 +1,3 @@
1
1
  module BitClust
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
@@ -526,6 +526,28 @@ HERE
526
526
  </li>
527
527
  </ol>
528
528
 
529
+ HERE
530
+ assert_compiled_source(expected, src)
531
+ end
532
+
533
+ def test_olist_ulist
534
+ src = <<HERE
535
+ (1) aaa
536
+ (1) bbb
537
+ (1) ccc
538
+ * xxx
539
+ * yyy
540
+ HERE
541
+ expected = <<HERE
542
+ <ol>
543
+ <li>aaa</li>
544
+ <li>bbb</li>
545
+ <li>ccc<ul>
546
+ <li>xxx</li>
547
+ <li>yyy</li>
548
+ </ul>
549
+ </li>
550
+ </ol>
529
551
  HERE
530
552
  assert_compiled_source(expected, src)
531
553
  end
@@ -564,7 +586,9 @@ HERE
564
586
  "continuity" => ['[[c:String]][[c:String]]', '<a href="dummy/class/String">String</a><a href="dummy/class/String">String</a>'],
565
587
  "constant" => ['[[m:File::SEPARATOR]]', '<a href="dummy/method/File/c/SEPARATOR">File::SEPARATOR</a>'],
566
588
  "url" => ['[[url:http://i.loveruby.net]]', '<a class="external" href="http://i.loveruby.net">http://i.loveruby.net</a>'],
567
- "ruby-list" => ['[[ruby-list:12345]]', '<a class="external" href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/12345">[ruby-list:12345]</a>'],)
589
+ "ruby-list" => ['[[ruby-list:12345]]', '<a class="external" href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/12345">[ruby-list:12345]</a>'],
590
+ "bugs.r-l.o feature" => ['[[feature:12345]]', '<a class="external" href="https://bugs.ruby-lang.org/issues/12345">[feature#12345]</a>'],
591
+ "bugs.r-l.o bug" => ['[[bug:12345]]', '<a class="external" href="https://bugs.ruby-lang.org/issues/12345">[bug#12345]</a>'],)
568
592
  def test_bracket_link(data)
569
593
  target, expected = data
570
594
  assert_equal(expected, @c.send(:compile_text, target), target)
@@ -575,7 +599,7 @@ HERE
575
599
  "ref class" => ['[[ref:c:Hoge#frag]]', '<a href="dummy/class/Hoge#frag">.*</a>'],
576
600
  "ref special var" => ['[[ref:m:$~#frag]]', '<a href="dummy/method/Kernel/v/=7e#frag">.*</a>'],
577
601
  "ref library" => ['[[ref:lib:jcode#frag]]', '<a href="dummy/library/jcode#frag">.*</a>'],
578
- "ref class" => ['[[ref:c:Hoge]]', 'compileerror'],
602
+ "ref class error" => ['[[ref:c:Hoge]]', 'compileerror'],
579
603
  "ref ref" => ['[[ref:ref:hoge/bar#frag]]', 'compileerror'],)
580
604
  def test_bracket_link_doc(data)
581
605
  target, expected = data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitclust-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - http://bugs.ruby-lang.org/projects/rurema
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-21 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -239,23 +239,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  requirements: []
241
241
  rubyforge_project: ''
242
- rubygems_version: 2.5.1
242
+ rubygems_version: 2.6.4
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: BitClust is a rurema document processor.
246
246
  test_files:
247
+ - test/test_preprocessor.rb
247
248
  - test/run_test.rb
248
- - test/test_bitclust.rb
249
249
  - test/test_entry.rb
250
+ - test/test_methoddatabase.rb
250
251
  - test/test_functiondatabase.rb
252
+ - test/test_refsdatabase.rb
253
+ - test/test_bitclust.rb
251
254
  - test/test_functionreferenceparser.rb
252
- - test/test_libraryentry.rb
253
- - test/test_methoddatabase.rb
254
255
  - test/test_methodsignature.rb
256
+ - test/test_rrdparser.rb
257
+ - test/test_simplesearcher.rb
255
258
  - test/test_nameutils.rb
256
- - test/test_preprocessor.rb
257
259
  - test/test_rdcompiler.rb
258
- - test/test_refsdatabase.rb
259
- - test/test_rrdparser.rb
260
260
  - test/test_runner.rb
261
- - test/test_simplesearcher.rb
261
+ - test/test_libraryentry.rb