mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta2
Fixed ri parse defect with left-hand matched classes. https://github.com/rdoc/rdoc/pull/420 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf51c067b9
commit
ba6ae341ba
37 changed files with 100 additions and 274 deletions
|
@ -25,43 +25,41 @@ module RDoc::Encoding
|
|||
|
||||
RDoc::Encoding.set_encoding content
|
||||
|
||||
if Object.const_defined? :Encoding then
|
||||
begin
|
||||
encoding ||= Encoding.default_external
|
||||
orig_encoding = content.encoding
|
||||
begin
|
||||
encoding ||= Encoding.default_external
|
||||
orig_encoding = content.encoding
|
||||
|
||||
if not orig_encoding.ascii_compatible? then
|
||||
content.encode! encoding
|
||||
elsif utf8 then
|
||||
content.force_encoding Encoding::UTF_8
|
||||
content.encode! encoding
|
||||
else
|
||||
# assume the content is in our output encoding
|
||||
content.force_encoding encoding
|
||||
end
|
||||
if not orig_encoding.ascii_compatible? then
|
||||
content.encode! encoding
|
||||
elsif utf8 then
|
||||
content.force_encoding Encoding::UTF_8
|
||||
content.encode! encoding
|
||||
else
|
||||
# assume the content is in our output encoding
|
||||
content.force_encoding encoding
|
||||
end
|
||||
|
||||
unless content.valid_encoding? then
|
||||
# revert and try to transcode
|
||||
content.force_encoding orig_encoding
|
||||
content.encode! encoding
|
||||
end
|
||||
unless content.valid_encoding? then
|
||||
# revert and try to transcode
|
||||
content.force_encoding orig_encoding
|
||||
content.encode! encoding
|
||||
end
|
||||
|
||||
unless content.valid_encoding? then
|
||||
warn "unable to convert #{filename} to #{encoding}, skipping"
|
||||
content = nil
|
||||
end
|
||||
rescue Encoding::InvalidByteSequenceError,
|
||||
Encoding::UndefinedConversionError => e
|
||||
if force_transcode then
|
||||
content.force_encoding orig_encoding
|
||||
content.encode!(encoding,
|
||||
:invalid => :replace, :undef => :replace,
|
||||
:replace => '?')
|
||||
return content
|
||||
else
|
||||
warn "unable to convert #{e.message} for #{filename}, skipping"
|
||||
return nil
|
||||
end
|
||||
unless content.valid_encoding? then
|
||||
warn "unable to convert #{filename} to #{encoding}, skipping"
|
||||
content = nil
|
||||
end
|
||||
rescue Encoding::InvalidByteSequenceError,
|
||||
Encoding::UndefinedConversionError => e
|
||||
if force_transcode then
|
||||
content.force_encoding orig_encoding
|
||||
content.encode!(encoding,
|
||||
:invalid => :replace, :undef => :replace,
|
||||
:replace => '?')
|
||||
return content
|
||||
else
|
||||
warn "unable to convert #{e.message} for #{filename}, skipping"
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,11 +101,8 @@ module RDoc::Encoding
|
|||
|
||||
remove_frozen_string_literal string
|
||||
|
||||
return unless Object.const_defined? :Encoding
|
||||
|
||||
enc = Encoding.find name
|
||||
string.force_encoding enc if enc
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue