govspeak 6.8.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8509b4c394ef305fd80454c6c6bdb13561332bcdedc5d0292c271387a34043c
4
- data.tar.gz: a73d8175cbea307d6b8028931bd15e9b99b97f7ae7708247cc833873622a8574
3
+ metadata.gz: 3c3b8cb50ac3718a8e0721af172791562652e29dcbb871ef0c9627bd452a6dff
4
+ data.tar.gz: 1d95d42b9f7f3302ecb7357811ad3e8e65856ea1f965dbb65a5a9e3564b0069b
5
5
  SHA512:
6
- metadata.gz: ae280e29132e39a4d85f6f095bfd45cfc0da7505b7148e0b48756c4c9fccd29af2a550257a6f972837b8f1c1495f817ee61653ee069db868e66fc5a149386553
7
- data.tar.gz: d3e0c5858ebe636a50d44bb360c68bc2bee4cad547529872c51be3f42a5630d5444ccc29e4ef5437d096ecdc43386f18c27363f9bcfbeff801a86fb3f6bbc486
6
+ metadata.gz: 9c3d91185cf37171cc0cfe0ea48abfd37451c069c5ab2cff7cd7e909cf2298e92fe67b11de5985f5257d0f962f991b8240c8a38c5771792d1add389d3629e7d6
7
+ data.tar.gz: f3e4c332b35bcf5ab2587028d33cd85d4b933fd054334691c29febb3a85192214672ddc37a04f38117fce3e28b473068667d756e14e22e89f5614109e052cae5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 7.0.0
2
+
3
+ * BREAKING CHANGE Remove `PriorityList`, the `PrimaryList` JS module to render the priority list on the frontend is to be removed [#249](https://github.com/alphagov/govspeak/pull/249)
4
+
5
+ ## 6.8.4
6
+
7
+ * Fix bug where inconsistent linebreaks trigger validations [#250](https://github.com/alphagov/govspeak/pull/250)
8
+
9
+ ## 6.8.3
10
+
11
+ * Require Kramdown minimum version of 2.3.1 to avoid CVE-2021-28834 [#246](https://github.com/alphagov/govspeak/pull/246)
12
+
1
13
  ## 6.8.2
2
14
 
3
15
  * Fix footnote numbering [#239](https://github.com/alphagov/govspeak/pull/239)
data/README.md CHANGED
@@ -292,29 +292,6 @@ For lists where you want to specify the numbering and have multiple indent level
292
292
  $EndLegislativeList
293
293
  (to indent, add 2 spaces)
294
294
 
295
- ## Priority Lists
296
-
297
- For lists where you want to specify a number of items to be highlighted as priority.
298
-
299
- $PriorityList:3
300
- - Item 1
301
- - Item 2
302
- - Item 3
303
- - Item 4
304
- - Item 5
305
-
306
- creates a list with priority items flagged with a class
307
-
308
- ```html
309
- <ul>
310
- <li class="primary-item">Item 1</li>
311
- <li class="primary-item">Item 2</li>
312
- <li class="primary-item">Item 3</li>
313
- <li>Item 4</li>
314
- <li>Item 5</li>
315
- </ul>
316
- ```
317
-
318
295
  ## Devolved content
319
296
 
320
297
  :england:content goes here:england:
@@ -20,7 +20,7 @@ private
20
20
 
21
21
  # Make whitespace in html tags consistent
22
22
  def normalise_html(html)
23
- Nokogiri::HTML5.fragment(html).to_s
23
+ Nokogiri::HTML5.fragment(html).to_s.gsub("\n", "")
24
24
  end
25
25
 
26
26
  def govspeak_to_html(sanitize:)
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "6.8.2".freeze
2
+ VERSION = "7.0.0".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -405,19 +405,6 @@ module Govspeak
405
405
  end
406
406
  end
407
407
 
408
- extension("Priority list", /#{NEW_PARAGRAPH_LOOKBEHIND}\$PriorityList:(\d+)\s*$(.*?)(?:^\s*$|\Z)/m) do |number_to_show, body|
409
- number_to_show = number_to_show.to_i
410
- tagged = 0
411
- Govspeak::Document.new(body.strip).to_html.gsub(/<li>/) do |match|
412
- if tagged < number_to_show
413
- tagged += 1
414
- '<li class="primary-item">'
415
- else
416
- match
417
- end
418
- end
419
- end
420
-
421
408
  extension("embed link", /\[embed:link:\s*(.*?)\s*\]/) do |content_id|
422
409
  link = links.detect { |l| l[:content_id] == content_id }
423
410
  next "" unless link
@@ -1219,139 +1219,6 @@ Teston
1219
1219
  assert document.valid?
1220
1220
  end
1221
1221
 
1222
- expected_priority_list_output = %(
1223
- <ul>
1224
- <li class="primary-item">List item 1</li>
1225
- <li class="primary-item">List item 2</li>
1226
- <li class="primary-item">List item 3</li>
1227
- <li>List item 4</li>
1228
- <li>List item 5</li>
1229
- </ul>
1230
- )
1231
-
1232
- test "Single priority list ending with EOF" do
1233
- govspeak = "$PriorityList:3
1234
- * List item 1
1235
- * List item 2
1236
- * List item 3
1237
- * List item 4
1238
- * List item 5"
1239
-
1240
- given_govspeak(govspeak) do
1241
- assert_html_output(expected_priority_list_output)
1242
- end
1243
- end
1244
-
1245
- test "Single priority list ending with newlines" do
1246
- govspeak = "$PriorityList:3
1247
- * List item 1
1248
- * List item 2
1249
- * List item 3
1250
- * List item 4
1251
- * List item 5
1252
-
1253
- "
1254
-
1255
- given_govspeak(govspeak) do
1256
- assert_html_output(expected_priority_list_output)
1257
- end
1258
- end
1259
-
1260
- test 'Single priority list with \n newlines' do
1261
- govspeak = "$PriorityList:3\n * List item 1\n * List item 2\n * List item 3\n * List item 4\n * List item 5"
1262
-
1263
- given_govspeak(govspeak) do
1264
- assert_html_output(expected_priority_list_output)
1265
- end
1266
- end
1267
-
1268
- test 'Single priority list with \r\n newlines' do
1269
- govspeak = "$PriorityList:3\r\n * List item 1\r\n * List item 2\r\n * List item 3\r\n * List item 4\r\n * List item 5"
1270
-
1271
- given_govspeak(govspeak) do
1272
- assert_html_output(expected_priority_list_output)
1273
- end
1274
- end
1275
-
1276
- test "Multiple priority lists" do
1277
- govspeak = "
1278
- $PriorityList:3
1279
- * List item 1
1280
- * List item 2
1281
- * List item 3
1282
- * List item 4
1283
- * List item 5
1284
-
1285
- $PriorityList:1
1286
- * List item 1
1287
- * List item 2"
1288
-
1289
- given_govspeak(govspeak) do
1290
- assert_html_output %(
1291
- <ul>
1292
- <li class="primary-item">List item 1</li>
1293
- <li class="primary-item">List item 2</li>
1294
- <li class="primary-item">List item 3</li>
1295
- <li>List item 4</li>
1296
- <li>List item 5</li>
1297
- </ul>
1298
-
1299
- <ul>
1300
- <li class="primary-item">List item 1</li>
1301
- <li>List item 2</li>
1302
- </ul>
1303
- )
1304
- end
1305
- end
1306
-
1307
- test "Priority list placed incorrectly" do
1308
- govspeak = "
1309
- This is a paragraph
1310
- $PriorityList:3
1311
- * List item 1
1312
- * List item 2
1313
- * List item 3
1314
- * List item 4
1315
- * List item 5"
1316
-
1317
- given_govspeak(govspeak) do
1318
- assert_html_output("
1319
- <p>This is a paragraph
1320
- $PriorityList:3
1321
- * List item 1
1322
- * List item 2
1323
- * List item 3
1324
- * List item 4
1325
- * List item 5</p>")
1326
- end
1327
- end
1328
-
1329
- test "Priority list placed correctly" do
1330
- govspeak = "
1331
- This is a paragraph
1332
-
1333
- $PriorityList:3
1334
- * List item 1
1335
- * List item 2
1336
- * List item 3
1337
- * List item 4
1338
- * List item 5"
1339
-
1340
- given_govspeak(govspeak) do
1341
- assert_html_output %(
1342
- <p>This is a paragraph</p>
1343
-
1344
- <ul>
1345
- <li class="primary-item">List item 1</li>
1346
- <li class="primary-item">List item 2</li>
1347
- <li class="primary-item">List item 3</li>
1348
- <li>List item 4</li>
1349
- <li>List item 5</li>
1350
- </ul>
1351
- )
1352
- end
1353
- end
1354
-
1355
1222
  test "should remove quotes surrounding a blockquote" do
1356
1223
  govspeak = %(
1357
1224
  He said:
@@ -108,4 +108,9 @@ class HtmlValidatorTest < Minitest::Test
108
108
  assert Govspeak::HtmlValidator.new("<table><tr><td>Hello</td></tr></table>").valid?, "No <tbody> is valid"
109
109
  assert Govspeak::HtmlValidator.new("<table><tbody><tr><td>Hello</td></tr></tbody></table>").valid?, "<tbody> is valid"
110
110
  end
111
+
112
+ test "allow HTML tables with \n" do
113
+ html = "<table>\n<thead>\n<tr>\n<th></th>\n<th></th>\n<th colspan=\"3\"></th>\n\n</tr>\n</thead>\n<tr>\n<th></th>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n</table>"
114
+ assert Govspeak::HtmlValidator.new(html).valid?, 'Tables with no <tbody> and \n are valid'
115
+ end
111
116
  end
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.8.2
4
+ version: 7.0.0
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: 2022-03-29 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 2.3.0
95
+ version: 2.3.1
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 2.3.0
102
+ version: 2.3.1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: nokogiri
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -190,14 +190,14 @@ dependencies:
190
190
  requirements:
191
191
  - - '='
192
192
  - !ruby/object:Gem::Version
193
- version: 4.3.0
193
+ version: 4.6.0
194
194
  type: :development
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - '='
199
199
  - !ruby/object:Gem::Version
200
- version: 4.3.0
200
+ version: 4.6.0
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: simplecov
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -327,29 +327,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
327
  - !ruby/object:Gem::Version
328
328
  version: '0'
329
329
  requirements: []
330
- rubygems_version: 3.3.10
330
+ rubygems_version: 3.3.20
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Markup language for single domain
334
334
  test_files:
335
- - test/govspeak_test_helper.rb
336
- - test/blockquote_extra_quote_remover_test.rb
337
- - test/govspeak_link_extractor_test.rb
338
- - test/govspeak_images_test.rb
339
- - test/govspeak_link_test.rb
340
- - test/govspeak_extract_contact_content_ids_test.rb
341
335
  - test/govspeak_footnote_test.rb
342
- - test/presenters/h_card_presenter_test.rb
343
- - test/govspeak_attachments_inline_test.rb
344
- - test/govspeak_structured_headers_test.rb
345
- - test/test_helper.rb
336
+ - test/govspeak_attachments_image_test.rb
346
337
  - test/govspeak_button_test.rb
347
- - test/govspeak_attachment_test.rb
338
+ - test/blockquote_extra_quote_remover_test.rb
339
+ - test/test_helper.rb
340
+ - test/presenters/h_card_presenter_test.rb
348
341
  - test/html_sanitizer_test.rb
349
- - test/govspeak_contacts_test.rb
350
- - test/govspeak_attachments_image_test.rb
351
- - test/govspeak_images_bang_test.rb
342
+ - test/govspeak_structured_headers_test.rb
352
343
  - test/govspeak_test.rb
353
- - test/govspeak_table_with_headers_test.rb
344
+ - test/govspeak_test_helper.rb
345
+ - test/govspeak_link_test.rb
346
+ - test/govspeak_contacts_test.rb
347
+ - test/govspeak_extract_contact_content_ids_test.rb
354
348
  - test/html_validator_test.rb
349
+ - test/govspeak_link_extractor_test.rb
350
+ - test/govspeak_images_test.rb
355
351
  - test/govspeak_attachment_link_test.rb
352
+ - test/govspeak_attachments_inline_test.rb
353
+ - test/govspeak_attachment_test.rb
354
+ - test/govspeak_table_with_headers_test.rb
355
+ - test/govspeak_images_bang_test.rb