lib/hobo_fields/text.rb in hobofields-0.7.5 vs lib/hobo_fields/text.rb in hobofields-0.8

- old
+ new

@@ -1,17 +1,17 @@ module HoboFields - + class Text < String - + HTML_ESCAPE = { '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => '&lt;' } - + COLUMN_TYPE = :text - - def to_html - gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.gsub("\n", "<br />\n") + + def to_html(xmldoctype = true) + gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.gsub("\n", "<br#{xmldoctype ? ' /' : ''}>\n") end - + HoboFields.register_type(:text, self) - + end - + end