Module: Mumukit::ContentType::Sanitizer
- Defined in:
- lib/mumukit/content_type/sanitizer.rb
Class Method Summary collapse
Class Method Details
.custom_sanitization_settings ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/mumukit/content_type/sanitizer.rb', line 26 def custom_sanitization_settings { elements: Sanitize::Config::RELAXED[:elements] + allowed_elements, attributes: allowed_attributes, transformers: transformers, allow_comments: true } end |
.sanitization_settings ⇒ Object
21 22 23 |
# File 'lib/mumukit/content_type/sanitizer.rb', line 21 def sanitization_settings Sanitize::Config.merge(Sanitize::Config::RELAXED, custom_sanitization_settings) end |
.sanitize(html) ⇒ Object
15 16 17 18 19 |
# File 'lib/mumukit/content_type/sanitizer.rb', line 15 def sanitize(html) return html unless should_sanitize? Sanitize.fragment(html, sanitization_settings) end |