Sha256: ab63aaaf8f106ca6c2968d034910f94a002283cddb1a69e3628d6f6eef62450f

Contents?: true

Size: 347 Bytes

Versions: 5

Compression:

Stored size: 347 Bytes

Contents

class UnescapingView < Garterbelt::View
  requires :format_text
  
  def content
    format_text.gsub!(/<[^>]*>/, '')
    format_text.gsub!(/\b((https?|mailto):(\/\/)?\S+)/, "<a class=\"user_generated_link\" href=\"\\1\">\\1</a>")
    format_text.gsub!("\n", "<br>\n")
    format_text.gsub!(/ {2,1000}/, '')
    
    raw_text format_text
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
garterbelt-0.1.1 spec/integration/templates/unescaping_view.rb
garterbelt-0.1.0 spec/integration/templates/unescaping_view.rb
garterbelt-0.0.9 spec/integration/templates/unescaping_view.rb
garterbelt-0.0.8 spec/integration/templates/unescaping_view.rb
garterbelt-0.0.7 spec/integration/templates/unescaping_view.rb