mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge rdoc-6.0.0.beta4 from upstream.
It version applied `frozen_string_literal: true` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2d9f20e1cf
commit
5551871086
195 changed files with 1631 additions and 1258 deletions
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
$DEBUG_RDOC = nil
|
||||
|
||||
# :main: README.rdoc
|
||||
|
@ -65,7 +65,7 @@ module RDoc
|
|||
##
|
||||
# RDoc version you are using
|
||||
|
||||
VERSION = '6.0.0.beta3'
|
||||
VERSION = '6.0.0.beta4'
|
||||
|
||||
##
|
||||
# Method visibilities
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Represent an alias, which is an old_name/new_name pair associated with a
|
||||
# particular context
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An anonymous class like:
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# AnyMethod is the base class for objects representing methods
|
||||
|
||||
|
@ -244,9 +244,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|||
if @block_params then
|
||||
# If this method has explicit block parameters, remove any explicit
|
||||
# &block
|
||||
params.sub!(/,?\s*&\w+/, '')
|
||||
params = params.sub(/,?\s*&\w+/, '')
|
||||
else
|
||||
params.sub!(/\&(\w+)/, '\1')
|
||||
params = params.sub(/\&(\w+)/, '\1')
|
||||
end
|
||||
|
||||
params = params.gsub(/\s+/, '').split(',').reject(&:empty?)
|
||||
|
@ -265,7 +265,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|||
params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2')
|
||||
elsif @params then
|
||||
params = @params.gsub(/\s*\#.*/, '')
|
||||
params = params.tr("\n", " ").squeeze(" ")
|
||||
params = params.tr_s("\n ", " ")
|
||||
params = "(#{params})" unless params[0] == ?(
|
||||
else
|
||||
params = ''
|
||||
|
@ -274,11 +274,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|||
if @block_params then
|
||||
# If this method has explicit block parameters, remove any explicit
|
||||
# &block
|
||||
params.sub!(/,?\s*&\w+/, '')
|
||||
params = params.sub(/,?\s*&\w+/, '')
|
||||
|
||||
block = @block_params.tr("\n", " ").squeeze(" ")
|
||||
block = @block_params.tr_s("\n ", " ")
|
||||
if block[0] == ?(
|
||||
block.sub!(/^\(/, '').sub!(/\)/, '')
|
||||
block = block.sub(/^\(/, '').sub(/\)/, '')
|
||||
end
|
||||
params << " { |#{block}| ... }"
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An attribute created by \#attr, \#attr_reader, \#attr_writer or
|
||||
# \#attr_accessor
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# ClassModule is the base class for objects representing either a class or a
|
||||
# module.
|
||||
|
@ -136,7 +136,9 @@ class RDoc::ClassModule < RDoc::Context
|
|||
normalize_comment comment
|
||||
end
|
||||
|
||||
@comment_location.delete_if { |(_, l)| l == location }
|
||||
if location.parser == RDoc::Parser::C
|
||||
@comment_location.delete_if { |(_, l)| l == location }
|
||||
end
|
||||
|
||||
@comment_location << [comment, location]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Base class for the RDoc code tree.
|
||||
#
|
||||
|
@ -144,7 +144,7 @@ class RDoc::CodeObject
|
|||
# HACK correct fix is to have #initialize create @comment
|
||||
# with the correct encoding
|
||||
if String === @comment and @comment.empty? then
|
||||
@comment.force_encoding comment.encoding
|
||||
@comment = RDoc::Encoding.change_encoding @comment, comment.encoding
|
||||
end
|
||||
@comment
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
# This file was used to load all the RDoc::CodeObject subclasses at once. Now
|
||||
# autoload handles this.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A comment holds the text comment for a RDoc::CodeObject and provides a
|
||||
# unified way of cleaning it up and parsing it into an RDoc::Markup::Document.
|
||||
|
@ -45,7 +45,7 @@ class RDoc::Comment
|
|||
|
||||
def initialize text = nil, location = nil
|
||||
@location = location
|
||||
@text = text
|
||||
@text = text.nil? ? nil : text.dup
|
||||
|
||||
@document = nil
|
||||
@format = 'rdoc'
|
||||
|
@ -114,10 +114,14 @@ class RDoc::Comment
|
|||
|
||||
method.call_seq = seq.chomp
|
||||
|
||||
elsif @text.sub!(/^\s*:?call-seq:(.*?)(^\s*$|\z)/m, '') then
|
||||
seq = $1
|
||||
seq.gsub!(/^\s*/, '')
|
||||
method.call_seq = seq
|
||||
else
|
||||
regexp = /^\s*:?call-seq:(.*?)(^\s*$|\z)/m
|
||||
if regexp =~ @text then
|
||||
@text = @text.sub(regexp, '')
|
||||
seq = $1
|
||||
seq.gsub!(/^\s*/, '')
|
||||
method.call_seq = seq
|
||||
end
|
||||
end
|
||||
|
||||
method
|
||||
|
@ -133,8 +137,14 @@ class RDoc::Comment
|
|||
##
|
||||
# HACK dubious
|
||||
|
||||
def force_encoding encoding
|
||||
@text.force_encoding encoding
|
||||
def encode! encoding
|
||||
# TODO: Remove this condition after Ruby 2.2 EOL
|
||||
if RUBY_VERSION < '2.3.0'
|
||||
@text = @text.force_encoding encoding
|
||||
else
|
||||
@text = String.new @text, encoding: encoding
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -200,7 +210,7 @@ class RDoc::Comment
|
|||
def remove_private
|
||||
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
|
||||
empty = ''
|
||||
empty.force_encoding @text.encoding
|
||||
empty = RDoc::Encoding.change_encoding empty, @text.encoding
|
||||
|
||||
@text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
|
||||
@text = @text.sub(%r%^\s*[#*]?--.*%m, '')
|
||||
|
@ -216,7 +226,7 @@ class RDoc::Comment
|
|||
@text.nil? and @document
|
||||
|
||||
@document = nil
|
||||
@text = text
|
||||
@text = text.nil? ? nil : text.dup
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A constant
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'cgi'
|
||||
|
||||
##
|
||||
|
@ -239,7 +239,7 @@ class RDoc::Context < RDoc::CodeObject
|
|||
|
||||
if known then
|
||||
known.comment = attribute.comment if known.comment.empty?
|
||||
elsif registered = @methods_hash[attribute.pretty_name << '='] and
|
||||
elsif registered = @methods_hash[attribute.pretty_name + '='] and
|
||||
RDoc::Attr === registered then
|
||||
registered.rw = 'RW'
|
||||
else
|
||||
|
@ -249,7 +249,7 @@ class RDoc::Context < RDoc::CodeObject
|
|||
end
|
||||
|
||||
if attribute.rw.index 'W' then
|
||||
key = attribute.pretty_name << '='
|
||||
key = attribute.pretty_name + '='
|
||||
known = @methods_hash[key]
|
||||
|
||||
if known then
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A section of documentation like:
|
||||
#
|
||||
|
@ -43,7 +43,7 @@ class RDoc::Context::Section
|
|||
@parent = parent
|
||||
@title = title ? title.strip : title
|
||||
|
||||
@@sequence.succ!
|
||||
@@sequence = @@sequence.succ
|
||||
@sequence = @@sequence.dup
|
||||
|
||||
@comments = []
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# RDoc::CrossReference is a reusable way to create cross references for names.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# coding: US-ASCII
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
##
|
||||
# This class is a wrapper around File IO and Encoding that helps RDoc load
|
||||
|
@ -23,26 +23,26 @@ module RDoc::Encoding
|
|||
|
||||
utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
|
||||
|
||||
RDoc::Encoding.set_encoding content
|
||||
content = RDoc::Encoding.set_encoding content
|
||||
|
||||
begin
|
||||
encoding ||= Encoding.default_external
|
||||
orig_encoding = content.encoding
|
||||
|
||||
if not orig_encoding.ascii_compatible? then
|
||||
content.encode! encoding
|
||||
content = content.encode encoding
|
||||
elsif utf8 then
|
||||
content.force_encoding Encoding::UTF_8
|
||||
content.encode! encoding
|
||||
content = RDoc::Encoding.change_encoding content, Encoding::UTF_8
|
||||
content = content.encode encoding
|
||||
else
|
||||
# assume the content is in our output encoding
|
||||
content.force_encoding encoding
|
||||
content = RDoc::Encoding.change_encoding content, encoding
|
||||
end
|
||||
|
||||
unless content.valid_encoding? then
|
||||
# revert and try to transcode
|
||||
content.force_encoding orig_encoding
|
||||
content.encode! encoding
|
||||
content = RDoc::Encoding.change_encoding content, orig_encoding
|
||||
content = content.encode encoding
|
||||
end
|
||||
|
||||
unless content.valid_encoding? then
|
||||
|
@ -52,10 +52,11 @@ module RDoc::Encoding
|
|||
rescue Encoding::InvalidByteSequenceError,
|
||||
Encoding::UndefinedConversionError => e
|
||||
if force_transcode then
|
||||
content.force_encoding orig_encoding
|
||||
content.encode!(encoding,
|
||||
:invalid => :replace, :undef => :replace,
|
||||
:replace => '?')
|
||||
content = RDoc::Encoding.change_encoding content, orig_encoding
|
||||
content = content.encode(encoding,
|
||||
:invalid => :replace,
|
||||
:undef => :replace,
|
||||
:replace => '?')
|
||||
return content
|
||||
else
|
||||
warn "unable to convert #{e.message} for #{filename}, skipping"
|
||||
|
@ -77,15 +78,17 @@ module RDoc::Encoding
|
|||
first_line = $1
|
||||
|
||||
if first_line =~ /\A# +frozen[-_]string[-_]literal[=:].+$/i
|
||||
string.sub! first_line, ''
|
||||
string = string.sub first_line, ''
|
||||
end
|
||||
|
||||
string
|
||||
end
|
||||
|
||||
##
|
||||
# Sets the encoding of +string+ based on the magic comment
|
||||
|
||||
def self.set_encoding string
|
||||
remove_frozen_string_literal string
|
||||
string = remove_frozen_string_literal string
|
||||
|
||||
string =~ /\A(?:#!.*\n)?(.*\n)/
|
||||
|
||||
|
@ -94,15 +97,34 @@ module RDoc::Encoding
|
|||
name = case first_line
|
||||
when /^<\?xml[^?]*encoding=(["'])(.*?)\1/ then $2
|
||||
when /\b(?:en)?coding[=:]\s*([^\s;]+)/i then $1
|
||||
else return
|
||||
else return string
|
||||
end
|
||||
|
||||
string.sub! first_line, ''
|
||||
string = string.sub first_line, ''
|
||||
|
||||
remove_frozen_string_literal string
|
||||
string = remove_frozen_string_literal string
|
||||
|
||||
enc = Encoding.find name
|
||||
string.force_encoding enc if enc
|
||||
string = RDoc::Encoding.change_encoding string, enc if enc
|
||||
|
||||
string
|
||||
end
|
||||
|
||||
##
|
||||
# Changes encoding based on +encoding+ without converting and returns new
|
||||
# string
|
||||
|
||||
def self.change_encoding text, encoding
|
||||
if text.kind_of? RDoc::Comment
|
||||
text.encode! encoding
|
||||
else
|
||||
# TODO: Remove this condition after Ruby 2.2 EOL
|
||||
if RUBY_VERSION < '2.3.0'
|
||||
text.force_encoding encoding
|
||||
else
|
||||
String.new text, encoding: encoding
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Allows an ERB template to be rendered in the context (binding) of an
|
||||
# existing ERB template evaluation.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'erb'
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A Module extension to a class with \#extend
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# RDoc uses generators to turn parsed source code in the form of an
|
||||
# RDoc::CodeObject tree into some form of output. RDoc comes with the HTML
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
# -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*-
|
||||
|
||||
require 'erb'
|
||||
|
@ -313,12 +313,16 @@ class RDoc::Generator::Darkfish
|
|||
search_index_rel_prefix = rel_prefix
|
||||
search_index_rel_prefix += @asset_rel_path if @file_output
|
||||
|
||||
# suppress 1.9.3 warning
|
||||
asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
|
||||
@title = @options.title
|
||||
|
||||
render_template template_file, out_file do |io| binding end
|
||||
render_template template_file, out_file do |io|
|
||||
here = binding
|
||||
# suppress 1.9.3 warning
|
||||
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
||||
here
|
||||
end
|
||||
rescue => e
|
||||
error = RDoc::Error.new \
|
||||
"error generating index.html: #{e.message} (#{e.class})"
|
||||
|
@ -343,14 +347,19 @@ class RDoc::Generator::Darkfish
|
|||
search_index_rel_prefix = rel_prefix
|
||||
search_index_rel_prefix += @asset_rel_path if @file_output
|
||||
|
||||
# suppress 1.9.3 warning
|
||||
asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
svninfo = svninfo = get_svninfo(current)
|
||||
asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
svninfo = get_svninfo(current)
|
||||
|
||||
@title = "#{klass.type} #{klass.full_name} - #{@options.title}"
|
||||
|
||||
debug_msg " rendering #{out_file}"
|
||||
render_template template_file, out_file do |io| binding end
|
||||
render_template template_file, out_file do |io|
|
||||
here = binding
|
||||
# suppress 1.9.3 warning
|
||||
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
||||
here.local_variable_set(:svninfo, svninfo)
|
||||
here
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -416,8 +425,7 @@ class RDoc::Generator::Darkfish
|
|||
search_index_rel_prefix = rel_prefix
|
||||
search_index_rel_prefix += @asset_rel_path if @file_output
|
||||
|
||||
# suppress 1.9.3 warning
|
||||
asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
|
||||
unless filepage_file then
|
||||
if file.text? then
|
||||
|
@ -434,7 +442,13 @@ class RDoc::Generator::Darkfish
|
|||
@title += " - #{@options.title}"
|
||||
template_file ||= filepage_file
|
||||
|
||||
render_template template_file, out_file do |io| binding end
|
||||
render_template template_file, out_file do |io|
|
||||
here = binding
|
||||
# suppress 1.9.3 warning
|
||||
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
||||
here.local_variable_set(:current, current)
|
||||
here
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
error =
|
||||
|
@ -458,14 +472,19 @@ class RDoc::Generator::Darkfish
|
|||
search_index_rel_prefix = rel_prefix
|
||||
search_index_rel_prefix += @asset_rel_path if @file_output
|
||||
|
||||
# suppress 1.9.3 warning
|
||||
current = current = file
|
||||
asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
current = file
|
||||
asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
|
||||
@title = "#{file.page_name} - #{@options.title}"
|
||||
|
||||
debug_msg " rendering #{out_file}"
|
||||
render_template template_file, out_file do |io| binding end
|
||||
render_template template_file, out_file do |io|
|
||||
here = binding
|
||||
# suppress 1.9.3 warning
|
||||
here.local_variable_set(:current, current)
|
||||
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
||||
here
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -483,12 +502,16 @@ class RDoc::Generator::Darkfish
|
|||
search_index_rel_prefix = rel_prefix
|
||||
search_index_rel_prefix += @asset_rel_path if @file_output
|
||||
|
||||
# suppress 1.9.3 warning
|
||||
asset_rel_prefix = asset_rel_prefix = ''
|
||||
asset_rel_prefix = ''
|
||||
|
||||
@title = 'Not Found'
|
||||
|
||||
render_template template_file do |io| binding end
|
||||
render_template template_file do |io|
|
||||
here = binding
|
||||
# suppress 1.9.3 warning
|
||||
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
||||
here
|
||||
end
|
||||
rescue => e
|
||||
error = RDoc::Error.new \
|
||||
"error generating servlet_not_found: #{e.message} (#{e.class})"
|
||||
|
@ -540,12 +563,16 @@ class RDoc::Generator::Darkfish
|
|||
search_index_rel_prefix = rel_prefix
|
||||
search_index_rel_prefix += @asset_rel_path if @file_output
|
||||
|
||||
# suppress 1.9.3 warning
|
||||
asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
asset_rel_prefix = rel_prefix + @asset_rel_path
|
||||
|
||||
@title = "Table of Contents - #{@options.title}"
|
||||
|
||||
render_template template_file, out_file do |io| binding end
|
||||
render_template template_file, out_file do |io|
|
||||
here = binding
|
||||
# suppress 1.9.3 warning
|
||||
here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)
|
||||
here
|
||||
end
|
||||
rescue => e
|
||||
error = RDoc::Error.new \
|
||||
"error generating table_of_contents.html: #{e.message} (#{e.class})"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'json'
|
||||
begin
|
||||
require 'zlib'
|
||||
|
@ -161,7 +161,7 @@ class RDoc::Generator::JsonIndex
|
|||
# Compress the search_index.js file using gzip
|
||||
|
||||
def generate_gzipped
|
||||
return unless defined?(Zlib)
|
||||
return if @options.dry_run or not defined?(Zlib)
|
||||
|
||||
debug_msg "Compressing generated JSON index"
|
||||
out_dir = @base_dir + @options.op_dir
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Handle common RDoc::Markup tasks for various CodeObjects
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Generates a POT file.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Extracts message from RDoc::Store
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Generates a PO format text
|
||||
|
||||
|
@ -29,8 +29,8 @@ class RDoc::Generator::POT::PO
|
|||
def to_s
|
||||
po = ''
|
||||
sort_entries.each do |entry|
|
||||
po << "\n" unless po.empty?
|
||||
po << entry.to_s
|
||||
po += "\n" unless po.empty?
|
||||
po += entry.to_s
|
||||
end
|
||||
po
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A PO entry in PO
|
||||
|
||||
|
@ -40,11 +40,11 @@ class RDoc::Generator::POT::POEntry
|
|||
|
||||
def to_s
|
||||
entry = ''
|
||||
entry << format_translator_comment
|
||||
entry << format_extracted_comment
|
||||
entry << format_references
|
||||
entry << format_flags
|
||||
entry << <<-ENTRY
|
||||
entry += format_translator_comment
|
||||
entry += format_extracted_comment
|
||||
entry += format_references
|
||||
entry += format_flags
|
||||
entry += <<-ENTRY
|
||||
msgid #{format_message(@msgid)}
|
||||
msgstr #{format_message(@msgstr)}
|
||||
ENTRY
|
||||
|
@ -75,9 +75,9 @@ msgstr #{format_message(@msgstr)}
|
|||
|
||||
formatted_comment = ''
|
||||
comment.each_line do |line|
|
||||
formatted_comment << "#{mark} #{line}"
|
||||
formatted_comment += "#{mark} #{line}"
|
||||
end
|
||||
formatted_comment << "\n" unless formatted_comment.end_with?("\n")
|
||||
formatted_comment += "\n" unless formatted_comment.end_with?("\n")
|
||||
formatted_comment
|
||||
end
|
||||
|
||||
|
@ -94,7 +94,7 @@ msgstr #{format_message(@msgstr)}
|
|||
|
||||
formatted_references = ''
|
||||
@references.sort.each do |file, line|
|
||||
formatted_references << "\#: #{file}:#{line}\n"
|
||||
formatted_references += "\#: #{file}:#{line}\n"
|
||||
end
|
||||
formatted_references
|
||||
end
|
||||
|
@ -111,8 +111,8 @@ msgstr #{format_message(@msgstr)}
|
|||
|
||||
formatted_message = '""'
|
||||
message.each_line do |line|
|
||||
formatted_message << "\n"
|
||||
formatted_message << "\"#{escape(line)}\""
|
||||
formatted_message += "\n"
|
||||
formatted_message += "\"#{escape(line)}\""
|
||||
end
|
||||
formatted_message
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Generates ri data files
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# GhostMethod represents a method referenced only by a comment
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# This module provides i18n related features.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A message container for a locale.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An i18n supported text.
|
||||
#
|
||||
|
@ -46,9 +46,9 @@ class RDoc::I18n::Text
|
|||
parse do |part|
|
||||
case part[:type]
|
||||
when :paragraph
|
||||
translated_text << locale.translate(part[:paragraph])
|
||||
translated_text += locale.translate(part[:paragraph])
|
||||
when :empty_line
|
||||
translated_text << part[:line]
|
||||
translated_text += part[:line]
|
||||
else
|
||||
raise "should not reach here: unexpected type: #{type}"
|
||||
end
|
||||
|
@ -69,14 +69,14 @@ class RDoc::I18n::Text
|
|||
if paragraph.empty?
|
||||
emit_empty_line_event(line, line_no, &block)
|
||||
else
|
||||
paragraph << line
|
||||
paragraph += line
|
||||
emit_paragraph_event(paragraph, paragraph_start_line, line_no,
|
||||
&block)
|
||||
paragraph = ''
|
||||
end
|
||||
else
|
||||
paragraph_start_line = line_no if paragraph.empty?
|
||||
paragraph << line
|
||||
paragraph += line
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A Module included in a class with \#include
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
module RDoc
|
||||
|
||||
##
|
||||
|
|
1446
lib/rdoc/markdown.rb
1446
lib/rdoc/markdown.rb
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# HTML entity name map for RDoc::Markdown
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# coding: UTF-8
|
||||
# frozen_string_literal: false
|
||||
# :markup: markdown
|
||||
|
||||
##
|
||||
|
@ -183,14 +182,26 @@ class RDoc::Markdown::Literals
|
|||
return nil
|
||||
end
|
||||
|
||||
def get_byte
|
||||
if @pos >= @string_size
|
||||
return nil
|
||||
end
|
||||
if "".respond_to? :ord
|
||||
def get_byte
|
||||
if @pos >= @string_size
|
||||
return nil
|
||||
end
|
||||
|
||||
s = @string[@pos].ord
|
||||
@pos += 1
|
||||
s
|
||||
s = @string[@pos].ord
|
||||
@pos += 1
|
||||
s
|
||||
end
|
||||
else
|
||||
def get_byte
|
||||
if @pos >= @string_size
|
||||
return nil
|
||||
end
|
||||
|
||||
s = @string[@pos]
|
||||
@pos += 1
|
||||
s
|
||||
end
|
||||
end
|
||||
|
||||
def parse(rule=nil)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# RDoc::Markup parses plain text documents and attempts to decompose them into
|
||||
# their constituent parts. Some of these parts are high-level: paragraphs,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
class RDoc::Markup
|
||||
|
||||
AttrChanger = Struct.new :turn_on, :turn_off # :nodoc:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An array of attributes which parallels the characters in a string.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Manages changes of attributes in a block of text
|
||||
|
||||
|
@ -246,7 +246,7 @@ class RDoc::Markup::AttributeManager
|
|||
# Processes +str+ converting attributes, HTML and specials
|
||||
|
||||
def flow str
|
||||
@str = str
|
||||
@str = str.dup
|
||||
|
||||
mask_protected_sequences
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# We manage a set of attributes. Each attribute has a symbol name and a bit
|
||||
# value.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An empty line. This class is a singleton.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A quoted section which contains markup items.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A Document containing lists, headings, paragraphs, etc.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Base class for RDoc markup formatters
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'minitest/unit'
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A hard-break in the middle of a paragraph.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A heading with a level (1-6) and text
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A file included at generation time. Objects of this class are created by
|
||||
# RDoc::RD for an extension-less include.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An Indented Paragraph of text
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A List is a homogeneous set of ListItems.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# An item within a List that contains paragraphs, headings, etc.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A Paragraph of text
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'strscan'
|
||||
|
||||
##
|
||||
|
@ -249,7 +249,7 @@ class RDoc::Markup::Parser
|
|||
|
||||
min_indent = nil
|
||||
generate_leading_spaces = true
|
||||
line = ''
|
||||
line = ''.dup
|
||||
|
||||
until @tokens.empty? do
|
||||
type, data, column, = get
|
||||
|
@ -257,7 +257,7 @@ class RDoc::Markup::Parser
|
|||
if type == :NEWLINE then
|
||||
line << data
|
||||
verbatim << line
|
||||
line = ''
|
||||
line = ''.dup
|
||||
generate_leading_spaces = true
|
||||
next
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Handle common directives that can occur in a block of text:
|
||||
#
|
||||
|
@ -105,7 +105,7 @@ class RDoc::Markup::PreProcess
|
|||
# regexp helper (square brackets for optional)
|
||||
# $1 $2 $3 $4 $5
|
||||
# [prefix][\]:directive:[spaces][param]newline
|
||||
text.gsub!(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do
|
||||
text = text.gsub(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do
|
||||
# skip something like ':toto::'
|
||||
next $& if $4.empty? and $5 and $5[0, 1] == ':'
|
||||
|
||||
|
@ -123,7 +123,11 @@ class RDoc::Markup::PreProcess
|
|||
handle_directive $1, $3, $5, code_object, text.encoding, &block
|
||||
end
|
||||
|
||||
comment = text unless comment
|
||||
if comment then
|
||||
comment.text = text
|
||||
else
|
||||
comment = text
|
||||
end
|
||||
|
||||
self.class.post_processors.each do |handler|
|
||||
handler.call comment, code_object
|
||||
|
@ -150,7 +154,7 @@ class RDoc::Markup::PreProcess
|
|||
|
||||
case directive
|
||||
when 'arg', 'args' then
|
||||
return "#{prefix}:#{directive}: #{param}\n" unless code_object
|
||||
return "#{prefix}:#{directive}: #{param}\n" unless code_object && code_object.kind_of?(RDoc::AnyMethod)
|
||||
|
||||
code_object.params = param
|
||||
|
||||
|
@ -212,7 +216,7 @@ class RDoc::Markup::PreProcess
|
|||
when 'yield', 'yields' then
|
||||
return blankline unless code_object
|
||||
# remove parameter &block
|
||||
code_object.params.sub!(/,?\s*&\w+/, '') if code_object.params
|
||||
code_object.params = code_object.params.sub(/,?\s*&\w+/, '') if code_object.params
|
||||
|
||||
code_object.block_params = param
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A section of text that is added to the output document as-is
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A horizontal rule with a weight
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Hold details of a special sequence
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Test case for creating new plain-text RDoc::Markup formatters. See also
|
||||
# RDoc::Markup::FormatterTestCase
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Outputs RDoc markup with vibrant ANSI color!
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Outputs RDoc markup with hot backspace action! You will probably need a
|
||||
# pager to use this output format.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'cgi'
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Subclass of the RDoc::Markup::ToHtml class that supports looking up method
|
||||
# names, classes, etc to create links. RDoc::CrossReference is used to
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Outputs RDoc markup as paragraphs with inline markup only.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Joins the parts of an RDoc::Markup::Paragraph into a single String.
|
||||
#
|
||||
|
@ -23,37 +23,11 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
|
|||
# Converts the parts of +paragraph+ to a single entry.
|
||||
|
||||
def accept_paragraph paragraph
|
||||
parts = []
|
||||
string = false
|
||||
|
||||
paragraph.parts.each do |part|
|
||||
if String === part then
|
||||
if string then
|
||||
string << part
|
||||
else
|
||||
parts << part
|
||||
string = part
|
||||
end
|
||||
else
|
||||
parts << part
|
||||
string = false
|
||||
end
|
||||
end
|
||||
|
||||
parts = parts.map do |part|
|
||||
if String === part then
|
||||
part.rstrip
|
||||
else
|
||||
part
|
||||
end
|
||||
end
|
||||
|
||||
# TODO use Enumerable#chunk when Ruby 1.8 support is dropped
|
||||
#parts = paragraph.parts.chunk do |part|
|
||||
# String === part
|
||||
#end.map do |string, chunk|
|
||||
# string ? chunk.join.rstrip : chunk
|
||||
#end.flatten
|
||||
parts = paragraph.parts.chunk do |part|
|
||||
String === part
|
||||
end.map do |string, chunk|
|
||||
string ? chunk.join.rstrip : chunk
|
||||
end.flatten
|
||||
|
||||
paragraph.parts.replace parts
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'cgi'
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
# :markup: markdown
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Outputs RDoc markup as RDoc markup! (mostly)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Extracts just the RDoc::Markup::Heading elements from a
|
||||
# RDoc::Markup::Document to help build a table of contents
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# This Markup outputter is used for testing purposes.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Extracts sections of text enclosed in plus, tt or code. Used to discover
|
||||
# undocumented parameters.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A section of verbatim text
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# MetaMethod represents a meta-programmed method
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Abstract class representing either a method or an attribute.
|
||||
|
||||
|
@ -188,7 +188,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|||
next if String === ancestor
|
||||
next if parent == ancestor
|
||||
|
||||
other = ancestor.find_method_named('#' << name) ||
|
||||
other = ancestor.find_method_named('#' + name) ||
|
||||
ancestor.find_attribute_named(name)
|
||||
|
||||
return other if other
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A Mixin adds features from a module into another context. RDoc::Include and
|
||||
# RDoc::Extend are both mixins.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A normal class, neither singleton nor anonymous
|
||||
|
||||
|
@ -47,9 +47,9 @@ class RDoc::NormalClass < RDoc::ClassModule
|
|||
def to_s # :nodoc:
|
||||
display = "#{self.class.name} #{self.full_name}"
|
||||
if superclass
|
||||
display << ' < ' << (superclass.is_a?(String) ? superclass : superclass.full_name)
|
||||
display += ' < ' + (superclass.is_a?(String) ? superclass : superclass.full_name)
|
||||
end
|
||||
display << ' -> ' << is_alias_for.to_s if is_alias_for
|
||||
display += ' -> ' + is_alias_for.to_s if is_alias_for
|
||||
display
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A normal module, like NormalClass
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'optparse'
|
||||
require 'pathname'
|
||||
|
||||
|
@ -624,16 +624,16 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
end
|
||||
|
||||
parsers.sort.each do |parser, regexp|
|
||||
opt.banner << " - #{parser}: #{regexp.join ', '}\n"
|
||||
opt.banner += " - #{parser}: #{regexp.join ', '}\n"
|
||||
end
|
||||
opt.banner << " - TomDoc: Only in ruby files\n"
|
||||
opt.banner += " - TomDoc: Only in ruby files\n"
|
||||
|
||||
opt.banner << "\n The following options are deprecated:\n\n"
|
||||
opt.banner += "\n The following options are deprecated:\n\n"
|
||||
|
||||
name_length = DEPRECATED.keys.sort_by { |k| k.length }.last.length
|
||||
|
||||
DEPRECATED.sort_by { |k,| k }.each do |name, reason|
|
||||
opt.banner << " %*1$2$s %3$s\n" % [-name_length, name, reason]
|
||||
opt.banner += " %*1$2$s %3$s\n" % [-name_length, name, reason]
|
||||
end
|
||||
|
||||
opt.accept Template do |template|
|
||||
|
@ -1087,7 +1087,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|||
|
||||
unless quiet then
|
||||
deprecated.each do |opt|
|
||||
$stderr.puts 'option ' << opt << ' is deprecated: ' << DEPRECATED[opt]
|
||||
$stderr.puts 'option ' + opt + ' is deprecated: ' + DEPRECATED[opt]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: us-ascii -*-
|
||||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
##
|
||||
# A parser is simple a class that subclasses RDoc::Parser and implements #scan
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'tsort'
|
||||
|
||||
##
|
||||
|
@ -865,8 +865,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
|
||||
def handle_attr(var_name, attr_name, read, write)
|
||||
rw = ''
|
||||
rw << 'R' if '1' == read
|
||||
rw << 'W' if '1' == write
|
||||
rw += 'R' if '1' == read
|
||||
rw += 'W' if '1' == write
|
||||
|
||||
class_name = @known_classes[var_name]
|
||||
|
||||
|
@ -982,8 +982,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
if new_definition.empty? then # Default to literal C definition
|
||||
new_definition = definition
|
||||
else
|
||||
new_definition.gsub!("\:", ":")
|
||||
new_definition.gsub!("\\", '\\')
|
||||
new_definition = new_definition.gsub("\:", ":")
|
||||
new_definition = new_definition.gsub("\\", '\\')
|
||||
end
|
||||
|
||||
new_definition.sub!(/\A(\s+)/, '')
|
||||
|
@ -1237,7 +1237,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
# when scanning for classes and methods
|
||||
|
||||
def remove_commented_out_lines
|
||||
@content.gsub!(%r%//.*rb_define_%, '//')
|
||||
@content = @content.gsub(%r%//.*rb_define_%, '//')
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'time'
|
||||
|
||||
##
|
||||
|
@ -29,13 +29,13 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|||
|
||||
if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
|
||||
last.sub!(/\)\s*\z/, ',')
|
||||
continuation.sub!(/\A\(/, '')
|
||||
continuation = continuation.sub(/\A\(/, '')
|
||||
end
|
||||
|
||||
if last =~ /\s\z/ then
|
||||
last << continuation
|
||||
else
|
||||
last << ' ' << continuation
|
||||
last << ' ' + continuation
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -162,12 +162,12 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|||
|
||||
entry_body = []
|
||||
when /^(\t| {8})?\*\s*(.*)/ then # "\t* file.c (func): ..."
|
||||
entry_body << $2
|
||||
entry_body << $2.dup
|
||||
when /^(\t| {8})?\s*(\(.*)/ then # "\t(func): ..."
|
||||
entry = $2
|
||||
|
||||
if entry_body.last =~ /:/ then
|
||||
entry_body << entry
|
||||
entry_body << entry.dup
|
||||
else
|
||||
continue_entry_body entry_body, entry
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Parse a Markdown format file. The parsed RDoc::Markup::Document is attached
|
||||
# as a file comment.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Parse a RD format file. The parsed RDoc::Markup::Document is attached as a
|
||||
# file comment.
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'ripper'
|
||||
|
||||
class RDoc::RipperStateLex
|
||||
# TODO: Remove this constants after Ruby 2.4 EOL
|
||||
RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
|
||||
|
||||
EXPR_NONE = 0
|
||||
EXPR_BEG = 1
|
||||
EXPR_END = 2
|
||||
|
@ -283,7 +286,22 @@ class RDoc::RipperStateLex
|
|||
@callback = block
|
||||
parse
|
||||
end
|
||||
end
|
||||
end unless RIPPER_HAS_LEX_STATE
|
||||
|
||||
class InnerStateLex < Ripper::Filter
|
||||
def initialize(code)
|
||||
super(code)
|
||||
end
|
||||
|
||||
def on_default(event, tok, data)
|
||||
@callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => state})
|
||||
end
|
||||
|
||||
def each(&block)
|
||||
@callback = block
|
||||
parse
|
||||
end
|
||||
end if RIPPER_HAS_LEX_STATE
|
||||
|
||||
def get_squashed_tk
|
||||
if @buf.empty?
|
||||
|
@ -297,10 +315,10 @@ class RDoc::RipperStateLex
|
|||
when :on_tstring_beg then
|
||||
tk = get_string_tk(tk)
|
||||
when :on_backtick then
|
||||
if (EXPR_FNAME & tk[:state]) != 0
|
||||
@inner_lex.lex_state = EXPR_ARG
|
||||
if (tk[:state] & (EXPR_FNAME | EXPR_ENDFN)) != 0
|
||||
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
|
||||
tk[:kind] = :on_ident
|
||||
tk[:state] = @inner_lex.lex_state
|
||||
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
|
||||
else
|
||||
tk = get_string_tk(tk)
|
||||
end
|
||||
|
@ -310,7 +328,7 @@ class RDoc::RipperStateLex
|
|||
tk = get_embdoc_tk(tk)
|
||||
when :on_heredoc_beg then
|
||||
@heredoc_queue << retrieve_heredoc_info(tk)
|
||||
@inner_lex.lex_state = EXPR_END
|
||||
@inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE
|
||||
when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then
|
||||
unless @heredoc_queue.empty?
|
||||
get_heredoc_tk(*@heredoc_queue.shift)
|
||||
|
@ -540,10 +558,10 @@ class RDoc::RipperStateLex
|
|||
|
||||
private def get_op_tk(tk)
|
||||
redefinable_operators = %w[! != !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> [] []= ^ ` | ~]
|
||||
if redefinable_operators.include?(tk[:text]) and EXPR_ARG == tk[:state] then
|
||||
@inner_lex.lex_state = EXPR_ARG
|
||||
if redefinable_operators.include?(tk[:text]) and tk[:state] == EXPR_ARG then
|
||||
@inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE
|
||||
tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG
|
||||
tk[:kind] = :on_ident
|
||||
tk[:state] = @inner_lex.lex_state
|
||||
elsif tk[:text] =~ /^[-+]$/ then
|
||||
tk_ahead = get_squashed_tk
|
||||
case tk_ahead[:kind]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# This file contains stuff stolen outright from:
|
||||
#
|
||||
|
@ -239,8 +239,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
|
||||
def collect_first_comment
|
||||
skip_tkspace
|
||||
comment = ''
|
||||
comment.force_encoding @encoding if @encoding
|
||||
comment = ''.dup
|
||||
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
||||
first_line = true
|
||||
first_comment_tk_kind = nil
|
||||
|
||||
|
@ -318,8 +318,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
end
|
||||
|
||||
##
|
||||
# Looks for a true or false token. Returns false if TkFALSE or TkNIL are
|
||||
# found.
|
||||
# Looks for a true or false token.
|
||||
|
||||
def get_bool
|
||||
skip_tkspace
|
||||
|
@ -342,7 +341,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
def get_class_or_module container, ignore_constants = false
|
||||
skip_tkspace
|
||||
name_t = get_tk
|
||||
given_name = ''
|
||||
given_name = ''.dup
|
||||
|
||||
# class ::A -> A is in the top level
|
||||
if :on_op == name_t[:kind] and '::' == name_t[:text] then # bug
|
||||
|
@ -379,7 +378,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
if prev_container == container and !ignore_constants
|
||||
given_name = name_t[:text]
|
||||
else
|
||||
given_name << '::' << name_t[:text]
|
||||
given_name << '::' + name_t[:text]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -574,27 +573,28 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
#
|
||||
# This routine modifies its +comment+ parameter.
|
||||
|
||||
def look_for_directives_in context, comment
|
||||
@preprocess.handle comment, context do |directive, param|
|
||||
def look_for_directives_in container, comment
|
||||
@preprocess.handle comment, container do |directive, param|
|
||||
case directive
|
||||
when 'method', 'singleton-method',
|
||||
'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then
|
||||
false # handled elsewhere
|
||||
when 'section' then
|
||||
context.set_current_section param, comment.dup
|
||||
break unless container.kind_of?(RDoc::Context)
|
||||
container.set_current_section param, comment.dup
|
||||
comment.text = ''
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
remove_private_comments comment
|
||||
comment.remove_private
|
||||
end
|
||||
|
||||
##
|
||||
# Adds useful info about the parser to +message+
|
||||
|
||||
def make_message message
|
||||
prefix = "#{@file_name}:"
|
||||
prefix = "#{@file_name}:".dup
|
||||
|
||||
tk = peek_tk
|
||||
prefix << "#{tk[:line_no]}:#{tk[:char_no]}:" if tk
|
||||
|
@ -913,7 +913,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
|
||||
return unless body
|
||||
|
||||
value.replace body
|
||||
con.value = body
|
||||
record_location con
|
||||
con.line = line_no
|
||||
read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
|
||||
|
@ -928,7 +928,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
|
||||
def parse_constant_body container, constant, is_array_or_hash # :nodoc:
|
||||
nest = 0
|
||||
rhs_name = ''
|
||||
rhs_name = ''.dup
|
||||
|
||||
get_tkread
|
||||
|
||||
|
@ -944,7 +944,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then
|
||||
nest += 1
|
||||
elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then
|
||||
if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0
|
||||
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
|
||||
nest += 1
|
||||
end
|
||||
elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) ||
|
||||
|
@ -990,14 +990,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
column = tk[:char_no]
|
||||
line_no = tk[:line_no]
|
||||
|
||||
text = comment.text
|
||||
|
||||
singleton = !!text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
||||
comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
||||
singleton = !!$~
|
||||
|
||||
co =
|
||||
if text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
|
||||
parse_comment_ghost container, text, $1, column, line_no, comment
|
||||
elsif text.sub!(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
|
||||
if (comment.text = comment.text.sub(/^# +:?method: *(\S*).*?\n/i, '')) && !!$~ then
|
||||
parse_comment_ghost container, comment.text, $1, column, line_no, comment
|
||||
elsif (comment.text = comment.text.sub(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '')) && !!$~ then
|
||||
parse_comment_attr container, $1, $3, comment
|
||||
end
|
||||
|
||||
|
@ -1194,7 +1193,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
tmp = RDoc::CodeObject.new
|
||||
read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
|
||||
|
||||
if comment.text.sub!(/^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
|
||||
regexp = /^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i
|
||||
if regexp =~ comment.text then
|
||||
comment.text = comment.text.sub(regexp, '')
|
||||
rw = case $1
|
||||
when 'attr_reader' then 'R'
|
||||
when 'attr_writer' then 'W'
|
||||
|
@ -1227,7 +1228,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
|
||||
skip_tkspace false
|
||||
|
||||
singleton = !!comment.text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
||||
comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3')
|
||||
singleton = !!$~
|
||||
|
||||
name = parse_meta_method_name comment, tk
|
||||
|
||||
|
@ -1290,6 +1292,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
token_listener meth do
|
||||
meth.params = ''
|
||||
|
||||
look_for_directives_in meth, comment
|
||||
comment.normalize
|
||||
comment.extract_call_seq meth
|
||||
|
||||
|
@ -1336,6 +1339,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
return unless name
|
||||
|
||||
meth = RDoc::AnyMethod.new get_tkread, name
|
||||
look_for_directives_in meth, comment
|
||||
meth.singleton = single == SINGLE ? true : singleton
|
||||
|
||||
record_location meth
|
||||
|
@ -1458,8 +1462,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
name_t2 = get_tk
|
||||
|
||||
if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then
|
||||
# NOTE: work around '[' being consumed early and not being re-tokenized
|
||||
# as a TkAREF
|
||||
# NOTE: work around '[' being consumed early
|
||||
if :on_lbracket == name_t2[:kind]
|
||||
get_tk
|
||||
name = '[]'
|
||||
|
@ -1535,7 +1538,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
when :on_comment, :on_embdoc then
|
||||
@read.pop
|
||||
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
|
||||
(!continue or (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) != 0) then
|
||||
(!continue or (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) != 0) then
|
||||
if method && method.block_params.nil? then
|
||||
unget_tk tk
|
||||
read_documentation_modifiers method, modifiers
|
||||
|
@ -1642,7 +1645,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
def parse_statements(container, single = NORMAL, current_method = nil,
|
||||
comment = new_comment(''))
|
||||
raise 'no' unless RDoc::Comment === comment
|
||||
comment.force_encoding @encoding if @encoding
|
||||
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
||||
|
||||
nest = 1
|
||||
save_visibility = container.visibility
|
||||
|
@ -1685,12 +1688,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
comment.empty?
|
||||
|
||||
comment = ''
|
||||
comment.force_encoding @encoding if @encoding
|
||||
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
||||
end
|
||||
|
||||
while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do
|
||||
comment << tk[:text]
|
||||
comment << "\n" unless "\n" == tk[:text].chars.to_a.last
|
||||
comment += tk[:text]
|
||||
comment += "\n" unless "\n" == tk[:text].chars.to_a.last
|
||||
|
||||
if tk[:text].size > 1 && "\n" == tk[:text].chars.to_a.last then
|
||||
skip_tkspace false # leading spaces
|
||||
|
@ -1740,7 +1743,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
end
|
||||
|
||||
when 'until', 'while' then
|
||||
if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0
|
||||
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
|
||||
nest += 1
|
||||
skip_optional_do_after_expression
|
||||
end
|
||||
|
@ -1756,7 +1759,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
skip_optional_do_after_expression
|
||||
|
||||
when 'case', 'do', 'if', 'unless', 'begin' then
|
||||
if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0
|
||||
if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0
|
||||
nest += 1
|
||||
end
|
||||
|
||||
|
@ -1809,7 +1812,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
|
||||
unless keep_comment then
|
||||
comment = new_comment ''
|
||||
comment.force_encoding @encoding if @encoding
|
||||
comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
|
||||
container.params = nil
|
||||
container.block_params = nil
|
||||
end
|
||||
|
@ -2053,15 +2056,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
container.record_location @top_level
|
||||
end
|
||||
|
||||
##
|
||||
# Removes private comments from +comment+
|
||||
#--
|
||||
# TODO remove
|
||||
|
||||
def remove_private_comments comment
|
||||
comment.remove_private
|
||||
end
|
||||
|
||||
##
|
||||
# Scans this Ruby file for Ruby constructs
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Collection of methods for writing parsers against RDoc::RubyLex and
|
||||
# RDoc::RubyToken
|
||||
# Collection of methods for writing parsers
|
||||
|
||||
module RDoc::Parser::RubyTools
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Parse a non-source file. We basically take the whole thing as one big
|
||||
# comment.
|
||||
|
@ -19,7 +19,7 @@ class RDoc::Parser::Simple < RDoc::Parser
|
|||
|
||||
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
|
||||
|
||||
preprocess.handle @content, @top_level
|
||||
@content = preprocess.handle @content, @top_level
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -52,7 +52,7 @@ class RDoc::Parser::Simple < RDoc::Parser
|
|||
def remove_private_comment comment
|
||||
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
|
||||
empty = ''
|
||||
empty.force_encoding comment.encoding
|
||||
empty = RDoc::Encoding.change_encoding empty, comment.encoding
|
||||
|
||||
comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty)
|
||||
comment.sub(%r%^--\n.*%m, empty)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Indicates this parser is text and doesn't contain code constructs.
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# RDoc::RD implements the RD format from the rdtool gem.
|
||||
#
|
||||
|
|
|
@ -677,54 +677,54 @@ Racc_debug_parser = false
|
|||
# reduce 0 omitted
|
||||
|
||||
def _reduce_1(val, _values, result)
|
||||
result = RDoc::Markup::Document.new(*val[0])
|
||||
result = RDoc::Markup::Document.new(*val[0])
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_2(val, _values, result)
|
||||
raise ParseError, "file empty"
|
||||
raise ParseError, "file empty"
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_3(val, _values, result)
|
||||
result = val[0].concat val[1]
|
||||
result = val[0].concat val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_4(val, _values, result)
|
||||
result = val[0]
|
||||
result = val[0]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_5(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_6(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 7 omitted
|
||||
|
||||
def _reduce_8(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_9(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_10(val, _values, result)
|
||||
result = [RDoc::Markup::BlankLine.new]
|
||||
result = [RDoc::Markup::BlankLine.new]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_11(val, _values, result)
|
||||
result = val[0].parts
|
||||
result = val[0].parts
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -732,30 +732,30 @@ def _reduce_12(val, _values, result)
|
|||
# val[0] is like [level, title]
|
||||
title = @inline_parser.parse(val[0][1])
|
||||
result = RDoc::Markup::Heading.new(val[0][0], title)
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_13(val, _values, result)
|
||||
result = RDoc::Markup::Include.new val[0], @include_path
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_14(val, _values, result)
|
||||
# val[0] is Array of String
|
||||
result = paragraph val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_15(val, _values, result)
|
||||
result << val[1].rstrip
|
||||
result << val[1].rstrip
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_16(val, _values, result)
|
||||
result = [val[0].rstrip]
|
||||
result = [val[0].rstrip]
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -766,7 +766,7 @@ def _reduce_17(val, _values, result)
|
|||
|
||||
# imform to lexer.
|
||||
@in_verbatim = false
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -777,25 +777,25 @@ def _reduce_18(val, _values, result)
|
|||
|
||||
# imform to lexer.
|
||||
@in_verbatim = false
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_19(val, _values, result)
|
||||
result << val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_20(val, _values, result)
|
||||
result.concat val[2]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_21(val, _values, result)
|
||||
result << "\n"
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -803,7 +803,7 @@ def _reduce_22(val, _values, result)
|
|||
result = val
|
||||
# inform to lexer.
|
||||
@in_verbatim = true
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -817,89 +817,89 @@ end
|
|||
|
||||
def _reduce_27(val, _values, result)
|
||||
result = val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_28(val, _values, result)
|
||||
result = val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_29(val, _values, result)
|
||||
result = val[1].push(val[2])
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_30(val, _values, result)
|
||||
result = val[0] << val[1]
|
||||
result = val[0] << val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_31(val, _values, result)
|
||||
result = [val[0]]
|
||||
result = [val[0]]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_32(val, _values, result)
|
||||
result = RDoc::Markup::List.new :BULLET, *val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_33(val, _values, result)
|
||||
result.push(val[1])
|
||||
result.push(val[1])
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_34(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_35(val, _values, result)
|
||||
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_36(val, _values, result)
|
||||
result = RDoc::Markup::List.new :NUMBER, *val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_37(val, _values, result)
|
||||
result.push(val[1])
|
||||
result.push(val[1])
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_38(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_39(val, _values, result)
|
||||
result = RDoc::Markup::ListItem.new nil, val[0], *val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_40(val, _values, result)
|
||||
result = RDoc::Markup::List.new :NOTE, *val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_41(val, _values, result)
|
||||
result.push(val[1])
|
||||
result.push(val[1])
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_42(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -907,77 +907,77 @@ def _reduce_43(val, _values, result)
|
|||
term = @inline_parser.parse val[0].strip
|
||||
|
||||
result = RDoc::Markup::ListItem.new term, *val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_44(val, _values, result)
|
||||
result = RDoc::Markup::List.new :LABEL, *val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_45(val, _values, result)
|
||||
result.push(val[1])
|
||||
result.push(val[1])
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_46(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_47(val, _values, result)
|
||||
result = RDoc::Markup::ListItem.new "<tt>#{val[0].strip}</tt>", *val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_48(val, _values, result)
|
||||
result = [val[1]].concat(val[2])
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_49(val, _values, result)
|
||||
result = [val[1]]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_50(val, _values, result)
|
||||
result = val[2]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_51(val, _values, result)
|
||||
result = []
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_52(val, _values, result)
|
||||
result.concat val[1]
|
||||
result.concat val[1]
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 53 omitted
|
||||
|
||||
def _reduce_54(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_55(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 56 omitted
|
||||
|
||||
def _reduce_57(val, _values, result)
|
||||
result = []
|
||||
result = []
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -991,58 +991,58 @@ end
|
|||
|
||||
def _reduce_62(val, _values, result)
|
||||
result = paragraph [val[0]].concat(val[1])
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_63(val, _values, result)
|
||||
result = paragraph [val[0]]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_64(val, _values, result)
|
||||
result = paragraph [val[0]].concat(val[1])
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_65(val, _values, result)
|
||||
result = paragraph [val[0]]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_66(val, _values, result)
|
||||
result = [val[0]].concat(val[1])
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_67(val, _values, result)
|
||||
result.concat val[1]
|
||||
result.concat val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_68(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_69(val, _values, result)
|
||||
result = val
|
||||
result = val
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 70 omitted
|
||||
|
||||
def _reduce_71(val, _values, result)
|
||||
result = []
|
||||
result = []
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_72(val, _values, result)
|
||||
result = []
|
||||
result = []
|
||||
result
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# Inline keeps track of markup and labels to create proper links.
|
||||
|
||||
|
@ -50,11 +50,11 @@ class RDoc::RD::Inline
|
|||
def append more
|
||||
case more
|
||||
when String then
|
||||
@reference << more
|
||||
@rdoc << more
|
||||
@reference += more
|
||||
@rdoc += more
|
||||
when RDoc::RD::Inline then
|
||||
@reference << more.reference
|
||||
@rdoc << more.rdoc
|
||||
@reference += more.reference
|
||||
@rdoc += more.rdoc
|
||||
else
|
||||
raise "unknown thingy #{more}"
|
||||
end
|
||||
|
|
|
@ -412,9 +412,9 @@ racc_action_default = [
|
|||
|
||||
racc_goto_table = [
|
||||
126, 44, 125, 52, 144, 144, 160, 93, 97, 43,
|
||||
166, 82, 144, 40, 41, 39, 138, 146, 169, 90,
|
||||
166, 82, 144, 41, 40, 39, 138, 146, 169, 90,
|
||||
36, 52, 44, 1, 52, 129, 169, 94, 59, 83,
|
||||
123, 30, 151, 92, 120, 121, 31, 32, 33, 34,
|
||||
123, 30, 151, 92, 121, 120, 31, 32, 33, 34,
|
||||
35, 170, 58, 166, 167, 147, 170, 166, 37, nil,
|
||||
150, nil, 166, 159, 4, 166, 4, nil, nil, nil,
|
||||
nil, 155, nil, 156, 160, nil, nil, 4, 4, 4,
|
||||
|
@ -430,9 +430,9 @@ racc_goto_table = [
|
|||
|
||||
racc_goto_check = [
|
||||
22, 24, 21, 34, 36, 36, 37, 18, 16, 23,
|
||||
35, 41, 36, 19, 20, 17, 25, 25, 28, 14,
|
||||
35, 41, 36, 20, 19, 17, 25, 25, 28, 14,
|
||||
13, 34, 24, 1, 34, 24, 28, 23, 38, 39,
|
||||
23, 3, 42, 17, 19, 20, 1, 1, 1, 1,
|
||||
23, 3, 42, 17, 20, 19, 1, 1, 1, 1,
|
||||
1, 33, 1, 35, 29, 32, 33, 35, 15, nil,
|
||||
41, nil, 35, 22, 4, 35, 4, nil, nil, nil,
|
||||
nil, 16, nil, 18, 37, nil, nil, 4, 4, 4,
|
||||
|
@ -448,8 +448,8 @@ racc_goto_check = [
|
|||
|
||||
racc_goto_pointer = [
|
||||
nil, 23, nil, 29, 54, 74, 109, 117, 127, nil,
|
||||
nil, 135, nil, 2, -17, 30, -30, -3, -29, -5,
|
||||
-4, -40, -42, -9, -17, -28, nil, nil, -120, -83,
|
||||
nil, 135, nil, 2, -17, 30, -30, -3, -29, -4,
|
||||
-5, -40, -42, -9, -17, -28, nil, nil, -120, -83,
|
||||
nil, nil, -7, -101, -15, -116, -40, -91, 8, 2,
|
||||
nil, -9, -29 ]
|
||||
|
||||
|
@ -732,12 +732,12 @@ Racc_debug_parser = false
|
|||
# reduce 1 omitted
|
||||
|
||||
def _reduce_2(val, _values, result)
|
||||
result.append val[1]
|
||||
result.append val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_3(val, _values, result)
|
||||
result = val[0]
|
||||
result = val[0]
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -762,28 +762,28 @@ end
|
|||
def _reduce_13(val, _values, result)
|
||||
content = val[1]
|
||||
result = inline "<em>#{content}</em>", content
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_14(val, _values, result)
|
||||
content = val[1]
|
||||
result = inline "<code>#{content}</code>", content
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_15(val, _values, result)
|
||||
content = val[1]
|
||||
result = inline "+#{content}+", content
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_16(val, _values, result)
|
||||
content = val[1]
|
||||
result = inline "<tt>#{content}</tt>", content
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -791,13 +791,13 @@ def _reduce_17(val, _values, result)
|
|||
label = val[1]
|
||||
@block_parser.add_label label.reference
|
||||
result = "<span id=\"label-#{label}\">#{label}</span>"
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_18(val, _values, result)
|
||||
result = "{#{val[1]}}[#{val[2].join}]"
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -805,13 +805,13 @@ def _reduce_19(val, _values, result)
|
|||
scheme, inline = val[1]
|
||||
|
||||
result = "{#{inline}}[#{scheme}#{inline.reference}]"
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_20(val, _values, result)
|
||||
result = [nil, inline(val[1])]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -820,25 +820,25 @@ def _reduce_21(val, _values, result)
|
|||
'rdoc-label:',
|
||||
inline("#{val[0].reference}/#{val[1].reference}")
|
||||
]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_22(val, _values, result)
|
||||
result = ['rdoc-label:', val[0].reference]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_23(val, _values, result)
|
||||
result = ['rdoc-label:', "#{val[0].reference}/"]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_24(val, _values, result)
|
||||
result = [nil, inline(val[1])]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -847,92 +847,92 @@ def _reduce_25(val, _values, result)
|
|||
'rdoc-label:',
|
||||
inline("#{val[0].reference}/#{val[1].reference}")
|
||||
]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_26(val, _values, result)
|
||||
result = ['rdoc-label:', val[0]]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_27(val, _values, result)
|
||||
ref = val[0].reference
|
||||
result = ['rdoc-label:', inline(ref, "#{ref}/")]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 28 omitted
|
||||
|
||||
def _reduce_29(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_30(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_31(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_32(val, _values, result)
|
||||
result = inline "\"#{val[1]}\""
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_33(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_34(val, _values, result)
|
||||
result = inline "\"#{val[1]}\""
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 35 omitted
|
||||
|
||||
def _reduce_36(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_37(val, _values, result)
|
||||
result = inline val[1]
|
||||
result = inline val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_38(val, _values, result)
|
||||
result = val[0].append val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_39(val, _values, result)
|
||||
result = val[0].append val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_40(val, _values, result)
|
||||
result = val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_41(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -940,25 +940,25 @@ end
|
|||
|
||||
def _reduce_43(val, _values, result)
|
||||
result = val[0].append val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_44(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_45(val, _values, result)
|
||||
result = val[0].append val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_46(val, _values, result)
|
||||
result = val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -984,24 +984,24 @@ end
|
|||
|
||||
def _reduce_57(val, _values, result)
|
||||
result = val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_58(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_59(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_60(val, _values, result)
|
||||
result << val[1]
|
||||
result << val[1]
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ end
|
|||
|
||||
def _reduce_62(val, _values, result)
|
||||
result << val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ end
|
|||
|
||||
def _reduce_64(val, _values, result)
|
||||
result << val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ end
|
|||
# reduce 77 omitted
|
||||
|
||||
def _reduce_78(val, _values, result)
|
||||
result << val[1]
|
||||
result << val[1]
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1099,13 +1099,13 @@ end
|
|||
def _reduce_101(val, _values, result)
|
||||
index = @block_parser.add_footnote val[1].rdoc
|
||||
result = "{*#{index}}[rdoc-label:foottext-#{index}:footmark-#{index}]"
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_102(val, _values, result)
|
||||
result = inline "<tt>#{val[1]}</tt>", val[1]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ end
|
|||
# reduce 108 omitted
|
||||
|
||||
def _reduce_109(val, _values, result)
|
||||
result << val[1]
|
||||
result << val[1]
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1130,24 +1130,24 @@ end
|
|||
|
||||
def _reduce_111(val, _values, result)
|
||||
result = inline val[0]
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
# reduce 112 omitted
|
||||
|
||||
def _reduce_113(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_114(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
def _reduce_115(val, _values, result)
|
||||
result = val[1]
|
||||
result = val[1]
|
||||
result
|
||||
end
|
||||
|
||||
|
@ -1192,7 +1192,7 @@ end
|
|||
# reduce 135 omitted
|
||||
|
||||
def _reduce_136(val, _values, result)
|
||||
result << val[1]
|
||||
result << val[1]
|
||||
result
|
||||
end
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'rdoc'
|
||||
|
||||
require 'find'
|
||||
|
@ -521,13 +521,18 @@ The internal error was:
|
|||
# by the RDoc options
|
||||
|
||||
def generate
|
||||
Dir.chdir @options.op_dir do
|
||||
unless @options.quiet then
|
||||
$stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
|
||||
end
|
||||
|
||||
if @options.dry_run then
|
||||
# do nothing
|
||||
@generator.generate
|
||||
update_output_dir '.', @start_time, @last_modified
|
||||
else
|
||||
Dir.chdir @options.op_dir do
|
||||
unless @options.quiet then
|
||||
$stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
|
||||
end
|
||||
|
||||
@generator.generate
|
||||
update_output_dir '.', @start_time, @last_modified
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# A file loaded by \#require
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'rdoc'
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'abbrev'
|
||||
require 'optparse'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
##
|
||||
# For RubyGems backwards compatibility
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
require 'rdoc/ri'
|
||||
|
||||
##
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
module RDoc::RI
|
||||
|
||||
Store = RDoc::Store # :nodoc:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue