This formatter uses HTML.
# File rdoc/ri/ri_formatter.rb, line 498
def blankline()
puts("<p>")
end
# File rdoc/ri/ri_formatter.rb, line 494
def bold_print(txt)
tag("b") { txt }
end
# File rdoc/ri/ri_formatter.rb, line 502
def break_to_newline
puts("<br>")
end
# File rdoc/ri/ri_formatter.rb, line 506
def display_heading(text, level, indent)
level = 4 if level > 4
tag("h#{level}") { text }
puts
end
# File rdoc/ri/ri_formatter.rb, line 514
def display_list(list)
case list.type
when SM::ListBase::BULLET
list_type = "ul"
prefixer = proc { |ignored| "<li>" }
when SM::ListBase::NUMBER,
SM::ListBase::UPPERALPHA,
SM::ListBase::LOWERALPHA
list_type = "ol"
prefixer = proc { |ignored| "<li>" }
when SM::ListBase::LABELED
list_type = "dl"
prefixer = proc do |li|
"<dt><b>" + escape(li.label) + "</b><dd>"
end
when SM::ListBase::NOTE
list_type = "table"
prefixer = proc do |li|
%Q{<tr valign="top"><td>#{li.label.gsub(/ /, ' ')}</td><td>}
end
else
fail "unknown list type"
end
print "<#{list_type}>"
list.contents.each do |item|
if item.kind_of? SM::Flow::LI
prefix = prefixer.call(item)
print prefix
display_flow_item(item, prefix)
else
display_flow_item(item)
end
end
print "</#{list_type}>"
end
# File rdoc/ri/ri_formatter.rb, line 555
def display_verbatim_flow_item(item, prefix=@indent)
print("<pre>")
puts item.body
puts("</pre>")
end
# File rdoc/ri/ri_formatter.rb, line 487
def draw_line(label=nil)
if label != nil
bold_print(label)
end
puts("<hr>")
end
# File rdoc/ri/ri_formatter.rb, line 474
def write_attribute_text(prefix, line)
curr_attr = 0
line.each do |achar|
attr = achar.attr
if achar.attr != curr_attr
update_attributes(curr_attr, achar.attr)
curr_attr = achar.attr
end
print(escape(achar.char))
end
update_attributes(curr_attr, 0) unless curr_attr.zero?
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.