govspeak 8.0.1 → 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: 5e8536931b5ec2ad23bada1b0cc94dad05779dc3d9565bc8dbd6449a6161a7a2
4
- data.tar.gz: a67ea45edba261236ce6974564a3704218e69dec860fea1e782d8d20af3922a4
3
+ metadata.gz: 0122207e54ee34f5d1e7b8d42f893cc98c4305b41c3d6ce26ad9e7b17d3f4a6e
4
+ data.tar.gz: c643149ccfd275d1ba819c55b2db5928f3a8e9f3af83268193394f2c34013cbf
5
5
  SHA512:
6
- metadata.gz: b66013937116e786786f240b72c61dbbbcc1e09af0fa5bfdc4b83aeef73133eb46078565dfa5766d252a9558d0b10b2322673ca0720deef7fd69414ca2ad158c
7
- data.tar.gz: dac0b4479fc4691e41356104409a93ec0802a698107c20ab17ab524042d6571d7da606111aa4b4635c4855ade81369fbfcd7db5dbb080205f3502b7423b6bfc5
6
+ metadata.gz: 03fd251aac19ee15e22a6e8bee2486a5e0686150ad55784939fba4818e016de2515ca9e94a5c790ff34734654174ce4e9883973a457a5ba18cd1d37c9bfef292
7
+ data.tar.gz: 94804d743f6269f40fc3d27f8e006a2879aa9181f8af11268445a4e4d9e96d5d9f7b989640a3cfae3b27dd667afcd46f4d3917f91789211662766a615497e867
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 8.1.0
2
+
3
+ * Allow attachment links wtihin numbered lists ([#283](https://github.com/alphagov/govspeak/pull/283))
4
+
1
5
  ## 8.0.1
2
6
 
3
7
  * Add margin-bottom to embedded attachments ([#281](https://github.com/alphagov/govspeak/pull/281))
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.0.1".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.1
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-12 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.16
330
+ rubygems_version: 3.4.17
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Markup language for single domain