Class: Html::FullSanitizer
- Defined in:
- lib/html/sanitizer/sanitizer.rb
Overview
Html::FullSanitizer
Removes all tags but strips out scripts, forms and comments.
full_sanitizer = 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
24 25 26 27 28 29 30 31 |
# File 'lib/html/sanitizer/sanitizer.rb', line 24 def sanitize(html, = {}) return unless html return html if html.empty? Loofah.fragment(html).tap do |fragment| remove_xpaths(fragment, XPATHS_TO_REMOVE) end.text end |