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
Release note: b825775647/History.rdoc (500--2016-11-05)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a0eb2807e
commit
cdc527db34
27 changed files with 62 additions and 144 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Nov 5 18:17:08 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||
|
||||
* lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0
|
||||
Release note: https://github.com/rdoc/rdoc/blob/b825775647f62c5b525e9780a28ff2fbb1d5bf6f/History.rdoc#500--2016-11-05
|
||||
|
||||
Sat Nov 5 17:29:06 2016 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/resolv.rb (Resolv::DNS#extract_resources): Use each_resource
|
||||
|
|
|
@ -65,7 +65,7 @@ module RDoc
|
|||
##
|
||||
# RDoc version you are using
|
||||
|
||||
VERSION = '5.0.0.beta2'
|
||||
VERSION = '5.0.0'
|
||||
|
||||
##
|
||||
# Method visibilities
|
||||
|
|
1
lib/rdoc/.document
Normal file
1
lib/rdoc/.document
Normal file
|
@ -0,0 +1 @@
|
|||
*.rb
|
|
@ -327,7 +327,7 @@ class RDoc::Context < RDoc::CodeObject
|
|||
if full_name == 'BasicObject' then
|
||||
superclass = nil
|
||||
elsif full_name == 'Object' then
|
||||
superclass = defined?(::BasicObject) ? '::BasicObject' : nil
|
||||
superclass = '::BasicObject'
|
||||
end
|
||||
|
||||
# find the superclass full name
|
||||
|
@ -1211,4 +1211,3 @@ class RDoc::Context < RDoc::CodeObject
|
|||
autoload :Section, 'rdoc/context/section'
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -49,4 +49,3 @@ module RDoc::Generator
|
|||
autoload :POT, 'rdoc/generator/pot'
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<footer id="validator-badges" role="contentinfo">
|
||||
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
||||
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> <%= RDoc::VERSION %>.
|
||||
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> <%= RDoc::VERSION %>.
|
||||
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
||||
</footer>
|
||||
|
|
|
@ -521,7 +521,6 @@ class RDoc::Markdown
|
|||
|
||||
|
||||
|
||||
require 'rubygems'
|
||||
require 'rdoc'
|
||||
require 'rdoc/markup/to_joined_paragraph'
|
||||
require 'rdoc/markdown/entities'
|
||||
|
@ -15281,7 +15280,7 @@ class RDoc::Markdown
|
|||
self.pos = _save
|
||||
break
|
||||
end
|
||||
@result = begin;
|
||||
@result = begin;
|
||||
ref = [:inline, @note_order.length]
|
||||
@footnotes[ref] = paragraph a
|
||||
|
||||
|
|
|
@ -183,26 +183,14 @@ class RDoc::Markdown::Literals
|
|||
return nil
|
||||
end
|
||||
|
||||
if "".respond_to? :ord
|
||||
def get_byte
|
||||
if @pos >= @string_size
|
||||
return nil
|
||||
end
|
||||
|
||||
s = @string[@pos].ord
|
||||
@pos += 1
|
||||
s
|
||||
def get_byte
|
||||
if @pos >= @string_size
|
||||
return nil
|
||||
end
|
||||
else
|
||||
def get_byte
|
||||
if @pos >= @string_size
|
||||
return nil
|
||||
end
|
||||
|
||||
s = @string[@pos]
|
||||
@pos += 1
|
||||
s
|
||||
end
|
||||
s = @string[@pos].ord
|
||||
@pos += 1
|
||||
s
|
||||
end
|
||||
|
||||
def parse(rule=nil)
|
||||
|
|
|
@ -102,8 +102,6 @@ class RDoc::Markup::PreProcess
|
|||
text = text.text
|
||||
end
|
||||
|
||||
encoding = text.encoding if defined?(Encoding)
|
||||
|
||||
# regexp helper (square brackets for optional)
|
||||
# $1 $2 $3 $4 $5
|
||||
# [prefix][\]:directive:[spaces][param]newline
|
||||
|
@ -122,7 +120,7 @@ class RDoc::Markup::PreProcess
|
|||
next "#{$1.strip}\n"
|
||||
end
|
||||
|
||||
handle_directive $1, $3, $5, code_object, encoding, &block
|
||||
handle_directive $1, $3, $5, code_object, text.encoding, &block
|
||||
end
|
||||
|
||||
comment = text unless comment
|
||||
|
@ -291,4 +289,3 @@ class RDoc::Markup::PreProcess
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
|
|||
# Adds bold or underline mixed with backspaces
|
||||
|
||||
def convert_string string
|
||||
return string unless string.respond_to? :chars # your ruby is lame
|
||||
return string unless @in_b or @in_em
|
||||
chars = if @in_b then
|
||||
string.chars.map do |char| "#{char}\b#{char}" end
|
||||
|
@ -76,4 +75,3 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1187,19 +1187,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
end
|
||||
end
|
||||
|
||||
##
|
||||
# This is compatibility code for syck
|
||||
|
||||
def to_yaml opts = {} # :nodoc:
|
||||
return super if YAML.const_defined?(:ENGINE) and not YAML::ENGINE.syck?
|
||||
|
||||
YAML.quick_emit self, opts do |out|
|
||||
out.map taguri, to_yaml_style do |map|
|
||||
encode_with map
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Sets the minimum visibility of a documented method.
|
||||
#
|
||||
# Accepts +:public+, +:protected+, +:private+, +:nodoc+, or +:all+.
|
||||
|
|
|
@ -76,25 +76,15 @@ class RDoc::Parser
|
|||
|
||||
s = File.read(file, 1024) or return false
|
||||
|
||||
have_encoding = s.respond_to? :encoding
|
||||
|
||||
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
|
||||
|
||||
if have_encoding then
|
||||
mode = "r"
|
||||
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
|
||||
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
|
||||
mode = "rb:#{encoding}" if encoding
|
||||
s = File.open(file, mode) {|f| f.gets(nil, 1024)}
|
||||
mode = "r"
|
||||
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
|
||||
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
|
||||
mode = "rb:#{encoding}" if encoding
|
||||
s = File.open(file, mode) {|f| f.gets(nil, 1024)}
|
||||
|
||||
not s.valid_encoding?
|
||||
else
|
||||
if 0.respond_to? :fdiv then
|
||||
s.count("\x00-\x7F", "^ -~\t\r\n").fdiv(s.size) > 0.3
|
||||
else # HACK 1.8.6
|
||||
(s.count("\x00-\x7F", "^ -~\t\r\n").to_f / s.size) > 0.3
|
||||
end
|
||||
end
|
||||
not s.valid_encoding?
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -308,4 +298,3 @@ require 'rdoc/parser/changelog'
|
|||
require 'rdoc/parser/markdown'
|
||||
require 'rdoc/parser/rd'
|
||||
require 'rdoc/parser/ruby'
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -161,15 +161,9 @@ class RDoc::RDoc
|
|||
|
||||
RDoc.load_yaml
|
||||
|
||||
parse_error = if Object.const_defined? :Psych then
|
||||
Psych::SyntaxError
|
||||
else
|
||||
ArgumentError
|
||||
end
|
||||
|
||||
begin
|
||||
options = YAML.load_file '.rdoc_options'
|
||||
rescue *parse_error
|
||||
rescue Psych::SyntaxError
|
||||
end
|
||||
|
||||
raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless
|
||||
|
@ -417,6 +411,7 @@ The internal error was:
|
|||
|
||||
return [] if file_list.empty?
|
||||
|
||||
original_options = @options.dup
|
||||
@stats.begin_adding
|
||||
|
||||
file_info = file_list.map do |filename|
|
||||
|
@ -425,6 +420,7 @@ The internal error was:
|
|||
end.compact
|
||||
|
||||
@stats.done_adding
|
||||
@options = original_options
|
||||
|
||||
file_info
|
||||
end
|
||||
|
@ -479,7 +475,7 @@ The internal error was:
|
|||
@last_modified = setup_output_dir @options.op_dir, @options.force_update
|
||||
end
|
||||
|
||||
@store.encoding = @options.encoding if @options.respond_to? :encoding
|
||||
@store.encoding = @options.encoding
|
||||
@store.dry_run = @options.dry_run
|
||||
@store.main = @options.main_page
|
||||
@store.title = @options.title
|
||||
|
|
|
@ -1428,7 +1428,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
|
|||
def setup_pager
|
||||
return if @use_stdout
|
||||
|
||||
jruby = Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
||||
jruby = RUBY_ENGINE == 'jruby'
|
||||
|
||||
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
|
||||
|
||||
|
|
|
@ -853,11 +853,7 @@ class RDoc::RubyLex
|
|||
end
|
||||
end
|
||||
|
||||
IDENT_RE = if defined? Encoding then
|
||||
eval '/[\w\u{0080}-\u{FFFFF}]/u' # 1.8 can't parse \u{}
|
||||
else
|
||||
/[\w\x80-\xFF]/
|
||||
end
|
||||
IDENT_RE = eval '/[\w\u{0080}-\u{FFFFF}]/u'
|
||||
|
||||
def identify_identifier
|
||||
token = ""
|
||||
|
|
|
@ -153,13 +153,7 @@ class RDoc::RubygemsHook
|
|||
options = nil
|
||||
|
||||
args = @spec.rdoc_options
|
||||
|
||||
if @spec.respond_to? :source_paths then
|
||||
args.concat @spec.source_paths
|
||||
else
|
||||
args.concat @spec.require_paths
|
||||
end
|
||||
|
||||
args.concat @spec.source_paths
|
||||
args.concat @spec.extra_rdoc_files
|
||||
|
||||
case config_args = Gem.configuration[:rdoc]
|
||||
|
@ -183,7 +177,7 @@ class RDoc::RubygemsHook
|
|||
@rdoc.options = options
|
||||
|
||||
store = RDoc::Store.new
|
||||
store.encoding = options.encoding if options.respond_to? :encoding
|
||||
store.encoding = options.encoding
|
||||
store.dry_run = options.dry_run
|
||||
store.main = options.main_page
|
||||
store.title = options.title
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# frozen_string_literal: false
|
||||
begin
|
||||
require 'io/console/size'
|
||||
rescue LoadError
|
||||
end
|
||||
require 'io/console/size'
|
||||
|
||||
##
|
||||
# Stats printer that prints just the files being documented with a progress
|
||||
|
@ -26,11 +23,7 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
|
|||
|
||||
# Print a progress bar, but make sure it fits on a single line. Filename
|
||||
# will be truncated if necessary.
|
||||
terminal_width = if defined?(IO) && IO.respond_to?(:console_size)
|
||||
IO.console_size[1].to_i.nonzero? || 80
|
||||
else
|
||||
80
|
||||
end
|
||||
terminal_width = IO.console_size[1].to_i.nonzero? || 80
|
||||
max_filename_size = terminal_width - progress_bar.size
|
||||
|
||||
if filename.size > max_filename_size then
|
||||
|
@ -57,4 +50,3 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -679,12 +679,7 @@ class RDoc::Store
|
|||
method_name =~ /#(.*)/
|
||||
method_type = $1 ? 'i' : 'c'
|
||||
method_name = $1 if $1
|
||||
|
||||
method_name = if ''.respond_to? :ord then
|
||||
method_name.gsub(/\W/) { "%%%02x" % $&[0].ord }
|
||||
else
|
||||
method_name.gsub(/\W/) { "%%%02x" % $&[0] }
|
||||
end
|
||||
method_name = method_name.gsub(/\W/) { "%%%02x" % $&[0].ord }
|
||||
|
||||
File.join class_path(klass_name), "#{method_name}-#{method_type}.ri"
|
||||
end
|
||||
|
|
|
@ -141,7 +141,7 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
|
|||
def mu_pp obj # :nodoc:
|
||||
s = ''
|
||||
s = PP.pp obj, s
|
||||
s = s.force_encoding Encoding.default_external if defined? Encoding
|
||||
s = s.force_encoding Encoding.default_external
|
||||
s.chomp
|
||||
end
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@ class TestRDocContext < XrefTestCase
|
|||
|
||||
@context = RDoc::Context.new
|
||||
@context.store = @store
|
||||
|
||||
@enumerator = # 1.8 vs 1.9
|
||||
Object.const_defined?(:Enumerator) ? Enumerator : Enumerable::Enumerator
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
|
@ -118,8 +115,6 @@ class TestRDocContext < XrefTestCase
|
|||
end
|
||||
|
||||
def test_add_class_basic_object
|
||||
skip 'BasicObject is 1.9 only' unless defined?(BasicObject)
|
||||
|
||||
@xref_data.add_class RDoc::NormalClass, 'BasicObject'
|
||||
|
||||
basic = @xref_data.find_module_named 'BasicObject'
|
||||
|
@ -134,13 +129,11 @@ class TestRDocContext < XrefTestCase
|
|||
end
|
||||
|
||||
def test_add_class_object
|
||||
root_class = defined?(BasicObject) ? 'BasicObject' : nil
|
||||
|
||||
@xref_data.add_class RDoc::NormalClass, 'Object'
|
||||
|
||||
object = @xref_data.find_module_named 'Object'
|
||||
|
||||
assert_equal root_class, object.superclass
|
||||
assert_equal 'BasicObject', object.superclass
|
||||
|
||||
@c1.add_class RDoc::NormalClass, 'Object'
|
||||
|
||||
|
@ -457,7 +450,7 @@ class TestRDocContext < XrefTestCase
|
|||
end
|
||||
|
||||
def test_each_method_enumerator
|
||||
assert_kind_of @enumerator, @c1.each_method
|
||||
assert_kind_of Enumerator, @c1.each_method
|
||||
end
|
||||
|
||||
def test_each_section
|
||||
|
@ -489,7 +482,7 @@ class TestRDocContext < XrefTestCase
|
|||
end
|
||||
|
||||
def test_each_section_enumerator
|
||||
assert_kind_of @enumerator, @c1.each_section
|
||||
assert_kind_of Enumerator, @c1.each_section
|
||||
end
|
||||
|
||||
def test_find_attribute_named
|
||||
|
@ -899,4 +892,3 @@ class TestRDocContext < XrefTestCase
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -495,7 +495,7 @@ be guessed, raises an error if +name+ couldn't be guessed.
|
|||
= \RDoc - Ruby Documentation System
|
||||
|
||||
* {RDoc Project Page}[https://github.com/rdoc/rdoc/]
|
||||
* {RDoc Documentation}[http://docs.seattlerb.org/rdoc]
|
||||
* {RDoc Documentation}[https://rdoc.github.io/rdoc]
|
||||
* {RDoc Bug Tracker}[https://github.com/rdoc/rdoc/issues]
|
||||
|
||||
== DESCRIPTION:
|
||||
|
@ -709,4 +709,3 @@ This routine modifies its +comment+ parameter.
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class TestRDocParser < RDoc::TestCase
|
|||
end
|
||||
io
|
||||
end
|
||||
tf.close! if tf.respond_to? :close!
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_class_for_modeline
|
||||
|
|
|
@ -165,7 +165,7 @@ class TestRDocRdBlockParser < RDoc::TestCase
|
|||
assert_equal expected, parse(str)
|
||||
io
|
||||
end
|
||||
tf.close! if tf.respond_to? :close!
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_parse_heading
|
||||
|
|
|
@ -133,7 +133,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
end
|
||||
|
||||
def test_normalized_file_list_non_file_directory
|
||||
dev = defined?(File::NULL) ? File::NULL : '/dev/stdin'
|
||||
dev = File::NULL
|
||||
skip "#{dev} is not a character special" unless
|
||||
File.chardev? dev
|
||||
|
||||
|
@ -261,7 +261,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
|
||||
io
|
||||
end
|
||||
tf.close! if tf.respond_to? :close!
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_parse_file_forbidden
|
||||
|
@ -290,7 +290,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
end
|
||||
io
|
||||
end
|
||||
tf.close! if tf.respond_to? :close!
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_remove_unparseable
|
||||
|
@ -398,7 +398,7 @@ class TestRDocRDoc < RDoc::TestCase
|
|||
e.message)
|
||||
tempfile
|
||||
end
|
||||
tf.close! if tf.respond_to? :close!
|
||||
tf.close!
|
||||
end
|
||||
|
||||
def test_setup_output_dir_exists_not_rdoc
|
||||
|
|
|
@ -7,9 +7,6 @@ class TestRDocRubygemsHook < Gem::TestCase
|
|||
def setup
|
||||
super
|
||||
|
||||
skip 'requires RubyGems 1.9+' unless
|
||||
Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
|
||||
|
||||
@a = util_spec 'a', 2 do |s|
|
||||
s.rdoc_options = %w[--main MyTitle]
|
||||
s.extra_rdoc_files = %w[README]
|
||||
|
@ -134,7 +131,6 @@ class TestRDocRubygemsHook < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_generate_default_gem
|
||||
skip 'RubyGems 2 required' unless @a.respond_to? :default_gem?
|
||||
@a.loaded_from =
|
||||
File.join Gem::Specification.default_specifications_dir, 'a.gemspec'
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.expand_path '../xref_test_case', __FILE__
|
|||
|
||||
class TestRDocStore < XrefTestCase
|
||||
|
||||
OBJECT_ANCESTORS = defined?(::BasicObject) ? %w[BasicObject] : []
|
||||
OBJECT_ANCESTORS = %w[BasicObject]
|
||||
|
||||
def setup
|
||||
super
|
||||
|
@ -631,7 +631,7 @@ class TestRDocStore < XrefTestCase
|
|||
:title => nil,
|
||||
}
|
||||
|
||||
expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
|
||||
expected[:ancestors]['Object'] = %w[BasicObject]
|
||||
|
||||
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
||||
cache = Marshal.load io.read
|
||||
|
@ -699,7 +699,7 @@ class TestRDocStore < XrefTestCase
|
|||
:title => 'title',
|
||||
}
|
||||
|
||||
expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
|
||||
expected[:ancestors]['Object'] = %w[BasicObject]
|
||||
|
||||
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
||||
cache = Marshal.load io.read
|
||||
|
|
Loading…
Reference in a new issue