1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Import RDoc 2.0.0 r56.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-04-26 16:14:19 +00:00
parent 2142a5af51
commit c42a631063
17 changed files with 1065 additions and 450 deletions

View file

@ -3,7 +3,7 @@ require 'rdoc/markup'
class RDoc::RI::Formatter
attr_reader :indent
attr_writer :indent
attr_accessor :output
FORMATTERS = { }
@ -20,6 +20,7 @@ class RDoc::RI::Formatter
@output = output
@width = width
@indent = indent
@original_indent = indent.dup
end
def draw_line(label=nil)
@ -42,6 +43,18 @@ class RDoc::RI::Formatter
end
end
def indent
return @indent unless block_given?
begin
indent = @indent.dup
@indent += @original_indent
yield
ensure
@indent = indent
end
end
def wrap(txt, prefix=@indent, linelen=@width)
return unless txt && !txt.empty?
@ -481,13 +494,13 @@ class RDoc::RI::HtmlFormatter < RDoc::RI::AttributeFormatter
when :LABELED then
list_type = "dl"
prefixer = proc do |li|
"<dt><b>" + escape(li.label) + "</b><dd>"
"<dt><b>" + escape(li.label) + "</b><dd>"
end
when :NOTE then
list_type = "table"
prefixer = proc do |li|
%{<tr valign="top"><td>#{li.label.gsub(/ /, '&nbsp;')}</td><td>}
%{<tr valign="top"><td>#{li.label.gsub(/ /, '&nbsp;')}</td><td>}
end
else
fail "unknown list type"