Method: XHTML#ul

Defined in:
lib/xhtml.rb

#ul(content, options = {}) ⇒ Object



1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
# File 'lib/xhtml.rb', line 1125

def ul(content, options = {})
    out = ''
    opts = ['class', 'id', 'title', 'onclick', 'ondblclick', 'style',
            'onkeyup', 'onkeydown', 'onkeypress', 'onmousedown',
            'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout']
    if options.nil?
        out << "<ul>#{content}</ul>\n"
    else
        out << "<ul"
        options.each do |x,y|
            x = x.to_s
            if opts.include?("#{x}")
                if ( "#{x}" == 'class' or "#{x}" == 'id' and y.kind_of?(Array))
                    z = y.join(' ')
                    out << " #{x}='#{z}'"
                else
                    out << " #{x}='#{y}'"
                end
            end
        end
        out << ">#{content}</ul>\n"
    end
    return out
end