rdoc 5.0.0.beta1 → 5.0.0.beta2
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 +4 -4
- data/lib/gauntlet_rdoc.rb +0 -2
- data/lib/rdoc.rb +1 -1
- data/lib/rdoc/code_object.rb +1 -3
- data/lib/rdoc/comment.rb +1 -2
- data/lib/rdoc/encoding.rb +35 -40
- data/lib/rdoc/generator/darkfish.rb +2 -4
- data/lib/rdoc/generator/json_index.rb +1 -2
- data/lib/rdoc/markdown.kpeg +0 -1
- data/lib/rdoc/markup/parser.rb +1 -17
- data/lib/rdoc/options.rb +13 -25
- data/lib/rdoc/parser/ruby.rb +1 -4
- data/lib/rdoc/parser/simple.rb +1 -2
- data/lib/rdoc/rdoc.rb +9 -16
- data/lib/rdoc/ri/driver.rb +1 -2
- data/lib/rdoc/ri/paths.rb +0 -3
- data/lib/rdoc/ri/task.rb +0 -1
- data/lib/rdoc/rubygems_hook.rb +0 -2
- data/lib/rdoc/task.rb +0 -2
- data/lib/rdoc/test_case.rb +0 -4
- data/lib/rdoc/text.rb +7 -22
- data/rdoc.gemspec +1 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7611b4b4856c7640b0eb67a7e763fedb026fe08
|
4
|
+
data.tar.gz: c9c575242299083f619e13e9008481e8f3756060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fc205f98ec74b52a0126addc2607aeecfbd23736cc20b72b05e553cd26d32c912e57d4cbfa2ac3d56c6384df9953e410e10005bf3a5e4d1889d0f819a27bd96
|
7
|
+
data.tar.gz: f58ba3bd7aea7714789abc2137c634a4e1086c80ad58a9676fbe3dff581a676f038cdd2af05f87fa6dba438ef3bc7d2527931a9a53f05bfdb1487a3183342d90
|
data/lib/gauntlet_rdoc.rb
CHANGED
data/lib/rdoc.rb
CHANGED
data/lib/rdoc/code_object.rb
CHANGED
@@ -150,8 +150,7 @@ class RDoc::CodeObject
|
|
150
150
|
else
|
151
151
|
# HACK correct fix is to have #initialize create @comment
|
152
152
|
# with the correct encoding
|
153
|
-
if String === @comment and
|
154
|
-
Object.const_defined? :Encoding and @comment.empty? then
|
153
|
+
if String === @comment and @comment.empty? then
|
155
154
|
@comment.force_encoding comment.encoding
|
156
155
|
end
|
157
156
|
@comment
|
@@ -427,4 +426,3 @@ class RDoc::CodeObject
|
|
427
426
|
end
|
428
427
|
|
429
428
|
end
|
430
|
-
|
data/lib/rdoc/comment.rb
CHANGED
@@ -200,7 +200,7 @@ class RDoc::Comment
|
|
200
200
|
def remove_private
|
201
201
|
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
|
202
202
|
empty = ''
|
203
|
-
empty.force_encoding @text.encoding
|
203
|
+
empty.force_encoding @text.encoding
|
204
204
|
|
205
205
|
@text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
|
206
206
|
@text = @text.sub(%r%^\s*[#*]?--.*%m, '')
|
@@ -227,4 +227,3 @@ class RDoc::Comment
|
|
227
227
|
end
|
228
228
|
|
229
229
|
end
|
230
|
-
|
data/lib/rdoc/encoding.rb
CHANGED
@@ -25,43 +25,41 @@ module RDoc::Encoding
|
|
25
25
|
|
26
26
|
RDoc::Encoding.set_encoding content
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
return nil
|
64
|
-
end
|
28
|
+
begin
|
29
|
+
encoding ||= Encoding.default_external
|
30
|
+
orig_encoding = content.encoding
|
31
|
+
|
32
|
+
if not orig_encoding.ascii_compatible? then
|
33
|
+
content.encode! encoding
|
34
|
+
elsif utf8 then
|
35
|
+
content.force_encoding Encoding::UTF_8
|
36
|
+
content.encode! encoding
|
37
|
+
else
|
38
|
+
# assume the content is in our output encoding
|
39
|
+
content.force_encoding encoding
|
40
|
+
end
|
41
|
+
|
42
|
+
unless content.valid_encoding? then
|
43
|
+
# revert and try to transcode
|
44
|
+
content.force_encoding orig_encoding
|
45
|
+
content.encode! encoding
|
46
|
+
end
|
47
|
+
|
48
|
+
unless content.valid_encoding? then
|
49
|
+
warn "unable to convert #{filename} to #{encoding}, skipping"
|
50
|
+
content = nil
|
51
|
+
end
|
52
|
+
rescue Encoding::InvalidByteSequenceError,
|
53
|
+
Encoding::UndefinedConversionError => e
|
54
|
+
if force_transcode then
|
55
|
+
content.force_encoding orig_encoding
|
56
|
+
content.encode!(encoding,
|
57
|
+
:invalid => :replace, :undef => :replace,
|
58
|
+
:replace => '?')
|
59
|
+
return content
|
60
|
+
else
|
61
|
+
warn "unable to convert #{e.message} for #{filename}, skipping"
|
62
|
+
return nil
|
65
63
|
end
|
66
64
|
end
|
67
65
|
|
@@ -103,11 +101,8 @@ module RDoc::Encoding
|
|
103
101
|
|
104
102
|
remove_frozen_string_literal string
|
105
103
|
|
106
|
-
return unless Object.const_defined? :Encoding
|
107
|
-
|
108
104
|
enc = Encoding.find name
|
109
105
|
string.force_encoding enc if enc
|
110
106
|
end
|
111
107
|
|
112
108
|
end
|
113
|
-
|
@@ -698,7 +698,7 @@ class RDoc::Generator::Darkfish
|
|
698
698
|
|
699
699
|
out_file.dirname.mkpath
|
700
700
|
out_file.open 'w', 0644 do |io|
|
701
|
-
io.set_encoding @options.encoding
|
701
|
+
io.set_encoding @options.encoding
|
702
702
|
|
703
703
|
@context = yield io
|
704
704
|
|
@@ -744,8 +744,7 @@ class RDoc::Generator::Darkfish
|
|
744
744
|
erbout = 'io'
|
745
745
|
else
|
746
746
|
template = file.read
|
747
|
-
template = template.encode @options.encoding
|
748
|
-
Object.const_defined? :Encoding
|
747
|
+
template = template.encode @options.encoding
|
749
748
|
|
750
749
|
file_var = File.basename(file).sub(/\..*/, '')
|
751
750
|
|
@@ -758,4 +757,3 @@ class RDoc::Generator::Darkfish
|
|
758
757
|
end
|
759
758
|
|
760
759
|
end
|
761
|
-
|
@@ -142,7 +142,7 @@ class RDoc::Generator::JsonIndex
|
|
142
142
|
FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC
|
143
143
|
|
144
144
|
index_file.open 'w', 0644 do |io|
|
145
|
-
io.set_encoding Encoding::UTF_8
|
145
|
+
io.set_encoding Encoding::UTF_8
|
146
146
|
io.write 'var search_data = '
|
147
147
|
|
148
148
|
JSON.dump data, io, 0
|
@@ -295,4 +295,3 @@ class RDoc::Generator::JsonIndex
|
|
295
295
|
end
|
296
296
|
|
297
297
|
end
|
298
|
-
|
data/lib/rdoc/markdown.kpeg
CHANGED
data/lib/rdoc/markup/parser.rb
CHANGED
@@ -79,8 +79,6 @@ class RDoc::Markup::Parser
|
|
79
79
|
@binary_input = nil
|
80
80
|
@current_token = nil
|
81
81
|
@debug = false
|
82
|
-
@have_encoding = Object.const_defined? :Encoding
|
83
|
-
@have_byteslice = ''.respond_to? :byteslice
|
84
82
|
@input = nil
|
85
83
|
@input_encoding = nil
|
86
84
|
@line = 0
|
@@ -324,15 +322,7 @@ class RDoc::Markup::Parser
|
|
324
322
|
# The character offset for the input string at the given +byte_offset+
|
325
323
|
|
326
324
|
def char_pos byte_offset
|
327
|
-
|
328
|
-
@input.byteslice(0, byte_offset).length
|
329
|
-
elsif @have_encoding then
|
330
|
-
matched = @binary_input[0, byte_offset]
|
331
|
-
matched.force_encoding @input_encoding
|
332
|
-
matched.length
|
333
|
-
else
|
334
|
-
byte_offset
|
335
|
-
end
|
325
|
+
@input.byteslice(0, byte_offset).length
|
336
326
|
end
|
337
327
|
|
338
328
|
##
|
@@ -430,11 +420,6 @@ class RDoc::Markup::Parser
|
|
430
420
|
@line_pos = 0
|
431
421
|
@input = input.dup
|
432
422
|
|
433
|
-
if @have_encoding and not @have_byteslice then
|
434
|
-
@input_encoding = @input.encoding
|
435
|
-
@binary_input = @input.force_encoding Encoding::BINARY
|
436
|
-
end
|
437
|
-
|
438
423
|
@s = StringScanner.new input
|
439
424
|
end
|
440
425
|
|
@@ -556,4 +541,3 @@ class RDoc::Markup::Parser
|
|
556
541
|
end
|
557
542
|
|
558
543
|
end
|
559
|
-
|
data/lib/rdoc/options.rb
CHANGED
@@ -379,23 +379,15 @@ class RDoc::Options
|
|
379
379
|
@visibility = :protected
|
380
380
|
@webcvs = nil
|
381
381
|
@write_options = false
|
382
|
-
|
383
|
-
|
384
|
-
@encoding = Encoding::UTF_8
|
385
|
-
@charset = @encoding.name
|
386
|
-
else
|
387
|
-
@encoding = nil
|
388
|
-
@charset = 'UTF-8'
|
389
|
-
end
|
382
|
+
@encoding = Encoding::UTF_8
|
383
|
+
@charset = @encoding.name
|
390
384
|
end
|
391
385
|
|
392
386
|
def init_with map # :nodoc:
|
393
387
|
init_ivars
|
394
388
|
|
395
389
|
encoding = map['encoding']
|
396
|
-
@encoding =
|
397
|
-
encoding ? Encoding.find(encoding) : encoding
|
398
|
-
end
|
390
|
+
@encoding = encoding ? Encoding.find(encoding) : encoding
|
399
391
|
|
400
392
|
@charset = map['charset']
|
401
393
|
@exclude = map['exclude']
|
@@ -689,19 +681,16 @@ Usage: #{opt.program_name} [options] [names...]
|
|
689
681
|
opt.separator "Parsing options:"
|
690
682
|
opt.separator nil
|
691
683
|
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
end
|
701
|
-
|
702
|
-
opt.separator nil
|
703
|
-
end
|
684
|
+
opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
|
685
|
+
"Specifies the output encoding. All files",
|
686
|
+
"read will be converted to this encoding.",
|
687
|
+
"The default encoding is UTF-8.",
|
688
|
+
"--encoding is preferred over --charset") do |value|
|
689
|
+
@encoding = Encoding.find value
|
690
|
+
@charset = @encoding.name # may not be valid value
|
691
|
+
end
|
704
692
|
|
693
|
+
opt.separator nil
|
705
694
|
|
706
695
|
opt.on("--locale=NAME",
|
707
696
|
"Specifies the output locale.") do |value|
|
@@ -1242,11 +1231,10 @@ Usage: #{opt.program_name} [options] [names...]
|
|
1242
1231
|
RDoc.load_yaml
|
1243
1232
|
|
1244
1233
|
open '.rdoc_options', 'w' do |io|
|
1245
|
-
io.set_encoding Encoding::UTF_8
|
1234
|
+
io.set_encoding Encoding::UTF_8
|
1246
1235
|
|
1247
1236
|
YAML.dump self, io
|
1248
1237
|
end
|
1249
1238
|
end
|
1250
1239
|
|
1251
1240
|
end
|
1252
|
-
|
data/lib/rdoc/parser/ruby.rb
CHANGED
@@ -170,9 +170,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
170
170
|
@prev_seek = nil
|
171
171
|
@markup = @options.markup
|
172
172
|
@track_visibility = :nodoc != @options.visibility
|
173
|
-
|
174
|
-
@encoding = nil
|
175
|
-
@encoding = @options.encoding if Object.const_defined? :Encoding
|
173
|
+
@encoding = @options.encoding
|
176
174
|
|
177
175
|
reset
|
178
176
|
end
|
@@ -2158,4 +2156,3 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|
2158
2156
|
end
|
2159
2157
|
|
2160
2158
|
end
|
2161
|
-
|
data/lib/rdoc/parser/simple.rb
CHANGED
@@ -52,11 +52,10 @@ class RDoc::Parser::Simple < RDoc::Parser
|
|
52
52
|
def remove_private_comment comment
|
53
53
|
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
|
54
54
|
empty = ''
|
55
|
-
empty.force_encoding comment.encoding
|
55
|
+
empty.force_encoding comment.encoding
|
56
56
|
|
57
57
|
comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty)
|
58
58
|
comment.sub(%r%^--\n.*%m, empty)
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
62
|
-
|
data/lib/rdoc/rdoc.rb
CHANGED
@@ -340,10 +340,8 @@ option)
|
|
340
340
|
# Parses +filename+ and returns an RDoc::TopLevel
|
341
341
|
|
342
342
|
def parse_file filename
|
343
|
-
|
344
|
-
|
345
|
-
filename = filename.encode encoding
|
346
|
-
end
|
343
|
+
encoding = @options.encoding
|
344
|
+
filename = filename.encode encoding
|
347
345
|
|
348
346
|
@stats.add_file filename
|
349
347
|
|
@@ -551,18 +549,14 @@ The internal error was:
|
|
551
549
|
end
|
552
550
|
|
553
551
|
begin
|
554
|
-
|
555
|
-
|
556
|
-
if Gem.respond_to? :find_files then
|
557
|
-
rdoc_extensions = Gem.find_files 'rdoc/discover'
|
552
|
+
rdoc_extensions = Gem.find_files 'rdoc/discover'
|
558
553
|
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
end
|
554
|
+
rdoc_extensions.each do |extension|
|
555
|
+
begin
|
556
|
+
load extension
|
557
|
+
rescue => e
|
558
|
+
warn "error loading #{extension.inspect}: #{e.message} (#{e.class})"
|
559
|
+
warn "\t#{e.backtrace.join "\n\t"}" if $DEBUG
|
566
560
|
end
|
567
561
|
end
|
568
562
|
rescue LoadError
|
@@ -572,4 +566,3 @@ end
|
|
572
566
|
require 'rdoc/generator/darkfish'
|
573
567
|
require 'rdoc/generator/ri'
|
574
568
|
require 'rdoc/generator/pot'
|
575
|
-
|
data/lib/rdoc/ri/driver.rb
CHANGED
@@ -908,7 +908,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
|
|
908
908
|
|
909
909
|
def expand_class klass
|
910
910
|
ary = classes.keys.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
|
911
|
-
raise NotFoundError, klass if ary.length != 1
|
911
|
+
raise NotFoundError, klass if ary.length != 1 && ary.first != klass
|
912
912
|
ary.first
|
913
913
|
end
|
914
914
|
|
@@ -1480,4 +1480,3 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
|
|
1480
1480
|
end
|
1481
1481
|
|
1482
1482
|
end
|
1483
|
-
|
data/lib/rdoc/ri/paths.rb
CHANGED
@@ -82,8 +82,6 @@ module RDoc::RI::Paths
|
|
82
82
|
# ri documentation.
|
83
83
|
|
84
84
|
def self.gemdirs filter = :latest
|
85
|
-
require 'rubygems' unless defined?(Gem)
|
86
|
-
|
87
85
|
ri_paths = {}
|
88
86
|
|
89
87
|
all = Gem::Specification.map do |spec|
|
@@ -185,4 +183,3 @@ module RDoc::RI::Paths
|
|
185
183
|
end
|
186
184
|
|
187
185
|
end
|
188
|
-
|
data/lib/rdoc/ri/task.rb
CHANGED
data/lib/rdoc/rubygems_hook.rb
CHANGED
data/lib/rdoc/task.rb
CHANGED
data/lib/rdoc/test_case.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
2
|
begin
|
5
3
|
gem 'minitest', '~> 4.0' unless defined?(Test::Unit)
|
6
4
|
rescue NoMethodError, Gem::LoadError
|
@@ -41,8 +39,6 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
|
|
41
39
|
|
42
40
|
@top_level = nil
|
43
41
|
|
44
|
-
@have_encoding = Object.const_defined? :Encoding
|
45
|
-
|
46
42
|
@RM = RDoc::Markup
|
47
43
|
|
48
44
|
RDoc::Markup::PreProcess.reset
|
data/lib/rdoc/text.rb
CHANGED
@@ -52,7 +52,7 @@ module RDoc::Text
|
|
52
52
|
:open_squote => encode_fallback('‘', encoding, '\''),
|
53
53
|
:trademark => encode_fallback('®', encoding, '(r)'),
|
54
54
|
}
|
55
|
-
end
|
55
|
+
end
|
56
56
|
|
57
57
|
##
|
58
58
|
# Transcodes +character+ to +encoding+ with a +fallback+ character.
|
@@ -71,7 +71,7 @@ module RDoc::Text
|
|
71
71
|
text.each_line do |line|
|
72
72
|
nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
|
73
73
|
r = "#{$1}#{$2}#{' ' * (8 - $2.size)}"
|
74
|
-
r.force_encoding text.encoding
|
74
|
+
r.force_encoding text.encoding
|
75
75
|
r
|
76
76
|
end
|
77
77
|
|
@@ -93,7 +93,7 @@ module RDoc::Text
|
|
93
93
|
end
|
94
94
|
|
95
95
|
empty = ''
|
96
|
-
empty.force_encoding text.encoding
|
96
|
+
empty.force_encoding text.encoding
|
97
97
|
|
98
98
|
text.gsub(/^ {0,#{indent}}/, empty)
|
99
99
|
end
|
@@ -160,7 +160,7 @@ module RDoc::Text
|
|
160
160
|
return text if text =~ /^(?>\s*)[^\#]/
|
161
161
|
|
162
162
|
empty = ''
|
163
|
-
empty.force_encoding text.encoding
|
163
|
+
empty.force_encoding text.encoding
|
164
164
|
|
165
165
|
text.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\s+$/, empty)
|
166
166
|
end
|
@@ -178,7 +178,7 @@ module RDoc::Text
|
|
178
178
|
def strip_stars text
|
179
179
|
return text unless text =~ %r%/\*.*\*/%m
|
180
180
|
|
181
|
-
encoding = text.encoding
|
181
|
+
encoding = text.encoding
|
182
182
|
|
183
183
|
text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, ''
|
184
184
|
|
@@ -199,24 +199,9 @@ module RDoc::Text
|
|
199
199
|
# trademark symbols in +text+ to properly encoded characters.
|
200
200
|
|
201
201
|
def to_html text
|
202
|
-
|
203
|
-
html = ''.encode text.encoding
|
202
|
+
html = ''.encode text.encoding
|
204
203
|
|
205
|
-
|
206
|
-
else
|
207
|
-
html = ''
|
208
|
-
encoded = {
|
209
|
-
:close_dquote => '”',
|
210
|
-
:close_squote => '’',
|
211
|
-
:copyright => '©',
|
212
|
-
:ellipsis => '…',
|
213
|
-
:em_dash => '—',
|
214
|
-
:en_dash => '–',
|
215
|
-
:open_dquote => '“',
|
216
|
-
:open_squote => '‘',
|
217
|
-
:trademark => '®',
|
218
|
-
}
|
219
|
-
end
|
204
|
+
encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
|
220
205
|
|
221
206
|
s = StringScanner.new text
|
222
207
|
insquotes = false
|
data/rdoc.gemspec
CHANGED
@@ -6,8 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "rdoc"
|
7
7
|
s.version = RDoc::VERSION
|
8
8
|
|
9
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.3")
|
10
|
-
s.respond_to? :required_rubygems_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3")
|
11
10
|
|
12
11
|
s.require_paths = ["lib"]
|
13
12
|
s.authors = [
|