govspeak 8.6.1 → 8.7.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: 31ed89ca764a8b2359a7aa8036645c2fb8e154f8e0138d0c017ec20e5c2a57e2
4
- data.tar.gz: b67f61d7c24ceaa965404be5fca32f4b3192e213f406cab3a4c86682d7a31270
3
+ metadata.gz: 787fca08ab2b717cbb7dc537088c0e3472da2e932b5949ffca776c9e7d9f11a4
4
+ data.tar.gz: ef1324298dc213f3443e032956d1d22051acca145aa6320e6f48facdcb7a0491
5
5
  SHA512:
6
- metadata.gz: 8c3a7c1df3ac4b093c70373d11e8bcc5eff921f5d3216cbcd8e137296cbf1433d1fb4786b272f8a9457f3839f18d456fdc87ddab1167561d8835f4c8fcd34485
7
- data.tar.gz: 42a1a2f511666f015f6d5e7b209887822617209f9bdc74e63a5079e9252a302b65003abfe40a144556e70d483c5cef048a50849a54899f2ac4c206876232c204
6
+ metadata.gz: 3c385cea8602c6470794c5411217f9fb95ef3d2deefac2eafbf054722e5ea7b9d524334535f8a7c25370704d3bd4e177f5c5ab69c3059158772ea76de99a1549
7
+ data.tar.gz: 91f5aa7f012367a4ea7c1f889955d6be92d91aae0ef96ccfb4e027d765eedf7d09e0e73a421434edac853386042d68cb0e36657cf8d5915d87bfa9083359e9c3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- # 8.6.1
1
+ ## 8.7.0
2
+
3
+ * Allow data attributes in spans ([#364](https://github.com/alphagov/govspeak/pull/364))
4
+
5
+ ## 8.6.1
2
6
 
3
7
  * Update dependencies
4
8
 
@@ -56,6 +56,7 @@ class Govspeak::HtmlSanitizer
56
56
  "svg" => %w[xmlns width height viewbox focusable],
57
57
  "path" => %w[fill d],
58
58
  "div" => [:data],
59
+ "span" => [:data],
59
60
  # The style attributes are permitted here just for the ones Kramdown for table alignment
60
61
  # we replace them in a post processor.
61
62
  "th" => Sanitize::Config::RELAXED[:attributes]["th"] + %w[style],
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.6.1".freeze
2
+ VERSION = "8.7.0".freeze
3
3
  end
@@ -63,6 +63,15 @@ class HtmlSanitizerTest < Minitest::Test
63
63
  )
64
64
  end
65
65
 
66
+ test "allow data attributes on spans" do
67
+ html = "<span data-module='toggle' data-ecommerce-path='/' data-track-category='someSpan'>Test Span</span>"
68
+
69
+ assert_equal(
70
+ "<span data-module=\"toggle\" data-ecommerce-path=\"/\" data-track-category=\"someSpan\">Test Span</span>",
71
+ Govspeak::HtmlSanitizer.new(html).sanitize,
72
+ )
73
+ end
74
+
66
75
  test "allows images on whitelisted domains" do
67
76
  html = "<img src='http://allowed.com/image.jgp'>"
68
77
  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: 8.6.1
4
+ version: 8.7.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: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview