mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add file.c comments (and necessary support in parse_c.rb)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6228cbe5ef
commit
da99e407fb
9 changed files with 1564 additions and 67 deletions
|
@ -76,13 +76,12 @@ module RI
|
|||
end
|
||||
end
|
||||
|
||||
class ClassDescription < Description
|
||||
class ModuleDescription < Description
|
||||
|
||||
attr_accessor :class_methods
|
||||
attr_accessor :instance_methods
|
||||
attr_accessor :attributes
|
||||
attr_accessor :constants
|
||||
attr_accessor :superclass
|
||||
attr_accessor :includes
|
||||
|
||||
# merge in another class desscription into this one
|
||||
|
@ -92,6 +91,13 @@ module RI
|
|||
merge(@attributes, old.attributes)
|
||||
merge(@constants, old.constants)
|
||||
merge(@includes, old.includes)
|
||||
if @comment.nil? || @comment.empty?
|
||||
@comment = old.comment
|
||||
end
|
||||
end
|
||||
|
||||
def display_name
|
||||
"Module"
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -104,6 +110,15 @@ module RI
|
|||
end
|
||||
end
|
||||
|
||||
class ClassDescription < ModuleDescription
|
||||
attr_accessor :superclass
|
||||
|
||||
def display_name
|
||||
"Class"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class MethodDescription < Description
|
||||
|
||||
attr_accessor :is_class_method
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
module RI
|
||||
class RiFormatter
|
||||
class TextFormatter
|
||||
|
||||
def TextFormatter.create(options, indent)
|
||||
new(options, indent)
|
||||
end
|
||||
|
||||
attr_reader :indent
|
||||
|
||||
def initialize(width, indent)
|
||||
@width = width
|
||||
@indent = indent
|
||||
def initialize(options, indent)
|
||||
@options = options
|
||||
@width = options.width
|
||||
@indent = indent
|
||||
end
|
||||
|
||||
|
||||
|
@ -23,7 +28,7 @@ module RI
|
|||
|
||||
def wrap(txt, prefix=@indent, linelen=@width)
|
||||
return unless txt && !txt.empty?
|
||||
work = txt.dup
|
||||
work = conv_markup(txt)
|
||||
textLen = linelen - prefix.length
|
||||
patt = Regexp.new("^(.{0,#{textLen}})[ \n]")
|
||||
next_prefix = prefix.tr("^ ", " ")
|
||||
|
@ -53,9 +58,6 @@ module RI
|
|||
# convert HTML entities back to ASCII
|
||||
def conv_html(txt)
|
||||
txt.
|
||||
gsub(%r{<tt>(.*?)</tt>}) { "+#$1+" } .
|
||||
gsub(%r{<b>(.*?)</b>}) { "*#$1*" } .
|
||||
gsub(%r{<em>(.*?)</em>}) { "_#$1_" } .
|
||||
gsub(/>/, '>').
|
||||
gsub(/</, '<').
|
||||
gsub(/"/, '"').
|
||||
|
@ -63,6 +65,15 @@ module RI
|
|||
|
||||
end
|
||||
|
||||
# convert markup into display form
|
||||
def conv_markup(txt)
|
||||
txt.
|
||||
gsub(%r{<tt>(.*?)</tt>}) { "+#$1+" } .
|
||||
gsub(%r{<code>(.*?)</code>}) { "+#$1+" } .
|
||||
gsub(%r{<b>(.*?)</b>}) { "*#$1*" } .
|
||||
gsub(%r{<em>(.*?)</em>}) { "_#$1_" }
|
||||
end
|
||||
|
||||
######################################################################
|
||||
|
||||
def display_list(list)
|
||||
|
@ -167,4 +178,7 @@ module RI
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue