In: |
lib/Borges/HTML/HtmlBuilder.rb
|
Parent: | Object |
Borges::HTMLBuilder is a generic class for outputting HTML.
SIMPLE_ELEMENTS | = | { :bold => :b, :code => :code, :div => :div, :emphasis => :em, :italic => :i, :paragraph => :p, :preformatted => :pre, :strong => :strong, :small => :small, :span => :span, :sub => :sub, :sup => :sup, :table_data => :td, :table_heading => :th, :underline => :u, } |
HTML_CHARACTERS | = | {} |
attributes | [R] | |
document | [RW] |
Creates a new HtmlBuilder.
document must have the following interface:
#head #add_element #pop_element #push_element
Creates a tag that goes in the <head> of the document with name, that contains child in its contents.
Adds an <img> with src as its src attribute. If alt is specified, it is used as the image’s alternate text, otherwise the alt attribute is left empty.
Add an anchor on an <img> with src as its src attribute. If alt is specified, it is used as the image’s alternate text, otherwise the alt attribute is left empty.
Builds an unordered list of items from an Enumerable. text will be called on each item.
list ["x", 5, { :x => :y }]
<ul><li>x</li><li>5</li><li>xy</li></ul>
Builds an unordered list of items from an Enumerable. The given block will be called on each item.
See also list