Method: HTML::Pipeline::SanitizationFilter#whitelist

Defined in:
lib/html/pipeline/sanitization_filter.rb

#whitelistObject

The whitelist to use when sanitizing. This can be passed in the context hash to the filter but defaults to WHITELIST constant value above.


113
114
115
116
117
118
119
120
121
# File 'lib/html/pipeline/sanitization_filter.rb', line 113

def whitelist
  whitelist = context[:whitelist] || WHITELIST
  anchor_schemes = context[:anchor_schemes]
  return whitelist unless anchor_schemes
  whitelist = whitelist.dup
  whitelist[:protocols] = (whitelist[:protocols] || {}).dup
  whitelist[:protocols]['a'] = (whitelist[:protocols]['a'] || {}).merge('href' => anchor_schemes)
  whitelist
end