govspeak 8.0.0 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b77227c0a115225f51dc35e8dc7e177212aae5b215400f4b0384bd99fdf04a2
4
- data.tar.gz: dcca6a433304ceb7d1cf1281ac0d16e738e7e7fb3479551ec69c0fe2e2dfa2ad
3
+ metadata.gz: 0122207e54ee34f5d1e7b8d42f893cc98c4305b41c3d6ce26ad9e7b17d3f4a6e
4
+ data.tar.gz: c643149ccfd275d1ba819c55b2db5928f3a8e9f3af83268193394f2c34013cbf
5
5
  SHA512:
6
- metadata.gz: f8302fc09c9160bc5ea3d8cc33af663e106ba36287d10105272c03467e5aed41c5fb7f5e76da934f93c121b79687287f1c9edc92dab2aebca486c256cd4fa76f
7
- data.tar.gz: fc0c093d411ccb309172828f8d21671d8e31bc7458a2285b1fb7a0ba22a63a598e27397b78e52af93e756eb52353e7c53ec1c2b11e16d0b42b6e26b5a981c613
6
+ metadata.gz: 03fd251aac19ee15e22a6e8bee2486a5e0686150ad55784939fba4818e016de2515ca9e94a5c790ff34734654174ce4e9883973a457a5ba18cd1d37c9bfef292
7
+ data.tar.gz: 94804d743f6269f40fc3d27f8e006a2879aa9181f8af11268445a4e4d9e96d5d9f7b989640a3cfae3b27dd667afcd46f4d3917f91789211662766a615497e867
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 8.1.0
2
+
3
+ * Allow attachment links wtihin numbered lists ([#283](https://github.com/alphagov/govspeak/pull/283))
4
+
5
+ ## 8.0.1
6
+
7
+ * Add margin-bottom to embedded attachments ([#281](https://github.com/alphagov/govspeak/pull/281))
8
+
1
9
  ## 8.0.0
2
10
 
3
11
  * BREAKING: HTML style attribute and style element, which were never supposed to be available, are forbidden. [#279](https://github.com/alphagov/govspeak/pull/279)
@@ -59,6 +59,7 @@ module Govspeak
59
59
  attachment_html = GovukPublishingComponents.render(
60
60
  "govuk_publishing_components/components/attachment",
61
61
  attachment: attachment,
62
+ margin_bottom: 6,
62
63
  locale: govspeak_document.locale,
63
64
  )
64
65
  el.swap(attachment_html)
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.0.0".freeze
2
+ VERSION = "8.1.0".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -380,7 +380,7 @@ module Govspeak
380
380
 
381
381
  extension("numbered list", /^[ \t]*((s\d+\.\s.*(?:\n|$))+)/) do |body|
382
382
  body.gsub!(/s(\d+)\.\s(.*)(?:\n|$)/) do
383
- "<li>#{Govspeak::Document.new(Regexp.last_match(2).strip).to_html}</li>\n"
383
+ "<li>#{Govspeak::Document.new(Regexp.last_match(2).strip, attachments: attachments).to_html}</li>\n"
384
384
  end
385
385
  %(<ol class="steps">\n#{body}</ol>)
386
386
  end
@@ -46,4 +46,28 @@ class GovspeakAttachmentLinkTest < Minitest::Test
46
46
  rendered = render_govspeak("[AttachmentLink: This is the name of my &%$@€? attachment]", [attachment])
47
47
  assert_match(/Attachment Title/, rendered)
48
48
  end
49
+
50
+ test "renders an attachment link inside a numbered list" do
51
+ attachment = {
52
+ id: "attachment.pdf",
53
+ url: "http://example.com/attachment.pdf",
54
+ title: "Attachment Title",
55
+ }
56
+
57
+ rendered = render_govspeak("s1. First item with [AttachmentLink: attachment.pdf]\ns2. Second item without attachment", [attachment])
58
+
59
+ expected_output = <<~TEXT
60
+ <ol class="steps">
61
+ <li>
62
+ <p>First item with <span class="gem-c-attachment-link">
63
+ <a class="govuk-link" href="http://example.com/attachment.pdf">Attachment Title</a> </span></p>
64
+ </li>
65
+ <li>
66
+ <p>Second item without attachment</p>
67
+ </li>
68
+ </ol>
69
+ TEXT
70
+
71
+ assert_equal(expected_output, rendered)
72
+ end
49
73
  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: 8.0.0
4
+ version: 8.1.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: 2023-07-07 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -190,14 +190,14 @@ dependencies:
190
190
  requirements:
191
191
  - - '='
192
192
  - !ruby/object:Gem::Version
193
- version: 4.11.0
193
+ version: 4.12.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.11.0
200
+ version: 4.12.0
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: simplecov
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -327,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
327
  - !ruby/object:Gem::Version
328
328
  version: '0'
329
329
  requirements: []
330
- rubygems_version: 3.4.15
330
+ rubygems_version: 3.4.17
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Markup language for single domain