mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc*: Updated to RDoc 4.0 (pre-release)
* bin/rdoc: ditto * test/rdoc: ditto * NEWS: Updated with RDoc 4.0 information git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c72f0daa87
commit
1c279a7d27
233 changed files with 45019 additions and 5100 deletions
|
@ -1,6 +1,3 @@
|
|||
require 'rdoc'
|
||||
require 'rdoc/text'
|
||||
|
||||
##
|
||||
# Base class for the RDoc code tree.
|
||||
#
|
||||
|
@ -78,9 +75,9 @@ class RDoc::CodeObject
|
|||
attr_accessor :offset
|
||||
|
||||
##
|
||||
# Our parent CodeObject
|
||||
# Sets the parent CodeObject
|
||||
|
||||
attr_accessor :parent
|
||||
attr_writer :parent
|
||||
|
||||
##
|
||||
# Did we ever receive a +:nodoc:+ directive?
|
||||
|
@ -88,9 +85,14 @@ class RDoc::CodeObject
|
|||
attr_reader :received_nodoc
|
||||
|
||||
##
|
||||
# Which section are we in
|
||||
# Set the section this CodeObject is in
|
||||
|
||||
attr_accessor :section
|
||||
attr_writer :section
|
||||
|
||||
##
|
||||
# The RDoc::Store for this object.
|
||||
|
||||
attr_accessor :store
|
||||
|
||||
##
|
||||
# We are the model of the code, but we know that at some point we will be
|
||||
|
@ -103,11 +105,16 @@ class RDoc::CodeObject
|
|||
# Creates a new CodeObject that will document itself and its children
|
||||
|
||||
def initialize
|
||||
@metadata = {}
|
||||
@comment = ''
|
||||
@parent = nil
|
||||
@file = nil
|
||||
@full_name = nil
|
||||
@metadata = {}
|
||||
@comment = ''
|
||||
@parent = nil
|
||||
@parent_name = nil # for loading
|
||||
@parent_class = nil # for loading
|
||||
@section = nil
|
||||
@section_title = nil # for loading
|
||||
@file = nil
|
||||
@full_name = nil
|
||||
@store = nil
|
||||
|
||||
@document_children = true
|
||||
@document_self = true
|
||||
|
@ -124,11 +131,11 @@ class RDoc::CodeObject
|
|||
@comment = case comment
|
||||
when NilClass then ''
|
||||
when RDoc::Markup::Document then comment
|
||||
when RDoc::Comment then comment.normalize
|
||||
else
|
||||
if comment and not comment.empty? then
|
||||
normalize_comment comment
|
||||
else
|
||||
# TODO is this sufficient?
|
||||
# HACK correct fix is to have #initialize create @comment
|
||||
# with the correct encoding
|
||||
if String === @comment and
|
||||
|
@ -216,7 +223,7 @@ class RDoc::CodeObject
|
|||
|
||||
##
|
||||
# Force the documentation of this object unless documentation
|
||||
# has been turned off by :endoc:
|
||||
# has been turned off by :enddoc:
|
||||
#--
|
||||
# HACK untested, was assigning to an ivar
|
||||
|
||||
|
@ -261,6 +268,29 @@ class RDoc::CodeObject
|
|||
@ignored
|
||||
end
|
||||
|
||||
##
|
||||
# Our parent CodeObject. The parent may be missing for classes loaded from
|
||||
# legacy RI data stores.
|
||||
|
||||
def parent
|
||||
return @parent if @parent
|
||||
return nil unless @parent_name
|
||||
|
||||
if @parent_class == RDoc::TopLevel then
|
||||
@parent = @store.add_file @parent_name
|
||||
else
|
||||
@parent = @store.find_class_or_module @parent_name
|
||||
|
||||
return @parent if @parent
|
||||
|
||||
begin
|
||||
@parent = @store.load_class @parent_name
|
||||
rescue RDoc::Store::MissingFileError
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# File name of our parent
|
||||
|
||||
|
@ -283,9 +313,19 @@ class RDoc::CodeObject
|
|||
@file = top_level
|
||||
end
|
||||
|
||||
##
|
||||
# The section this CodeObject is in. Sections allow grouping of constants,
|
||||
# attributes and methods inside a class or module.
|
||||
|
||||
def section
|
||||
return @section if @section
|
||||
|
||||
@section = parent.add_section @section_title if parent
|
||||
end
|
||||
|
||||
##
|
||||
# Enable capture of documentation unless documentation has been
|
||||
# turned off by :endoc:
|
||||
# turned off by :enddoc:
|
||||
|
||||
def start_doc
|
||||
return if @done_documenting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue