Sha256: 43880143bcc42f707f05126099d1cf6dfc11a4f1a6de88e30ab7bdf2dbc9cfe1
Contents?: true
Size: 863 Bytes
Versions: 6
Compression:
Stored size: 863 Bytes
Contents
class ModsDisplay::Format < ModsDisplay::Field def fields return [] if (text.nil? and @value.text.strip.empty?) return_values = @value.map{|v| v.text } return_values = [text] unless text.nil? [ModsDisplay::Values.new(:label => label || 'Format', :values => return_values)] end def text return super unless super.nil? end def to_html output = "" fields.each do |field| output << "<dt#{label_class} title='#{field.label}'>#{field.label}:</dt>" output << "<dd#{value_class}>" field.values.map do |val| output << "<span class='#{self.class.format_class(val)}'>#{val}</span>" end.join(@config.delimiter) output << "</dd>" end output end private def self.format_class(format) return format if format.nil? format.strip.downcase.gsub(/\/|\\|\s+/, "_") end end
Version data entries
6 entries across 6 versions & 1 rubygems