diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-26 16:14:19 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-04-26 16:14:19 +0000 |
commit | c42a631063e79fab2369c1983a6f2a075b584f62 (patch) | |
tree | 2ea8c0381d5d491a5f46e210239e1494df57d240 /lib/rdoc/ri/formatter.rb | |
parent | 2142a5af51ce882641a060e69bc58c7322ff5188 (diff) |
Import RDoc 2.0.0 r56.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/ri/formatter.rb')
-rw-r--r-- | lib/rdoc/ri/formatter.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/rdoc/ri/formatter.rb b/lib/rdoc/ri/formatter.rb index df73bf5eb3..0a0c3f7380 100644 --- a/lib/rdoc/ri/formatter.rb +++ b/lib/rdoc/ri/formatter.rb @@ -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(/ /, ' ')}</td><td>} + %{<tr valign="top"><td>#{li.label.gsub(/ /, ' ')}</td><td>} end else fail "unknown list type" |