Class: MixiStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/misc/mixistyle.rb

Class Method Summary collapse

Class Method Details

.to_html(text) ⇒ Object



3
4
5
6
7
# File 'lib/misc/mixistyle.rb', line 3

def self.to_html(text)
  html = text.sub(/\A(.+)\n+/) { "<h2>#{$1}</h2>" }.
         gsub(URI.regexp(%w(http https ftp mailto))) {|m| %[<a href="#{m}">#{m}</a>] }.
         gsub("\n", "<br />\n")
end