rdoc 6.1.2.1 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54d60de29802a75760a08186d382740d5d014585d0efe335468df555b45dae16
4
- data.tar.gz: ec17fdfdc033a831cb1da2e165f2c3a19b6053de2a193dadb411f40262d3699d
3
+ metadata.gz: c71da0922078855b23bba9eb9f3671d5f04abb40c690eab20382c812b1b6aacc
4
+ data.tar.gz: bf58da8ba529883aa44e4ddc5e7c88a9671e508993bfd62142813cc661bbe62c
5
5
  SHA512:
6
- metadata.gz: 8e5e1f913c3c646eb519a02fa6544aa86bfa35abe5fd650bc23f1b74413a13baef80540cd1ec843bb7354feb741bf0a08194f47a857986a258c22268a9860ed0
7
- data.tar.gz: 50ce20a636642b3dc927c730a78f8f04931af9ba08b9cd7606fb84a9378ce49d613252bbaa1f3438c010e7b9365d9cc5ebaace882045ba1085ddc1415ea78240
6
+ metadata.gz: f343d3101a0fbd05fc6d8675d9a72cc2aed5ff794258fc3fbe9f8658032857d61a68350ea09e29b84c02789cec3f0f8a6e83faf29faf41d2a00e6cbad07435c5
7
+ data.tar.gz: f0f506c54e2ebc80b69d0d26104c44ae3ecc5cefcaa90a6cd4364f8e4660fc8021e6c7426bd63363519a217728a8c3ac0be217f4d28b6b3f1c4e9b1ff6f34c26
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.rbc
2
2
  *.swp
3
+ /coverage
3
4
  .DS_Store
4
5
  /.rdoc
5
6
  /.rvmrc
data/Gemfile CHANGED
@@ -1,3 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :development do
6
+ gem "rake"
7
+ gem "racc", "> 1.4.10"
8
+ gem "kpeg"
9
+ gem "test-unit"
10
+ gem "minitest" # for test_rdoc_rubygems_hook.rb
11
+ gem "rubocop"
12
+ end
data/README.rdoc CHANGED
@@ -3,7 +3,6 @@
3
3
  home :: https://github.com/ruby/rdoc
4
4
  rdoc :: https://ruby.github.io/rdoc
5
5
  bugs :: https://github.com/ruby/rdoc/issues
