| Class | RI::ClassDescription |
| In: |
lib/ihelp.rb
|
| Parent: | Object |
Creates HTML element from the ClassDescription. Uses container_tag as the root node name and header_tag as the tag for the header element that contains the classes name. Uses methods_header_tag as the tag for the "Class/Instance Methods" method list headers. Uses methods_tag as the tag for the method lists.
Returns a REXML document with container_tag as the root element name.
# File lib/ihelp.rb, line 471
471: def to_html(container_tag="div", header_tag="h1",
472: methods_header_tag="h2", methods_tag="p")
473: doc = REXML::Document.new
474: root = doc.add_element(container_tag)
475: header = root.add_element(header_tag)
476: header.add_text(full_name)
477: comment.each{|c|
478: tag = c.class.to_s.split("::").last
479: tag = "PRE" if tag == "VERB"
480: xmlstr = "<#{tag}>#{c.body}</#{tag}>"
481: c_doc = REXML::Document.new(xmlstr)
482: root.add_element( c_doc.root )
483: }
484: root.add_element(methods_header_tag).add_text("Class Methods")
485: cmethods = root.add_element(methods_tag)
486: class_methods[0...-1].each{|m|
487: cmethods.add(m.to_html.root)
488: cmethods.add_text(", ")
489: }
490: cmethods.add(class_methods.last.to_html.root)
491: root.add_element(methods_header_tag).add_text("Instance Methods")
492: imethods = root.add_element(methods_tag)
493: instance_methods[0...-1].each{|m|
494: imethods.add(m.to_html.root)
495: imethods.add_text(", ")
496: }
497: imethods.add(instance_methods.last.to_html.root)
498: doc
499: end