Class | RI::HtmlFormatter
In: | rdoc/ri/ri_formatter.rb
Parent: | AttributeFormatter

This formatter uses HTML.

### Methods

blankline bold_print break_to_newline display_heading display_list display_verbatim_flow_item draw_line new write_attribute_text

### Constants

ATTR_MAP | = | { BOLD => "b>", ITALIC => "i>", CODE => "tt>"

### Public Class methods

new(*args)

[Source]

    # File rdoc/ri/ri_formatter.rb, line 470
        def initialize(*args)
          super
        end

### Public Instance methods

blankline()

[Source]

    # File rdoc/ri/ri_formatter.rb, line 498
        def blankline()
          puts("<p>")
        end

bold_print(txt)

[Source]

    # File rdoc/ri/ri_formatter.rb, line 494
        def bold_print(txt)
          tag("b") { txt }
        end

break_to_newline()

[Source]

    # File rdoc/ri/ri_formatter.rb, line 502
        def break_to_newline
          puts("<br>")
        end

display_heading(text, level, indent)

[Source]

    # 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

display_list(list)

[Source]

    # 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|
              %{<tr valign="top"><td>#{li.label.gsub(/ /, '&nbsp;')}</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

display_verbatim_flow_item(item, prefix=@indent)

[Source]

    # File rdoc/ri/ri_formatter.rb, line 555
        def display_verbatim_flow_item(item, prefix=@indent)
            print("<pre>")
            item.body.split(/\n/).each do |line|
              puts conv_html(line)
            end
            puts("</pre>")
        end

draw_line(label=nil)

[Source]

    # File rdoc/ri/ri_formatter.rb, line 487
        def draw_line(label=nil)
          if label != nil
            bold_print(label)
          end
          puts("<hr>")
        end

write_attribute_text(prefix, line)

[Source]

    # 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

[Validate]