6
- build status :: {<img src="https://travis-ci.org/ruby/rdoc.svg?branch=master" alt="Build Status on Travis CI" />}[https://travis-ci.org/ruby/rdoc] {<img src="https://ci.appveyor.com/api/projects/status/github/ruby/rdoc?branch=master&svg=true" alt="Build Status on AppVeyor" />}[https://ci.appveyor.com/project/ruby/rdoc]
7
6
  code quality :: {<img src="https://codeclimate.com/github/ruby/rdoc/badges/gpa.svg" alt="Code Climate">}[https://codeclimate.com/github/ruby/rdoc]
8
7
 
9
8
  == Description
data/Rakefile CHANGED
@@ -35,7 +35,7 @@ task ghpages: :rdoc do
35
35
  end
36
36
 
37
37
  Rake::TestTask.new(:test) do |t|
38
- t.libs << "test"
38
+ t.libs << "test/rdoc"
39
39
  t.verbose = true
40
40
  t.test_files = FileList['test/**/test_*.rb']
41
41
  end
@@ -210,7 +210,7 @@ class RDoc::ClassModule < RDoc::Context
210
210
  normalize_comment comment
211
211
  end
212
212
 
213
- comment = "#{@comment}\n---\n#{comment}" unless @comment.empty?
213
+ comment = "#{@comment.to_s}\n---\n#{comment.to_s}" unless @comment.empty?
214
214
 
215
215
  super comment
216
216
  end
data/lib/rdoc/comment.rb CHANGED
@@ -33,6 +33,11 @@ class RDoc::Comment
33
33
 
34
34
  attr_reader :text
35
35
 
36
+ ##
37
+ # Alias for text
38
+
39
+ alias to_s text
40
+
36
41
  ##
37
42
  # Overrides the content returned by #parse. Use when there is no #text
38
43
  # source for this comment
@@ -43,9 +48,10 @@ class RDoc::Comment
43
48
  # Creates a new comment with +text+ that is found in the RDoc::TopLevel
44
49
  # +location+.
45
50
 
46
- def initialize text = nil, location = nil
51
+ def initialize text = nil, location = nil, language = nil
47
52
  @location = location
48
53
  @text = text.nil? ? nil : text.dup
54
+ @language = language
49
55
 
50
56
  @document = nil
51
57
  @format = 'rdoc'
@@ -74,6 +74,9 @@ h6:target {
74
74
  code,
75
75
  pre {
76
76
  font-family: "Source Code Pro", Monaco, monospace;
77
+ background-color: rgba(27,31,35,0.05);
78
+ padding: 0em 0.2em;
79
+ border-radius: 0.2em;
77
80
  }
78
81
 
79
82
  /* @group Generic Classes */
@@ -103,7 +106,7 @@ pre {
103
106
 
104
107
  .missing-docs {
105
108
  font-size: 120%;
106
- background: white url(images/wrench_orange.png) no-repeat 4px center;
109
+ background: white url(../images/wrench_orange.png) no-repeat 4px center;
107
110
  color: #ccc;
108
111
  line-height: 2em;
109
112
  border: 1px solid #d00;
@@ -147,11 +150,11 @@ pre {
147
150
  .table-of-contents li .toc-toggle {
148
151
  width: 16px;
149
152
  height: 16px;
150
- background: url(images/add.png) no-repeat;
153
+ background: url(../images/add.png) no-repeat;
151
154
  }
152
155
 
153
156
  .table-of-contents li .toc-toggle.open {
154
- background: url(images/delete.png) no-repeat;
157
+ background: url(../images/delete.png) no-repeat;
155
158
  }
156
159
 
157
160
  /* @end */
@@ -273,8 +276,13 @@ ul.link-list .type {
273
276
  -webkit-border-radius: 5px;
274
277
  }
275
278
 
279
+ dl.label-list dt {
280
+ float: left;
281
+ margin-right: 1em;
282
+ }
283
+
276
284
  .calls-super {
277
- background: url(images/arrow_up.png) no-repeat right center;
285
+ background: url(../images/arrow_up.png) no-repeat right center;
278
286
  }
279
287
 
280
288
  /* @end */
@@ -500,7 +508,7 @@ main .method-click-advice {
500
508
  visibility: hidden;
501
509
  padding-right: 20px;
502
510
  line-height: 20px;
503
- background: url(images/zoom.png) no-repeat right top;
511
+ background: url(../images/zoom.png) no-repeat right top;
504
512
  }
505
513
  main .method-heading:hover .method-click-advice {
506
514
  visibility: visible;
@@ -80,10 +80,6 @@ class RDoc::Markup::Parser
80
80
  @binary_input = nil
81
81
  @current_token = nil
82
82
  @debug = false
83
- @input = nil
84
- @input_encoding = nil
85
- @line = 0
86
- @line_pos = 0
87
83
  @s = nil
88
84
  @tokens = []
89
85
  end
@@ -319,13 +315,6 @@ class RDoc::Markup::Parser
319
315
  verbatim
320
316
  end
321
317
 
322
- ##
323
- # The character offset for the input string at the given +byte_offset+
324
-
325
- def char_pos byte_offset
326
- @input.byteslice(0, byte_offset).length
327
- end
328
-
329
318
  ##
330
319
  # Pulls the next token from the stream.
331
320
 
@@ -424,15 +413,53 @@ class RDoc::Markup::Parser
424
413
  token
425
414
  end
426
415
 
416
+ ##
417
+ # A simple wrapper of StringScanner that is aware of the current column and lineno
418
+
419
+ class MyStringScanner
420
+ def initialize(input)
421
+ @line = @column = 0
422
+ @s = StringScanner.new input
423
+ end
424
+
425
+ def scan(re)
426
+ ret = @s.scan(re)
427
+ @column += ret.length if ret
428
+ ret
429
+ end
430
+
431
+ def unscan(s)
432
+ @s.pos -= s.bytesize
433
+ @column -= s.length
434
+ end
435
+
436
+ def pos
437
+ [@column, @line]
438
+ end
439
+
440
+ def newline!
441
+ @column = 0
442
+ @line += 1
443
+ end
444
+
445
+ def eos?
446
+ @s.eos?
447
+ end
448
+
449
+ def matched
450
+ @s.matched
451
+ end
452
+
453
+ def [](i)
454
+ @s[i]
455
+ end
456
+ end
457
+
427
458
  ##
428
459
  # Creates the StringScanner
429
460
 
430
461
  def setup_scanner input
431
- @line = 0
432
- @line_pos = 0
433
- @input = input.dup
434
-
435
- @s = StringScanner.new input
462
+ @s = MyStringScanner.new input
436
463
  end
437
464
 
438
465
  ##
@@ -467,31 +494,30 @@ class RDoc::Markup::Parser
467
494
  @tokens << case
468
495
  # [CR]LF => :NEWLINE
469
496
  when @s.scan(/\r?\n/) then
470
- token = [:NEWLINE, @s.matched, *token_pos(pos)]
471
- @line_pos = char_pos @s.pos
472
- @line += 1
497
+ token = [:NEWLINE, @s.matched, *pos]
498
+ @s.newline!
473
499
  token
474
500
  # === text => :HEADER then :TEXT
475
501
  when @s.scan(/(=+)(\s*)/) then
476
502
  level = @s[1].length
477
- header = [:HEADER, level, *token_pos(pos)]
503
+ header = [:HEADER, level, *pos]
478
504
 
479
505
  if @s[2] =~ /^\r?\n/ then
480
- @s.pos -= @s[2].length
506
+ @s.unscan(@s[2])
481
507
  header
482
508
  else
483
509
  pos = @s.pos
484
510
  @s.scan(/.*/)
485
511
  @tokens << header
486
- [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)]
512
+ [:TEXT, @s.matched.sub(/\r$/, ''), *pos]
487
513
  end
488
514
  # --- (at least 3) and nothing else on the line => :RULE
489
515
  when @s.scan(/(-{3,}) *\r?$/) then
490
- [:RULE, @s[1].length - 2, *token_pos(pos)]
516
+ [:RULE, @s[1].length - 2, *pos]
491
517
  # * or - followed by white space and text => :BULLET
492
518
  when @s.scan(/([*-]) +(\S)/) then
493
- @s.pos -= @s[2].bytesize # unget \S
494
- [:BULLET, @s[1], *token_pos(pos)]
519
+ @s.unscan(@s[2])
520
+ [:BULLET, @s[1], *pos]
495
521
  # A. text, a. text, 12. text => :UALPHA, :LALPHA, :NUMBER
496
522
  when @s.scan(/([a-z]|\d+)\. +(\S)/i) then
497
523
  # FIXME if tab(s), the column will be wrong
@@ -500,7 +526,7 @@ class RDoc::Markup::Parser
500
526
  # before (and provide a check for that at least in debug
501
527
  # mode)
502
528
  list_label = @s[1]
503
- @s.pos -= @s[2].bytesize # unget \S
529
+ @s.unscan(@s[2])
504
530
  list_type =
505
531
  case list_label
506
532
  when /[a-z]/ then :LALPHA
@@ -509,24 +535,24 @@ class RDoc::Markup::Parser
509
535
  else
510
536
  raise ParseError, "BUG token #{list_label}"
511
537
  end
512
- [list_type, list_label, *token_pos(pos)]
538
+ [list_type, list_label, *pos]
513
539
  # [text] followed by spaces or end of line => :LABEL
514
540
  when @s.scan(/\[(.*?)\]( +|\r?$)/) then
515
- [:LABEL, @s[1], *token_pos(pos)]
541
+ [:LABEL, @s[1], *pos]
516
542
  # text:: followed by spaces or end of line => :NOTE
517
543
  when @s.scan(/(.*?)::( +|\r?$)/) then
518
- [:NOTE, @s[1], *token_pos(pos)]
544
+ [:NOTE, @s[1], *pos]
519
545
  # >>> followed by end of line => :BLOCKQUOTE
520
546
  when @s.scan(/>>> *(\w+)?$/) then
521
- [:BLOCKQUOTE, @s[1], *token_pos(pos)]
547
+ [:BLOCKQUOTE, @s[1], *pos]
522
548
  # anything else: :TEXT
523
549
  else
524
550
  @s.scan(/(.*?)( )?\r?$/)
525
- token = [:TEXT, @s[1], *token_pos(pos)]
551
+ token = [:TEXT, @s[1], *pos]
526
552
 
527
553
  if @s[2] then
528
554
  @tokens << token
529
- [:BREAK, @s[2], *token_pos(pos + @s[1].length)]
555
+ [:BREAK, @s[2], pos[0] + @s[1].length, pos[1]]
530
556
  else
531
557
  token
532
558
  end
@@ -536,16 +562,6 @@ class RDoc::Markup::Parser
536
562
  self
537
563
  end
538
564
 
539
- ##
540
- # Calculates the column (by character) and line of the current token based
541
- # on +byte_offset+.
542
-
543
- def token_pos byte_offset
544
- offset = char_pos byte_offset
545
-
546
- [offset - @line_pos, @line]
547
- end
548
-
549
565
  ##
550
566
  # Returns the current token to the token stream
551
567
 
@@ -153,7 +153,11 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
153
153
  ref.sections.any? { |section| label == section.title } then
154
154
  path << "##{label}"
155
155
  else
156
- path << "#label-#{label}"
156
+ if ref.respond_to?(:aref)
157
+ path << "##{ref.aref}-label-#{label}"
158
+ else
159
+ path << "#label-#{label}"
160
+ end
157
161
  end if label
158
162
 
159
163
  "<a href=\"#{path}\">#{text}</a>"
data/lib/rdoc/markup.rb CHANGED
@@ -849,8 +849,6 @@ https://github.com/ruby/rdoc/issues
849
849
 
850
850
  # Formatters
851
851
  autoload :Formatter, 'rdoc/markup/formatter'
852
- autoload :FormatterTestCase, 'rdoc/markup/formatter_test_case'
853
- autoload :TextFormatterTestCase, 'rdoc/markup/text_formatter_test_case'
854
852
 
855
853
  autoload :ToAnsi, 'rdoc/markup/to_ansi'
856
854
  autoload :ToBs, 'rdoc/markup/to_bs'
data/lib/rdoc/options.rb CHANGED
@@ -344,7 +344,10 @@ class RDoc::Options
344
344
 
345
345
  def init_ivars # :nodoc:
346
346
  @dry_run = false
347
- @exclude = []
347
+ @exclude = %w[
348
+ ~\z \.orig\z \.rej\z \.bak\z
349
+ \.gemspec\z
350
+ ]
348
351
  @files = nil
349
352
  @force_output = false
350
353
  @force_update = true