mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
Sync RDoc 6.14.0
This commit is contained in:
parent
ca1ea95784
commit
03eb777c69
185 changed files with 2008 additions and 1655 deletions
|
@ -355,18 +355,44 @@ class RDoc::Options
|
|||
# +--[no-]embed-mixins+ (Default is +false+.)
|
||||
attr_accessor :embed_mixins
|
||||
|
||||
def initialize loaded_options = nil # :nodoc:
|
||||
##
|
||||
# Exclude the default patterns as well if true.
|
||||
attr_reader :apply_default_exclude
|
||||
|
||||
##
|
||||
# Words to be ignored in autolink cross-references
|
||||
attr_accessor :autolink_excluded_words
|
||||
|
||||
##
|
||||
# The prefix to use for class and module page paths
|
||||
|
||||
attr_accessor :class_module_path_prefix
|
||||
|
||||
##
|
||||
# The prefix to use for file page paths
|
||||
|
||||
attr_accessor :file_path_prefix
|
||||
|
||||
##
|
||||
# The preferred root URL for the documentation
|
||||
|
||||
attr_accessor :canonical_root
|
||||
|
||||
def initialize(loaded_options = nil) # :nodoc:
|
||||
init_ivars
|
||||
override loaded_options if loaded_options
|
||||
end
|
||||
|
||||
DEFAULT_EXCLUDE = %w[
|
||||
~\z \.orig\z \.rej\z \.bak\z
|
||||
\.gemspec\z
|
||||
]
|
||||
|
||||
def init_ivars # :nodoc:
|
||||
@autolink_excluded_words = []
|
||||
@dry_run = false
|
||||
@embed_mixins = false
|
||||
@exclude = %w[
|
||||
~\z \.orig\z \.rej\z \.bak\z
|
||||
\.gemspec\z
|
||||
]
|
||||
@exclude = []
|
||||
@files = nil
|
||||
@force_output = false
|
||||
@force_update = true
|
||||
|
@ -399,15 +425,19 @@ class RDoc::Options
|
|||
@update_output_dir = true
|
||||
@verbosity = 1
|
||||
@visibility = :protected
|
||||
@warn_missing_rdoc_ref = false
|
||||
@warn_missing_rdoc_ref = true
|
||||
@webcvs = nil
|
||||
@write_options = false
|
||||
@encoding = Encoding::UTF_8
|
||||
@charset = @encoding.name
|
||||
@skip_tests = true
|
||||
@apply_default_exclude = true
|
||||
@class_module_path_prefix = nil
|
||||
@file_path_prefix = nil
|
||||
@canonical_root = nil
|
||||
end
|
||||
|
||||
def init_with map # :nodoc:
|
||||
def init_with(map) # :nodoc:
|
||||
init_ivars
|
||||
|
||||
encoding = map['encoding']
|
||||
|
@ -431,15 +461,18 @@ class RDoc::Options
|
|||
@visibility = map['visibility']
|
||||
@webcvs = map['webcvs']
|
||||
|
||||
@apply_default_exclude = map['apply_default_exclude']
|
||||
@autolink_excluded_words = map['autolink_excluded_words']
|
||||
|
||||
@rdoc_include = sanitize_path map['rdoc_include']
|
||||
@static_path = sanitize_path map['static_path']
|
||||
end
|
||||
|
||||
def yaml_initialize tag, map # :nodoc:
|
||||
def yaml_initialize(tag, map) # :nodoc:
|
||||
init_with map
|
||||
end
|
||||
|
||||
def override map # :nodoc:
|
||||
def override(map) # :nodoc:
|
||||
if map.has_key?('encoding')
|
||||
encoding = map['encoding']
|
||||
@encoding = encoding ? Encoding.find(encoding) : encoding
|
||||
|
@ -463,6 +496,9 @@ class RDoc::Options
|
|||
@title = map['title'] if map.has_key?('title')
|
||||
@visibility = map['visibility'] if map.has_key?('visibility')
|
||||
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
||||
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
||||
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
||||
@canonical_root = map['canonical_root'] if map.has_key?('canonical_root')
|
||||
|
||||
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
||||
|
||||
|
@ -474,7 +510,7 @@ class RDoc::Options
|
|||
end
|
||||
end
|
||||
|
||||
def == other # :nodoc:
|
||||
def ==(other) # :nodoc:
|
||||
self.class === other and
|
||||
@encoding == other.encoding and
|
||||
@embed_mixins == other.embed_mixins and
|
||||
|
@ -493,7 +529,9 @@ class RDoc::Options
|
|||
@template == other.template and
|
||||
@title == other.title and
|
||||
@visibility == other.visibility and
|
||||
@webcvs == other.webcvs
|
||||
@webcvs == other.webcvs and
|
||||
@apply_default_exclude == other.apply_default_exclude and
|
||||
@autolink_excluded_words == other.autolink_excluded_words
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -564,10 +602,12 @@ class RDoc::Options
|
|||
if @exclude.nil? or Regexp === @exclude then
|
||||
# done, #finish is being re-run
|
||||
@exclude
|
||||
elsif @exclude.empty? then
|
||||
elsif !@apply_default_exclude and @exclude.empty? then
|
||||
nil
|
||||
else
|
||||
Regexp.new(@exclude.join("|"))
|
||||
exclude = @exclude
|
||||
exclude |= DEFAULT_EXCLUDE if @apply_default_exclude
|
||||
Regexp.new(exclude.join("|"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -662,7 +702,7 @@ class RDoc::Options
|
|||
##
|
||||
# Parses command line options.
|
||||
|
||||
def parse argv
|
||||
def parse(argv)
|
||||
ignore_invalid = true
|
||||
|
||||
argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
|
||||
|
@ -801,6 +841,11 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
@exclude << value
|
||||
end
|
||||
|
||||
opt.on("--[no-]apply-default-exclude",
|
||||
"Use default PATTERN to exclude.") do |value|
|
||||
@apply_default_exclude = value
|
||||
end
|
||||
|
||||
opt.separator nil
|
||||
|
||||
opt.on("--no-skipping-tests", nil,
|
||||
|
@ -972,6 +1017,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
|
||||
opt.separator nil
|
||||
|
||||
opt.on("--autolink-excluded-words=WORDS", Array,
|
||||
"Words to be ignored in autolink cross-references") do |value|
|
||||
@autolink_excluded_words.concat value
|
||||
end
|
||||
|
||||
opt.separator nil
|
||||
|
||||
opt.on("--hyperlink-all", "-A",
|
||||
"Generate hyperlinks for all words that",
|
||||
"correspond to known methods, even if they",
|
||||
|
@ -1229,14 +1281,14 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
##
|
||||
# Set quietness to +bool+
|
||||
|
||||
def quiet= bool
|
||||
def quiet=(bool)
|
||||
@verbosity = bool ? 0 : 1
|
||||
end
|
||||
|
||||
##
|
||||
# Removes directories from +path+ that are outside the current directory
|
||||
|
||||
def sanitize_path path
|
||||
def sanitize_path(path)
|
||||
require 'pathname'
|
||||
dot = Pathname.new('.').expand_path
|
||||
|
||||
|
@ -1263,7 +1315,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
# the options instance. This allows generators to add custom options or set
|
||||
# default options.
|
||||
|
||||
def setup_generator generator_name = @generator_name
|
||||
def setup_generator(generator_name = @generator_name)
|
||||
@generator = @generators[generator_name]
|
||||
|
||||
unless @generator then
|
||||
|
@ -1285,7 +1337,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
##
|
||||
# Finds the template dir for +template+
|
||||
|
||||
def template_dir_for template
|
||||
def template_dir_for(template)
|
||||
template_path = File.join 'rdoc', 'generator', 'template', template
|
||||
|
||||
$LOAD_PATH.map do |path|
|
||||
|
@ -1302,7 +1354,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
# When +:all+ is passed, visibility is set to +:private+, similarly to
|
||||
# RDOCOPT="--all", see #visibility for more information.
|
||||
|
||||
def visibility= visibility
|
||||
def visibility=(visibility)
|
||||
case visibility
|
||||
when :all
|
||||
@visibility = :private
|
||||
|
@ -1314,7 +1366,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
##
|
||||
# Displays a warning using Kernel#warn if we're being verbose
|
||||
|
||||
def warn message
|
||||
def warn(message)
|
||||
super message if @verbosity > 1
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue