Module: MsTools::MsSanitize::Config

Defined in:
lib/ms_tools/sanitize.rb

Constant Summary collapse

DEFAULT =
Sanitize::Config::DEFAULT.update({:remove_contents => ['script', 'embed', 'iframe']})
BASIC =
Sanitize::Config::BASIC.update({:remove_contents => ['script', 'embed', 'iframe']})
RESTRICTED =
Sanitize::Config::RESTRICTED.update({:remove_contents => ['script', 'embed', 'iframe']})
RELAXED =
Sanitize::Config::RELAXED.update({:remove_contents => ['script', 'embed', 'iframe']})
EXTENDED =
{
  :elements => [
    'a', 'b', 'blockquote', 'br', 'caption', 'cite', 'code', 'col',
    'colgroup', 'dd', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
    'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'small', 'strike',
    'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead',
    'tr', 'u', 'ul'],

  :attributes => {
    'a'          => ['class', 'href', 'title'],
    'blockquote' => ['class', 'cite'],
    'br'         => ['class'],
    'code'       => ['class'],
    'col'        => ['class', 'span', 'width'],
    'colgroup'   => ['class', 'span', 'width'],
    'hr'         => ['class'],
    'img'        => ['class', 'align', 'alt', 'height', 'src', 'title', 'width', 'title'],
    'li'         => ['class', 'title'],
    'ol'         => ['class', 'start', 'type'],
    'p'          => ['class', 'title'],
    'q'          => ['class', 'cite'],
    'table'      => ['border', 'class', 'cellspacing', 'cellpadding', 'summary', 'width'],
    'td'         => ['abbr', 'axis', 'class', 'colspan', 'rowspan', 'width', 'title'],
    'th'         => ['abbr', 'axis', 'class', 'colspan', 'rowspan', 'scope', 'width', 'title'],
    'ul'         => ['class', 'type']
  },

  :protocols => {
    'a'          => {'href' => ['ftp', 'http', 'https', 'mailto', :relative]},
    'blockquote' => {'cite' => ['http', 'https', :relative]},
    'img'        => {'src'  => ['http', 'https', :relative]},
    'q'          => {'cite' => ['http', 'https', :relative]}
  },

  :remove_contents => ['script', 'embed', 'iframe']
}