File: basic.rb

package info (click to toggle)
ruby-sanitize 7.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: ruby: 3,153; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

class Sanitize
  module Config
    BASIC = freeze_config(
      elements: RESTRICTED[:elements] + %w[
        a abbr blockquote br cite code dd dfn dl dt kbd li mark ol p pre q s
        samp small strike sub sup time ul var
      ],

      attributes: {
        "a" => %w[href],
        "abbr" => %w[title],
        "blockquote" => %w[cite],
        "dfn" => %w[title],
        "q" => %w[cite],
        "time" => %w[datetime pubdate]
      },

      add_attributes: {
        "a" => {"rel" => "nofollow"}
      },

      protocols: {
        "a" => {"href" => ["ftp", "http", "https", "mailto", :relative]},
        "blockquote" => {"cite" => ["http", "https", :relative]},
        "q" => {"cite" => ["http", "https", :relative]}
      }
    )
  end
end