sbsm 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/History.txt +5 -0
- data/devenv.lock +18 -78
- data/devenv.nix +4 -3
- data/devenv.yaml +1 -1
- data/lib/sbsm/trans_handler.rb +1 -1
- data/lib/sbsm/validator.rb +11 -12
- data/lib/sbsm/version.rb +1 -1
- data/sbsm.gemspec +3 -2
- data/test/test_application.rb +1 -1
- data/test/test_validator.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86e899261cc339f9823718208de2acff2be0eee084ff0327f7d8773a219255b4
|
4
|
+
data.tar.gz: d5bbc3378fa5e2ced23310629caa4459cb52261973f3676e9bae0f9f8cee2183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 406aa85aad631e33db299ed2d6dc351695ba5bf6550ce3aae67d01a12596cdc4b70a67dc5471599a4ac4ef17d28a5e1d456173bf66b44ac02b77ed27dd582782
|
7
|
+
data.tar.gz: 77aeb85b366d0bef22bede0ffd0f8ff0d300d32729021c6786b0cd78e32079cbbaccdd133521d90f8121c1e18d0c452b8749cd89ac8e1849a30f52a2deb0c073
|
data/.github/workflows/ruby.yml
CHANGED
@@ -22,7 +22,7 @@ jobs:
|
|
22
22
|
fail-fast: false
|
23
23
|
matrix:
|
24
24
|
os: [ ubuntu]
|
25
|
-
ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, head]
|
25
|
+
ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, 3.4, head]
|
26
26
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
|
27
27
|
steps:
|
28
28
|
- uses: actions/checkout@v2
|
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 1.6.3 / 07.01.2025
|
2
|
+
|
3
|
+
* Updated devenv environment for Ruby 3.3 (see https://devenv.sh/)
|
4
|
+
* Replace hpricot with nokogiri as hpricot is no longer maintained and leads to many test warnings under Ruby 3.4
|
5
|
+
|
1
6
|
=== 1.6.2 / 25.01.2024
|
2
7
|
|
3
8
|
* Add devenv environment for Ruby 3.3 (see https://devenv.sh/)
|
data/devenv.lock
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
"devenv": {
|
4
4
|
"locked": {
|
5
5
|
"dir": "src/modules",
|
6
|
-
"lastModified":
|
7
|
-
"narHash": "sha256-2nhAJ/9LMlwaEZDnoDIhnhQ0pEC/YIIt09WD7FmTp6g=",
|
6
|
+
"lastModified": 1736184348,
|
8
7
|
"owner": "cachix",
|
9
8
|
"repo": "devenv",
|
10
|
-
"rev": "
|
9
|
+
"rev": "07219f00c633f756d1f0cc5bb6c4c311b5c4cb0d",
|
11
10
|
"type": "github"
|
12
11
|
},
|
13
12
|
"original": {
|
@@ -20,11 +19,10 @@
|
|
20
19
|
"flake-compat": {
|
21
20
|
"flake": false,
|
22
21
|
"locked": {
|
23
|
-
"lastModified":
|
24
|
-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
22
|
+
"lastModified": 1733328505,
|
25
23
|
"owner": "edolstra",
|
26
24
|
"repo": "flake-compat",
|
27
|
-
"rev": "
|
25
|
+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
28
26
|
"type": "github"
|
29
27
|
},
|
30
28
|
"original": {
|
@@ -36,11 +34,10 @@
|
|
36
34
|
"flake-compat_2": {
|
37
35
|
"flake": false,
|
38
36
|
"locked": {
|
39
|
-
"lastModified":
|
40
|
-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
37
|
+
"lastModified": 1733328505,
|
41
38
|
"owner": "edolstra",
|
42
39
|
"repo": "flake-compat",
|
43
|
-
"rev": "
|
40
|
+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
44
41
|
"type": "github"
|
45
42
|
},
|
46
43
|
"original": {
|
@@ -54,29 +51,10 @@
|
|
54
51
|
"systems": "systems"
|
55
52
|
},
|
56
53
|
"locked": {
|
57
|
-
"lastModified":
|
58
|
-
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
54
|
+
"lastModified": 1731533236,
|
59
55
|
"owner": "numtide",
|
60
56
|
"repo": "flake-utils",
|
61
|
-
"rev": "
|
62
|
-
"type": "github"
|
63
|
-
},
|
64
|
-
"original": {
|
65
|
-
"owner": "numtide",
|
66
|
-
"repo": "flake-utils",
|
67
|
-
"type": "github"
|
68
|
-
}
|
69
|
-
},
|
70
|
-
"flake-utils_2": {
|
71
|
-
"inputs": {
|
72
|
-
"systems": "systems_2"
|
73
|
-
},
|
74
|
-
"locked": {
|
75
|
-
"lastModified": 1701680307,
|
76
|
-
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
77
|
-
"owner": "numtide",
|
78
|
-
"repo": "flake-utils",
|
79
|
-
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
57
|
+
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
80
58
|
"type": "github"
|
81
59
|
},
|
82
60
|
"original": {
|
@@ -93,11 +71,10 @@
|
|
93
71
|
]
|
94
72
|
},
|
95
73
|
"locked": {
|
96
|
-
"lastModified":
|
97
|
-
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
|
74
|
+
"lastModified": 1709087332,
|
98
75
|
"owner": "hercules-ci",
|
99
76
|
"repo": "gitignore.nix",
|
100
|
-
"rev": "
|
77
|
+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
101
78
|
"type": "github"
|
102
79
|
},
|
103
80
|
"original": {
|
@@ -108,16 +85,15 @@
|
|
108
85
|
},
|
109
86
|
"nixpkgs": {
|
110
87
|
"locked": {
|
111
|
-
"lastModified":
|
112
|
-
"narHash": "sha256-qjQXfvrAT1/RKDFAMdl8Hw3m4tLVvMCc8fMqzJv0pP4=",
|
88
|
+
"lastModified": 1736061677,
|
113
89
|
"owner": "NixOS",
|
114
90
|
"repo": "nixpkgs",
|
115
|
-
"rev": "
|
91
|
+
"rev": "cbd8ec4de4469333c82ff40d057350c30e9f7d36",
|
116
92
|
"type": "github"
|
117
93
|
},
|
118
94
|
"original": {
|
119
95
|
"owner": "NixOS",
|
120
|
-
"ref": "nixos-
|
96
|
+
"ref": "nixos-24.11",
|
121
97
|
"repo": "nixpkgs",
|
122
98
|
"type": "github"
|
123
99
|
}
|
@@ -131,11 +107,10 @@
|
|
131
107
|
]
|
132
108
|
},
|
133
109
|
"locked": {
|
134
|
-
"lastModified":
|
135
|
-
"narHash": "sha256-9FUnVSPjF+xV2a7tfai8fxi9Ek538mdkEjaFJnWRk9Y=",
|
110
|
+
"lastModified": 1735192621,
|
136
111
|
"owner": "bobvanderlinden",
|
137
112
|
"repo": "nixpkgs-ruby",
|
138
|
-
"rev": "
|
113
|
+
"rev": "602c528c8228f231f912c6d117703a1700464202",
|
139
114
|
"type": "github"
|
140
115
|
},
|
141
116
|
"original": {
|
@@ -144,38 +119,19 @@
|
|
144
119
|
"type": "github"
|
145
120
|
}
|
146
121
|
},
|
147
|
-
"nixpkgs-stable": {
|
148
|
-
"locked": {
|
149
|
-
"lastModified": 1704874635,
|
150
|
-
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
|
151
|
-
"owner": "NixOS",
|
152
|
-
"repo": "nixpkgs",
|
153
|
-
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
|
154
|
-
"type": "github"
|
155
|
-
},
|
156
|
-
"original": {
|
157
|
-
"owner": "NixOS",
|
158
|
-
"ref": "nixos-23.11",
|
159
|
-
"repo": "nixpkgs",
|
160
|
-
"type": "github"
|
161
|
-
}
|
162
|
-
},
|
163
122
|
"pre-commit-hooks": {
|
164
123
|
"inputs": {
|
165
124
|
"flake-compat": "flake-compat_2",
|
166
|
-
"flake-utils": "flake-utils_2",
|
167
125
|
"gitignore": "gitignore",
|
168
126
|
"nixpkgs": [
|
169
127
|
"nixpkgs"
|
170
|
-
]
|
171
|
-
"nixpkgs-stable": "nixpkgs-stable"
|
128
|
+
]
|
172
129
|
},
|
173
130
|
"locked": {
|
174
|
-
"lastModified":
|
175
|
-
"narHash": "sha256-itILy0zimR/iyUGq5Dgg0fiW8plRDyxF153LWGsg3Cw=",
|
131
|
+
"lastModified": 1735882644,
|
176
132
|
"owner": "cachix",
|
177
133
|
"repo": "pre-commit-hooks.nix",
|
178
|
-
"rev": "
|
134
|
+
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
|
179
135
|
"type": "github"
|
180
136
|
},
|
181
137
|
"original": {
|
@@ -195,22 +151,6 @@
|
|
195
151
|
"systems": {
|
196
152
|
"locked": {
|
197
153
|
"lastModified": 1681028828,
|
198
|
-
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
199
|
-
"owner": "nix-systems",
|
200
|
-
"repo": "default",
|
201
|
-
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
202
|
-
"type": "github"
|
203
|
-
},
|
204
|
-
"original": {
|
205
|
-
"owner": "nix-systems",
|
206
|
-
"repo": "default",
|
207
|
-
"type": "github"
|
208
|
-
}
|
209
|
-
},
|
210
|
-
"systems_2": {
|
211
|
-
"locked": {
|
212
|
-
"lastModified": 1681028828,
|
213
|
-
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
214
154
|
"owner": "nix-systems",
|
215
155
|
"repo": "default",
|
216
156
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
data/devenv.nix
CHANGED
@@ -13,13 +13,14 @@
|
|
13
13
|
ruby --version
|
14
14
|
'';
|
15
15
|
|
16
|
-
env.FREEDESKTOP_MIME_TYPES_PATH = "${pkgs.shared-mime-info}/share/mime/packages/freedesktop.org.xml";
|
17
|
-
|
18
16
|
# https://devenv.sh/languages/
|
19
17
|
# languages.nix.enable = true;
|
20
18
|
|
21
19
|
languages.ruby.enable = true;
|
22
|
-
languages.ruby.
|
20
|
+
languages.ruby.version = "3.4";
|
21
|
+
# Needed for gem mimemagic
|
22
|
+
env.FREEDESKTOP_MIME_TYPES_PATH = "${pkgs.shared-mime-info}/share/mime/packages/freedesktop.org.xml";
|
23
|
+
|
23
24
|
# https://devenv.sh/pre-commit-hooks/
|
24
25
|
# pre-commit.hooks.shellcheck.enable = true;
|
25
26
|
|
data/devenv.yaml
CHANGED
data/lib/sbsm/trans_handler.rb
CHANGED
@@ -150,7 +150,7 @@ module SBSM
|
|
150
150
|
end
|
151
151
|
def uri_parser(grammar_path=@grammar_path, parser_path=@parser_path)
|
152
152
|
if(File.exist?(grammar_path))
|
153
|
-
oldpath = File.expand_path("_"
|
153
|
+
oldpath = File.expand_path("_" + File.basename(grammar_path),
|
154
154
|
File.dirname(grammar_path))
|
155
155
|
src = File.read(grammar_path)
|
156
156
|
unless(File.exist?(oldpath) && File.read(oldpath)==src)
|
data/lib/sbsm/validator.rb
CHANGED
@@ -30,7 +30,7 @@ require 'mail'
|
|
30
30
|
require 'date'
|
31
31
|
require 'uri'
|
32
32
|
require 'stringio'
|
33
|
-
require
|
33
|
+
require "nokogiri"
|
34
34
|
require 'sbsm/logger'
|
35
35
|
|
36
36
|
module SBSM
|
@@ -225,17 +225,16 @@ module SBSM
|
|
225
225
|
end
|
226
226
|
@@xml_ptrn = /<\?xml[^>]+>/
|
227
227
|
def _validate_html(value, valid=self.class.const_get(:ALLOWED_TAGS))
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
valid
|
228
|
+
doc = Nokogiri::HTML.parse(value.gsub(@@xml_ptrn, ''))
|
229
|
+
doc.elements.each do |element|
|
230
|
+
unless( element.is_a?(Nokogiri::XML::Text) ||
|
231
|
+
(element.respond_to?(:name) \
|
232
|
+
&& valid.include?(element.name.downcase)))
|
233
|
+
end
|
234
|
+
end
|
235
|
+
result = ''
|
236
|
+
doc.elements.each { |x| result += x.inner_html}
|
237
|
+
result.sub('<body>','').sub('</body>','')
|
239
238
|
end
|
240
239
|
@@numeric_ptrn = /\d+(\.\d{1,2})?/
|
241
240
|
def validate_numeric(key, value)
|
data/lib/sbsm/version.rb
CHANGED
data/sbsm.gemspec
CHANGED
@@ -16,13 +16,14 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
|
+
spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/ChangeLog"
|
19
20
|
|
20
21
|
# We fix the version of the spec to newer versions only in the third position
|
21
22
|
# hoping that these version fix only security/severe bugs
|
22
23
|
# Consulted the Gemfile.lock to get
|
23
24
|
spec.add_dependency 'rack'
|
24
25
|
spec.add_dependency 'mail', '< 2.8.0'
|
25
|
-
spec.add_dependency '
|
26
|
+
spec.add_dependency 'nokogiri'
|
26
27
|
spec.add_dependency 'mimemagic'
|
27
28
|
|
28
29
|
spec.add_development_dependency "bundler"
|
@@ -34,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
34
35
|
spec.add_development_dependency "simplecov"
|
35
36
|
spec.add_development_dependency "watir"
|
36
37
|
spec.add_development_dependency "watir-webdriver"
|
37
|
-
spec.add_development_dependency "
|
38
|
+
spec.add_development_dependency "debug"
|
38
39
|
spec.add_development_dependency "nokogiri"
|
39
40
|
spec.add_development_dependency "rack-test"
|
40
41
|
end
|
data/test/test_application.rb
CHANGED
@@ -26,7 +26,7 @@ class AppVariantTest < Minitest::Test
|
|
26
26
|
end
|
27
27
|
def test_post_feedback
|
28
28
|
get '/de/page' do # needed to set cookie
|
29
|
-
last_response.set_cookie(TEST_COOKIE_NAME, :value =>
|
29
|
+
last_response.set_cookie(TEST_COOKIE_NAME, :value => {'anrede' => 'value2'})
|
30
30
|
end
|
31
31
|
clear_cookies
|
32
32
|
set_cookie 'anrede=value2'
|
data/test/test_validator.rb
CHANGED
@@ -122,7 +122,7 @@ class TestValidator < Minitest::Test
|
|
122
122
|
end
|
123
123
|
def test_validate_html
|
124
124
|
src = "<SPAN style=\"PADDING-BOTTOM: 4px; LINE-HEIGHT: 1.4em; WHITE-SPACE: normal\"><p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Wirkstoff: Ibuprofenum. </span></p><p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Hilfsstoffe: Conserv.: Sorbinsäure (E 200)</span></p></span>"
|
125
|
-
expected = "<span style=\"PADDING-BOTTOM: 4px; LINE-HEIGHT: 1.4em; WHITE-SPACE: normal\"><p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Wirkstoff: Ibuprofenum. </span></p
|
125
|
+
expected = "<span style=\"PADDING-BOTTOM: 4px; LINE-HEIGHT: 1.4em; WHITE-SPACE: normal\"><p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Wirkstoff: Ibuprofenum. </span></p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm -0.3pt 0pt 0cm; TEXT-ALIGN: justify\"><span lang=\"DE\" style=\"FONT-SIZE: 11pt; FONT-FAMILY: Arial; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: 'Times New Roman'\">Hilfsstoffe: Conserv.: Sorbinsäure (E 200)</span></p></span>"
|
126
126
|
assert_equal expected, @val.validate(:html, src)
|
127
127
|
end
|
128
128
|
def test_validate_html__pre
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sbsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: debug
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - ">="
|
@@ -306,7 +306,8 @@ files:
|
|
306
306
|
homepage: https://github.com/zdavatz/sbsm
|
307
307
|
licenses:
|
308
308
|
- GPL-v2
|
309
|
-
metadata:
|
309
|
+
metadata:
|
310
|
+
changelog_uri: https://github.com/zdavatz/sbsm/blob/master/ChangeLog
|
310
311
|
post_install_message:
|
311
312
|
rdoc_options: []
|
312
313
|
require_paths:
|