[ruby/rdoc] [DOC] Add missing documents
https://github.com/ruby/rdoc/commit/e4c90340d0
This commit is contained in:
parent
578eb02b16
commit
e15d690db1
11
lib/rdoc.rb
11
lib/rdoc.rb
@ -120,6 +120,17 @@ module RDoc
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Seaches and returns the directory for settings.
|
||||||
|
#
|
||||||
|
# 1. <tt>$HOME/.rdoc</tt> directory, if it exists.
|
||||||
|
# 2. The +rdoc+ directory under the path specified by the
|
||||||
|
# +XDG_DATA_HOME+ environment variable, if it is set.
|
||||||
|
# 3. <tt>$HOME/.local/share/rdoc</tt> directory.
|
||||||
|
#
|
||||||
|
# Other than the home directory, the containing directory will be
|
||||||
|
# created automatically.
|
||||||
|
|
||||||
def self.home
|
def self.home
|
||||||
rdoc_dir = begin
|
rdoc_dir = begin
|
||||||
File.expand_path('~/.rdoc')
|
File.expand_path('~/.rdoc')
|
||||||
|
@ -131,6 +131,9 @@ class RDoc::CrossReference
|
|||||||
@seen = {}
|
@seen = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns a method reference to +name+.
|
||||||
|
|
||||||
def resolve_method name
|
def resolve_method name
|
||||||
ref = nil
|
ref = nil
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# :markup: markdown
|
# :markup: markdown
|
||||||
|
|
||||||
##
|
##
|
||||||
#--
|
|
||||||
# This set of literals is for Ruby 1.9 regular expressions and gives full
|
# This set of literals is for Ruby 1.9 regular expressions and gives full
|
||||||
# unicode support.
|
# unicode support.
|
||||||
#
|
#
|
||||||
|
@ -3,8 +3,16 @@
|
|||||||
# A section of table
|
# A section of table
|
||||||
|
|
||||||
class RDoc::Markup::Table
|
class RDoc::Markup::Table
|
||||||
attr_accessor :header, :align, :body
|
# headers of each column
|
||||||
|
attr_accessor :header
|
||||||
|
|
||||||
|
# alignments of each column
|
||||||
|
attr_accessor :align
|
||||||
|
|
||||||
|
# body texts of each column
|
||||||
|
attr_accessor :body
|
||||||
|
|
||||||
|
# Creates new instance
|
||||||
def initialize header, align, body
|
def initialize header, align, body
|
||||||
@header, @align, @body = header, align, body
|
@header, @align, @body = header, align, body
|
||||||
end
|
end
|
||||||
|
@ -66,6 +66,9 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
|
|||||||
|
|
||||||
alias accept_rule ignore
|
alias accept_rule ignore
|
||||||
|
|
||||||
|
##
|
||||||
|
# Adds +paragraph+ to the output
|
||||||
|
|
||||||
def accept_paragraph paragraph
|
def accept_paragraph paragraph
|
||||||
para = @in_list_entry.last || "<p>"
|
para = @in_list_entry.last || "<p>"
|
||||||
|
|
||||||
|
@ -1215,6 +1215,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|||||||
@top_level
|
@top_level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Creates a RDoc::Comment instance.
|
||||||
|
|
||||||
def new_comment text = nil, location = nil, language = nil
|
def new_comment text = nil, location = nil, language = nil
|
||||||
RDoc::Comment.new(text, location, language).tap do |comment|
|
RDoc::Comment.new(text, location, language).tap do |comment|
|
||||||
comment.format = @markup
|
comment.format = @markup
|
||||||
|
@ -216,12 +216,22 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|||||||
@top_level
|
@top_level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# The extension for Git commit log
|
||||||
|
|
||||||
module Git
|
module Git
|
||||||
|
##
|
||||||
|
# Parses auxiliary info. Currentry `base-url` to expand
|
||||||
|
# references is effective.
|
||||||
|
|
||||||
def parse_info(info)
|
def parse_info(info)
|
||||||
/^\s*base-url\s*=\s*(.*\S)/ =~ info
|
/^\s*base-url\s*=\s*(.*\S)/ =~ info
|
||||||
@base_url = $1
|
@base_url = $1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Parses the entries in the Git commit logs
|
||||||
|
|
||||||
def parse_entries
|
def parse_entries
|
||||||
entries = []
|
entries = []
|
||||||
|
|
||||||
@ -244,6 +254,11 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|||||||
entries
|
entries
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns a list of ChangeLog entries as
|
||||||
|
# RDoc::Parser::ChangeLog::Git::LogEntry list for the given
|
||||||
|
# +entries+.
|
||||||
|
|
||||||
def create_entries entries
|
def create_entries entries
|
||||||
# git log entries have no strictly itemized style like the old
|
# git log entries have no strictly itemized style like the old
|
||||||
# style, just assume Markdown.
|
# style, just assume Markdown.
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'ripper'
|
require 'ripper'
|
||||||
|
|
||||||
|
##
|
||||||
|
# Wrapper for Ripper lex states
|
||||||
|
|
||||||
class RDoc::Parser::RipperStateLex
|
class RDoc::Parser::RipperStateLex
|
||||||
# TODO: Remove this constants after Ruby 2.4 EOL
|
# TODO: Remove this constants after Ruby 2.4 EOL
|
||||||
RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
|
RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
|
||||||
@ -565,6 +568,7 @@ class RDoc::Parser::RipperStateLex
|
|||||||
tk
|
tk
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# New lexer for +code+.
|
||||||
def initialize(code)
|
def initialize(code)
|
||||||
@buf = []
|
@buf = []
|
||||||
@heredoc_queue = []
|
@heredoc_queue = []
|
||||||
@ -572,6 +576,7 @@ class RDoc::Parser::RipperStateLex
|
|||||||
@tokens = @inner_lex.parse([])
|
@tokens = @inner_lex.parse([])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns tokens parsed from +code+.
|
||||||
def self.parse(code)
|
def self.parse(code)
|
||||||
lex = self.new(code)
|
lex = self.new(code)
|
||||||
tokens = []
|
tokens = []
|
||||||
@ -584,6 +589,7 @@ class RDoc::Parser::RipperStateLex
|
|||||||
tokens
|
tokens
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns +true+ if lex state will be +END+ after +token+.
|
||||||
def self.end?(token)
|
def self.end?(token)
|
||||||
(token[:state] & EXPR_END)
|
(token[:state] & EXPR_END)
|
||||||
end
|
end
|
||||||
|
@ -180,6 +180,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||||||
reset
|
reset
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Return +true+ if +tk+ is a newline.
|
||||||
|
|
||||||
def tk_nl?(tk)
|
def tk_nl?(tk)
|
||||||
:on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]
|
:on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]
|
||||||
end
|
end
|
||||||
|
@ -197,6 +197,9 @@ class RDoc::Store
|
|||||||
top_level
|
top_level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Sets the parser of +absolute_name+, unless it from a source code file.
|
||||||
|
|
||||||
def update_parser_of_file(absolute_name, parser)
|
def update_parser_of_file(absolute_name, parser)
|
||||||
if top_level = @files_hash[absolute_name] then
|
if top_level = @files_hash[absolute_name] then
|
||||||
@text_files_hash[absolute_name] = top_level if top_level.text?
|
@text_files_hash[absolute_name] = top_level if top_level.text?
|
||||||
|
@ -10,6 +10,10 @@ require 'strscan'
|
|||||||
|
|
||||||
module RDoc::Text
|
module RDoc::Text
|
||||||
|
|
||||||
|
##
|
||||||
|
# The language for this text. This affects stripping comments
|
||||||
|
# markers.
|
||||||
|
|
||||||
attr_accessor :language
|
attr_accessor :language
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -52,6 +52,9 @@ class RDoc::TopLevel < RDoc::Context
|
|||||||
@classes_or_modules = []
|
@classes_or_modules = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Sets the parser for this toplevel context, also the store.
|
||||||
|
|
||||||
def parser=(val)
|
def parser=(val)
|
||||||
@parser = val
|
@parser = val
|
||||||
@store.update_parser_of_file(absolute_name, val) if @store
|
@store.update_parser_of_file(absolute_name, val) if @store
|
||||||
|
Loading…
x
Reference in New Issue
Block a user