selma 0.0.6-x64-mingw-ucrt → 0.0.7-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 456a70af97feb0b2a00656f38c463c98f3e550c1020d161b78f7618291a88cfa
4
- data.tar.gz: 32835b2120c564bfaeed9b349a6c69d1eb2416a8c548ea02d50ebe8cb1c5ce37
3
+ metadata.gz: e69d8417619f7c212feaa88af6906d1451a50cc4f9d336ea0c8066104bbbcbfa
4
+ data.tar.gz: ace3b66c142d0dbad7695cdce7a06824139b54d2adb8b5f4cc0e59ed9d1e2643
5
5
  SHA512:
6
- metadata.gz: 5644a88a2831b4675e726d6a7e2c4d48268e60fb739cbe0b4122bae0177afcd8daebfb8972d56e7a56b1caf7a48f06b607506a2c1a68db9113d94c375e9f821b
7
- data.tar.gz: 11521784302759d8855f61ad56d0fa0ea891b93cac156013334692bea09369c700d8273ef4b38055626bfc3c94727969f766fa96a47c87de34aa8be5a67b7698
6
+ metadata.gz: c7251bee8af0be1fc33330751e11b2d233a83a19cc6f5892d36e45c8b14774f05a705e774e4e6a97865654f7e500df2d141ff6872d142efa29b6df7a977c404a
7
+ data.tar.gz: 0ea30de64d3d805a1603a999d4a5efad5559424d54b8db0c99c2f1be8f83f92ccf50eecddf74b267c2ea5a3ae452b1b615a1dc67f39ea16d9e63b4d135c468b7
data/README.md CHANGED
@@ -37,7 +37,9 @@ sanitizer_config = {
37
37
  }
38
38
  sanitizer = Selma::Sanitizer.new(sanitizer_config)
39
39
  rewriter = Selma::Rewriter.new(sanitizer: sanitizer, handlers: [MatchElementRewrite.new, MatchTextRewrite.new])
