govspeak 6.5.1 → 6.5.2

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: d1153c71bd7cd224750aa162c1ea63c89a902309cd08238a888d07a60f079d89
4
- data.tar.gz: a7efca4529a1c6017224a77965e45994d30eba3a3e05f6d209dadff85a516cd9
3
+ metadata.gz: eaa4aea2a5ad557426d34d0d17ef75ae5d538862cc293ad6d6403a663797667f
4
+ data.tar.gz: 3950f3fdd4bc77f5b00ceb5bede0ffca988f2c910739ee0906fa49431be95ae0
5
5
  SHA512:
6
- metadata.gz: 33209bc51e340ccc5a2a0dc3b43f887eddbd464b687232fb4a17c6c34ae0a3097321f7f51da3ba17762e6ad1307424204872c3374dfa99eeb0100992641f4911
7
- data.tar.gz: ab00d13be257f7730b4b7c2a858a9a9eba3802148dfc851f60fdf91eb65acdb80510a5c67a1e599f2cedbf945502cf29d6567526d695872118025ebb384318f9
6
+ metadata.gz: 90a7401f005a80646a8390723c04b4e2754d39b42559189d70aab1c1214223b62e805f6cb640b4c1acc3dd37401fe059849884af56f533295fa4b24af760f7f8
7
+ data.tar.gz: 18f85c38c237de6fc51b62b15c69b7bf236e0957c218e8ee246ba7fd572102231b129f6728461b5b9e57f2884107a0c419327e8ce522e8c70fe38fd3c4b1f066
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.5.2
2
+
3
+ * Allow `data` attributes on `div` tags (PR#173)
4
+
1
5
  ## 6.5.1
2
6
  * Change unicode testing characters after external gem change
3
7
  * Move from govuk-lint to rubocop-govuk
@@ -55,6 +55,7 @@ class Govspeak::HtmlSanitizer
55
55
  attributes: {
56
56
  :all => Sanitize::Config::RELAXED[:attributes][:all] + %w[role aria-label],
57
57
  "a" => Sanitize::Config::RELAXED[:attributes]["a"] + [:data],
58
+ "div" => [:data],
58
59
  "th" => Sanitize::Config::RELAXED[:attributes]["th"] + %w[style],
59
60
  "td" => Sanitize::Config::RELAXED[:attributes]["td"] + %w[style],
60
61
  "govspeak-embed-attachment" => %w[content-id],
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "6.5.1".freeze
2
+ VERSION = "6.5.2".freeze
3
3
  end
@@ -35,11 +35,11 @@ module Kramdown
35
35
  unless host.nil? || @document_domains.compact.include?(host)
36
36
  element.attr["rel"] = "external"
37
37
  end
38
- # rubocop:disable Lint/HandleExceptions
38
+ # rubocop:disable Lint/SuppressedException
39
39
  rescue Addressable::URI::InvalidURIError
40
40
  # it's safe to ignore these very *specific* exceptions
41
41
  end
42
- # rubocop:enable Lint/HandleExceptions
42
+ # rubocop:enable Lint/SuppressedException
43
43
  end
44
44
  super
45
45
  end
@@ -44,6 +44,15 @@ class HtmlSanitizerTest < Minitest::Test
44
44
  )
45
45
  end
46
46
 
47
+ test "allow data attributes on divs" do
48
+ html = "<div data-module='toggle' data-ecommerce-path='/' data-track-category='someDiv'>Test Div</div>"
49
+
50
+ assert_equal(
51
+ "<div data-module=\"toggle\" data-ecommerce-path=\"/\" data-track-category=\"someDiv\">Test Div</div>",
52
+ Govspeak::HtmlSanitizer.new(html).sanitize,
53
+ )
54
+ end
55
+
47
56
  test "allows images on whitelisted domains" do
48
57
  html = "<img src='http://allowed.com/image.jgp'>"
49
58
  sanitized_html = Govspeak::HtmlSanitizer.new(html, allowed_image_hosts: ["allowed.com"]).sanitize
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.1
4
+ version: 6.5.2
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: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -210,14 +210,14 @@ dependencies:
210
210
  requirements:
211
211
  - - "~>"
212
212
  - !ruby/object:Gem::Version
213
- version: '1'
213
+ version: '2'
214
214
  type: :development
215
215
  prerelease: false
216
216
  version_requirements: !ruby/object:Gem::Requirement
217
217
  requirements:
218
218
  - - "~>"
219
219
  - !ruby/object:Gem::Version
220
- version: '1'
220
+ version: '2'
221
221
  - !ruby/object:Gem::Dependency
222
222
  name: simplecov
223
223
  requirement: !ruby/object:Gem::Requirement
@@ -365,23 +365,23 @@ signing_key:
365
365
  specification_version: 4
366
366
  summary: Markup language for single domain
367
367
  test_files:
368
- - test/govspeak_attachments_inline_test.rb
369
- - test/govspeak_attachment_test.rb
370
- - test/govspeak_attachment_link_test.rb
371
- - test/govspeak_images_test.rb
368
+ - test/govspeak_link_extractor_test.rb
369
+ - test/govspeak_structured_headers_test.rb
370
+ - test/govspeak_images_bang_test.rb
371
+ - test/govspeak_button_test.rb
372
372
  - test/govspeak_table_with_headers_test.rb
373
+ - test/govspeak_extract_contact_content_ids_test.rb
374
+ - test/blockquote_extra_quote_remover_test.rb
375
+ - test/govspeak_test_helper.rb
373
376
  - test/govspeak_link_test.rb
374
- - test/govspeak_images_bang_test.rb
375
- - test/govspeak_link_extractor_test.rb
377
+ - test/govspeak_images_test.rb
378
+ - test/govspeak_attachment_link_test.rb
376
379
  - test/govspeak_contacts_test.rb
377
380
  - test/test_helper.rb
381
+ - test/html_validator_test.rb
382
+ - test/html_sanitizer_test.rb
383
+ - test/govspeak_attachments_inline_test.rb
378
384
  - test/govspeak_test.rb
385
+ - test/govspeak_attachment_test.rb
379
386
  - test/govspeak_attachments_image_test.rb
380
- - test/html_validator_test.rb
381
- - test/govspeak_structured_headers_test.rb
382
- - test/govspeak_extract_contact_content_ids_test.rb
383
- - test/blockquote_extra_quote_remover_test.rb
384
387
  - test/presenters/h_card_presenter_test.rb
385
- - test/govspeak_button_test.rb
386
- - test/govspeak_test_helper.rb
387
- - test/html_sanitizer_test.rb