Sha256: d126b18e54fd30c6d77df5c2d8b457a2225e9232f7f70c40d3191ec15437327e
Contents?: true
Size: 594 Bytes
Versions: 1
Compression:
Stored size: 594 Bytes
Contents
class Main module HtmlHelpers # Helper: html (Helpers) # Sanitizes HTML with Markdown and Textile support. # def html(string) require 'nokogiri' doc = Nokogiri.HTML(string) # Convert textile/markdown %w(textile markdown).each do |type| doc.css("[format='#{type}'], #{type}").each do |el| el.after(Tilt.new(type) { el.inner_html }.render) el.remove end end # Stupidity doc.css('p:empty').each { |el| el.remove } doc.at_css('body').inner_html.strip end end helpers HtmlHelpers end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aura-0.0.1.pre10 | app/helpers/html_helpers.rb |