Class: Jets::Html::FullSanitizer
- Defined in:
- lib/jets/html/sanitizer.rb
Overview
Jets::Html::FullSanitizer
Removes all tags but strips out scripts, forms and comments.
full_sanitizer = Jets::Html::FullSanitizer.new full_sanitizer.sanitize(“Bold no more! <a href=‘more.html’>See more here</a>…”) # => Bold no more! See more here…
Constant Summary
Constants inherited from Sanitizer
Instance Method Summary collapse
Methods inherited from Sanitizer
full_sanitizer, link_sanitizer, white_list_sanitizer
Instance Method Details
#sanitize(html, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jets/html/sanitizer.rb', line 29 def sanitize(html, = {}) return unless html return html if html.empty? loofah_fragment = Loofah.fragment(html) remove_xpaths(loofah_fragment, XPATHS_TO_REMOVE) loofah_fragment.scrub!(TextOnlyScrubber.new) properly_encode(loofah_fragment, encoding: 'UTF-8') end |