govspeak 6.5.3 → 6.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Rakefile +6 -3
- data/lib/govspeak.rb +54 -52
- data/lib/govspeak/html_sanitizer.rb +3 -3
- data/lib/govspeak/kramdown_overrides.rb +2 -2
- data/lib/govspeak/link_extractor.rb +3 -3
- data/lib/govspeak/post_processor.rb +17 -5
- data/lib/govspeak/presenters/attachment_presenter.rb +26 -26
- data/lib/govspeak/presenters/image_presenter.rb +2 -2
- data/lib/govspeak/structured_header_extractor.rb +2 -2
- data/lib/govspeak/version.rb +1 -1
- data/lib/kramdown/parser/govuk.rb +4 -5
- data/test/blockquote_extra_quote_remover_test.rb +25 -27
- data/test/govspeak_attachment_link_test.rb +0 -2
- data/test/govspeak_attachment_test.rb +0 -2
- data/test/govspeak_attachments_image_test.rb +2 -4
- data/test/govspeak_attachments_inline_test.rb +4 -6
- data/test/govspeak_button_test.rb +8 -10
- data/test/govspeak_contacts_test.rb +11 -13
- data/test/govspeak_extract_contact_content_ids_test.rb +0 -2
- data/test/govspeak_footnote_test.rb +31 -0
- data/test/govspeak_images_bang_test.rb +30 -32
- data/test/govspeak_images_test.rb +36 -38
- data/test/govspeak_link_extractor_test.rb +1 -1
- data/test/govspeak_link_test.rb +0 -2
- data/test/govspeak_structured_headers_test.rb +5 -4
- data/test/govspeak_table_with_headers_test.rb +67 -20
- data/test/govspeak_test.rb +80 -83
- data/test/govspeak_test_helper.rb +1 -1
- data/test/html_sanitizer_test.rb +0 -1
- data/test/presenters/h_card_presenter_test.rb +0 -2
- data/test/test_helper.rb +6 -2
- metadata +48 -34
@@ -49,7 +49,7 @@ module GovspeakTestHelper
|
|
49
49
|
lines = text.split "\n"
|
50
50
|
digits = Math.log10(lines.size + 2).ceil
|
51
51
|
lines.map
|
52
|
-
.with_index { |line, i| "%<number>#{digits}d: %<line>s"
|
52
|
+
.with_index { |line, i| sprintf("%<number>#{digits}d: %<line>s", number: i + 1, line: line) }
|
53
53
|
.join("\n")
|
54
54
|
end
|
55
55
|
end
|
data/test/html_sanitizer_test.rb
CHANGED
@@ -79,7 +79,6 @@ class HtmlSanitizerTest < Minitest::Test
|
|
79
79
|
assert_equal "<table><tbody><tr><th>thing</th><td>thing</td></tr></tbody></table>", Govspeak::HtmlSanitizer.new(html).sanitize
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
82
|
test "allows valid text-align properties on the style attribute for table cells and table headings" do
|
84
83
|
%w[left right center].each do |alignment|
|
85
84
|
html = "<table><thead><tr><th style=\"text-align: #{alignment}\">thing</th></tr></thead><tbody><tr><td style=\"text-align: #{alignment}\">thing</td></tr></tbody></table>"
|
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,7 @@ require "simplecov-rcov"
|
|
4
4
|
SimpleCov.start
|
5
5
|
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
6
6
|
|
7
|
-
|
7
|
+
$LOAD_PATH.unshift(File.expand_path("../lib")) unless $LOAD_PATH.include?(File.expand_path("../lib"))
|
8
8
|
|
9
9
|
require "bundler"
|
10
10
|
Bundler.setup :default, :development, :test
|
@@ -16,7 +16,11 @@ class Minitest::Test
|
|
16
16
|
def test(name, &block)
|
17
17
|
clean_name = name.gsub(/\s+/, "_")
|
18
18
|
method = "test_#{clean_name.gsub(/\s+/, '_')}".to_sym
|
19
|
-
already_defined =
|
19
|
+
already_defined = begin
|
20
|
+
instance_method(method)
|
21
|
+
rescue StandardError
|
22
|
+
false
|
23
|
+
end
|
20
24
|
raise "#{method} exists" if already_defined
|
21
25
|
|
22
26
|
define_method(method, &block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govspeak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.5.
|
4
|
+
version: 6.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -56,14 +56,20 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '23.0'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '23.4'
|
60
63
|
type: :runtime
|
61
64
|
prerelease: false
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
63
66
|
requirements:
|
64
67
|
- - ">="
|
65
68
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
69
|
+
version: '23.0'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '23.4'
|
67
73
|
- !ruby/object:Gem::Dependency
|
68
74
|
name: htmlentities
|
69
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,16 +102,16 @@ dependencies:
|
|
96
102
|
name: kramdown
|
97
103
|
requirement: !ruby/object:Gem::Requirement
|
98
104
|
requirements:
|
99
|
-
- - "
|
105
|
+
- - ">="
|
100
106
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
107
|
+
version: 2.3.0
|
102
108
|
type: :runtime
|
103
109
|
prerelease: false
|
104
110
|
version_requirements: !ruby/object:Gem::Requirement
|
105
111
|
requirements:
|
106
|
-
- - "
|
112
|
+
- - ">="
|
107
113
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
114
|
+
version: 2.3.0
|
109
115
|
- !ruby/object:Gem::Dependency
|
110
116
|
name: nokogiri
|
111
117
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,30 +158,36 @@ dependencies:
|
|
152
158
|
name: sanitize
|
153
159
|
requirement: !ruby/object:Gem::Requirement
|
154
160
|
requirements:
|
155
|
-
- - "
|
161
|
+
- - ">="
|
156
162
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
163
|
+
version: 5.2.1
|
164
|
+
- - "<"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '6'
|
158
167
|
type: :runtime
|
159
168
|
prerelease: false
|
160
169
|
version_requirements: !ruby/object:Gem::Requirement
|
161
170
|
requirements:
|
162
|
-
- - "
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 5.2.1
|
174
|
+
- - "<"
|
163
175
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
176
|
+
version: '6'
|
165
177
|
- !ruby/object:Gem::Dependency
|
166
178
|
name: minitest
|
167
179
|
requirement: !ruby/object:Gem::Requirement
|
168
180
|
requirements:
|
169
181
|
- - "~>"
|
170
182
|
- !ruby/object:Gem::Version
|
171
|
-
version: 5.
|
183
|
+
version: 5.14.1
|
172
184
|
type: :development
|
173
185
|
prerelease: false
|
174
186
|
version_requirements: !ruby/object:Gem::Requirement
|
175
187
|
requirements:
|
176
188
|
- - "~>"
|
177
189
|
- !ruby/object:Gem::Version
|
178
|
-
version: 5.
|
190
|
+
version: 5.14.1
|
179
191
|
- !ruby/object:Gem::Dependency
|
180
192
|
name: pry-byebug
|
181
193
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,30 +206,30 @@ dependencies:
|
|
194
206
|
name: rake
|
195
207
|
requirement: !ruby/object:Gem::Requirement
|
196
208
|
requirements:
|
197
|
-
- - "
|
209
|
+
- - ">="
|
198
210
|
- !ruby/object:Gem::Version
|
199
|
-
version: 0
|
211
|
+
version: '0'
|
200
212
|
type: :development
|
201
213
|
prerelease: false
|
202
214
|
version_requirements: !ruby/object:Gem::Requirement
|
203
215
|
requirements:
|
204
|
-
- - "
|
216
|
+
- - ">="
|
205
217
|
- !ruby/object:Gem::Version
|
206
|
-
version: 0
|
218
|
+
version: '0'
|
207
219
|
- !ruby/object:Gem::Dependency
|
208
220
|
name: rubocop-govuk
|
209
221
|
requirement: !ruby/object:Gem::Requirement
|
210
222
|
requirements:
|
211
223
|
- - "~>"
|
212
224
|
- !ruby/object:Gem::Version
|
213
|
-
version:
|
225
|
+
version: 3.17.1
|
214
226
|
type: :development
|
215
227
|
prerelease: false
|
216
228
|
version_requirements: !ruby/object:Gem::Requirement
|
217
229
|
requirements:
|
218
230
|
- - "~>"
|
219
231
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
232
|
+
version: 3.17.1
|
221
233
|
- !ruby/object:Gem::Dependency
|
222
234
|
name: simplecov
|
223
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -330,6 +342,7 @@ files:
|
|
330
342
|
- test/govspeak_button_test.rb
|
331
343
|
- test/govspeak_contacts_test.rb
|
332
344
|
- test/govspeak_extract_contact_content_ids_test.rb
|
345
|
+
- test/govspeak_footnote_test.rb
|
333
346
|
- test/govspeak_images_bang_test.rb
|
334
347
|
- test/govspeak_images_test.rb
|
335
348
|
- test/govspeak_link_extractor_test.rb
|
@@ -360,28 +373,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
360
373
|
- !ruby/object:Gem::Version
|
361
374
|
version: '0'
|
362
375
|
requirements: []
|
363
|
-
rubygems_version: 3.
|
376
|
+
rubygems_version: 3.1.4
|
364
377
|
signing_key:
|
365
378
|
specification_version: 4
|
366
379
|
summary: Markup language for single domain
|
367
380
|
test_files:
|
368
|
-
- test/
|
369
|
-
- test/govspeak_test_helper.rb
|
370
|
-
- test/govspeak_structured_headers_test.rb
|
371
|
-
- test/govspeak_attachment_link_test.rb
|
372
|
-
- test/govspeak_attachments_image_test.rb
|
373
|
-
- test/test_helper.rb
|
374
|
-
- test/govspeak_attachments_inline_test.rb
|
381
|
+
- test/govspeak_footnote_test.rb
|
375
382
|
- test/html_sanitizer_test.rb
|
383
|
+
- test/govspeak_test.rb
|
384
|
+
- test/test_helper.rb
|
385
|
+
- test/blockquote_extra_quote_remover_test.rb
|
376
386
|
- test/govspeak_button_test.rb
|
377
|
-
- test/govspeak_images_bang_test.rb
|
378
|
-
- test/govspeak_images_test.rb
|
379
387
|
- test/html_validator_test.rb
|
380
|
-
- test/govspeak_attachment_test.rb
|
381
|
-
- test/govspeak_extract_contact_content_ids_test.rb
|
382
|
-
- test/govspeak_test.rb
|
383
388
|
- test/govspeak_link_extractor_test.rb
|
389
|
+
- test/govspeak_attachment_link_test.rb
|
384
390
|
- test/govspeak_link_test.rb
|
385
391
|
- test/govspeak_contacts_test.rb
|
386
|
-
- test/
|
392
|
+
- test/govspeak_structured_headers_test.rb
|
393
|
+
- test/govspeak_images_test.rb
|
394
|
+
- test/govspeak_extract_contact_content_ids_test.rb
|
387
395
|
- test/govspeak_table_with_headers_test.rb
|
396
|
+
- test/govspeak_attachment_test.rb
|
397
|
+
- test/govspeak_attachments_inline_test.rb
|
398
|
+
- test/presenters/h_card_presenter_test.rb
|
399
|
+
- test/govspeak_test_helper.rb
|
400
|
+
- test/govspeak_images_bang_test.rb
|
401
|
+
- test/govspeak_attachments_image_test.rb
|