40
- rewriter(html)
40
+ # removes any element that is not ["b", "em", "i", "strong", "u"];
41
+ # then calls `MatchElementRewrite` and `MatchTextRewrite` on matching HTML elements
42
+ rewriter.rewrite(html)
41
43
  ```
42
44
 
43
45
  Here's a look at each individual part.
data/ext/selma/extconf.rb CHANGED
@@ -3,4 +3,4 @@ require "rb_sys/mkmf"
3
3
 
4
4
  require_relative "_util"
5
5
 
6
- create_rust_makefile("selma")
6
+ create_rust_makefile("selma/selma")
Binary file
Binary file
@@ -4,8 +4,39 @@ module Selma
4
4
  class Sanitizer
5
5
  module Config
6
6
  BASIC = freeze_config(
7
- elements: ["a", "abbr", "blockquote", "b", "br", "cite", "code", "dd", "dfn", "dl", "dt", "em", "i", "kbd",
8
- "li", "mark", "ol", "p", "pre", "q", "s", "samp", "small", "strike", "strong", "sub", "sup", "time", "u", "ul", "var",],
7
+ elements: [
8
+ "a",
9
+ "abbr",
10
+ "blockquote",
11
+ "b",
12
+ "br",
13
+ "cite",
14
+ "code",
15
+ "dd",
16
+ "dfn",
17
+ "dl",
18
+ "dt",
19
+ "em",
20
+ "i",
21
+ "kbd",
22
+ "li",
23
+ "mark",
24
+ "ol",
25
+ "p",
26
+ "pre",
27
+ "q",
28
+ "s",
29
+ "samp",
30
+ "small",
31
+ "strike",
32
+ "strong",
33
+ "sub",
34
+ "sup",
35
+ "time",
36
+ "u",
37
+ "ul",
38
+ "var",
39
+ ],
9
40
 
10
41
  attributes: {
11
42
  "a" => ["href"],
@@ -33,13 +33,49 @@ module Selma
33
33
 
34
34
  # An Array of element names whose contents will be removed. The contents
35
35
  # of all other filtered elements will be left behind.
36
- remove_contents: ["iframe", "math", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg",
37
- "xmp",],
36
+ remove_contents: [
37
+ "iframe",
38
+ "math",
39
+ "noembed",
40
+ "noframes",
41
+ "noscript",
42
+ "plaintext",
43
+ "script",
44
+ "style",
45
+ "svg",
46
+ "xmp",
47
+ ],
38
48
 
39
49
  # Elements which, when removed, should have their contents surrounded by
40
50
  # whitespace.
41
- whitespace_elements: ["address", "article", "aside", "blockquote", "br", "dd", "div", "dl", "dt", "footer",
42
- "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "li", "nav", "ol", "p", "pre", "section", "ul",],
51
+ whitespace_elements: [
52
+ "address",
53
+ "article",
54
+ "aside",
55
+ "blockquote",
56
+ "br",
57
+ "dd",
58
+ "div",
59
+ "dl",
60
+ "dt",
61
+ "footer",
62
+ "h1",
63
+ "h2",
64
+ "h3",
65
+ "h4",
66
+ "h5",
67
+ "h6",
68
+ "header",
69
+ "hgroup",
70
+ "hr",
71
+ "li",
72
+ "nav",
73
+ "ol",
74
+ "p",
75
+ "pre",
76
+ "section",
77
+ "ul",
78
+ ],
43
79
  )
44
80
  end
45
81
  end
@@ -4,12 +4,60 @@ module Selma
4
4
  class Sanitizer
5
5
  module Config
6
6
  RELAXED = freeze_config(
7
- elements: BASIC[:elements] + ["address", "article", "aside", "bdi", "bdo", "body", "caption", "col",
8
- "colgroup", "data", "del", "div", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "img", "ins", "main", "nav", "rp", "rt", "ruby", "section", "span", "style", "summary", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "wbr",],
7
+ elements: BASIC[:elements] + [
8
+ "address",
9
+ "article",
10
+ "aside",
11
+ "bdi",
12
+ "bdo",
13
+ "body",
14
+ "caption",
15
+ "col",
16
+ "colgroup",
17
+ "data",
18
+ "del",
19
+ "div",
20
+ "figcaption",
21
+ "figure",
22
+ "footer",
23
+ "h1",
24
+ "h2",
25
+ "h3",
26
+ "h4",
27
+ "h5",
28
+ "h6",
29
+ "head",
30
+ "header",
31
+ "hgroup",
32
+ "hr",
33
+ "html",
34
+ "img",
35
+ "ins",
36
+ "main",
37
+ "nav",
38
+ "rp",
39
+ "rt",
40
+ "ruby",
41
+ "section",
42
+ "span",
43
+ "style",
44
+ "summary",
45
+ "sup",
46
+ "table",
47
+ "tbody",
48
+ "td",
49
+ "tfoot",
50
+ "th",
51
+ "thead",
52
+ "title",
53
+ "tr",
54
+ "wbr",
55
+ ],
9
56
 
10
57
  allow_doctype: true,
11
58
 
12
- attributes: merge(BASIC[:attributes],
59
+ attributes: merge(
60
+ BASIC[:attributes],
13
61
  :all => ["class", "dir", "hidden", "id", "lang", "style", "tabindex", "title", "translate"],
14
62
  "a" => ["href", "hreflang", "name", "rel"],
15
63
  "col" => ["span", "width"],
@@ -21,16 +69,29 @@ module Selma
21
69
  "li" => ["value"],
22
70
  "ol" => ["reversed", "start", "type"],
23
71
  "style" => ["media", "scoped", "type"],
24
- "table" => ["align", "bgcolor", "border", "cellpadding", "cellspacing", "frame", "rules", "sortable",
25
- "summary", "width",],
72
+ "table" => [
73
+ "align",
74
+ "bgcolor",
75
+ "border",
76
+ "cellpadding",
77
+ "cellspacing",
78
+ "frame",
79
+ "rules",
80
+ "sortable",
81
+ "summary",
82
+ "width",
83
+ ],
26
84
  "td" => ["abbr", "align", "axis", "colspan", "headers", "rowspan", "valign", "width"],
27
85
  "th" => ["abbr", "align", "axis", "colspan", "headers", "rowspan", "scope", "sorted", "valign", "width"],
28
- "ul" => ["type"]),
86
+ "ul" => ["type"],
87
+ ),
29
88
 
30
- protocols: merge(BASIC[:protocols],
89
+ protocols: merge(
90
+ BASIC[:protocols],
31
91
  "del" => { "cite" => ["http", "https", :relative] },
32
92
  "img" => { "src" => ["http", "https", :relative] },
33
- "ins" => { "cite" => ["http", "https", :relative] }),
93
+ "ins" => { "cite" => ["http", "https", :relative] },
94
+ ),
34
95
  )
35
96
  end
36
97
  end
data/lib/selma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Selma
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.7"
5
5
  end
data/selma.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
25
25
 
26
26
  spec.require_paths = ["lib"]
27
- spec.extensions = ["ext/selma/Cargo.toml"]
27
+ spec.extensions = ["ext/selma/extconf.rb"]
28
28
 
29
29
  spec.metadata = {
30
30
  "allowed_push_host" => "https://rubygems.org",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Garen J. Torikian
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-28 00:00:00.000000000 Z
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.2'
69
- description:
69
+ description:
70
70
  email:
71
71
  - gjtorikian@gmail.com
72
72
  executables: []
@@ -91,6 +91,7 @@ files:
91
91
  - ext/selma/src/wrapped_struct.rs
92
92
  - lib/selma.rb
93
93
  - lib/selma/3.1/selma.so
94
+ - lib/selma/3.2/selma.so
94
95
  - lib/selma/extension.rb
95
96
  - lib/selma/html.rb
96
97
  - lib/selma/rewriter.rb
@@ -103,7 +104,7 @@ files:
103
104
  - lib/selma/selector.rb
104
105
  - lib/selma/version.rb
105
106
  - selma.gemspec
106
- homepage:
107
+ homepage:
107
108
  licenses:
108
109
  - MIT
109
110
  metadata:
@@ -111,7 +112,7 @@ metadata:
111
112
  funding_uri: https://github.com/sponsors/gjtorikian/
112
113
  source_code_uri: https://github.com/gjtorikian/selma
113
114
  rubygems_mfa_required: 'true'
114
- post_install_message:
115
+ post_install_message:
115
116
  rdoc_options: []
116
117
  require_paths:
117
118
  - lib
@@ -122,15 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
123
  version: '3.1'
123
124
  - - "<"
124
125
  - !ruby/object:Gem::Version
125
- version: 3.2.dev
126
+ version: 3.3.dev
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  requirements:
128
129
  - - ">="
129
130
  - !ruby/object:Gem::Version
130
131
  version: 3.3.22
131
132
  requirements: []
132
- rubygems_version: 3.3.22
133
- signing_key:
133
+ rubygems_version: 3.4.3
134
+ signing_key:
134
135
  specification_version: 4
135
136
  summary: Selma selects and matches HTML nodes using CSS rules. Backed by Rust's lol_html
136
137
  parser.