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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/govspeak/version.rb +1 -1
- data/lib/govspeak.rb +1 -1
- data/test/govspeak_attachment_link_test.rb +24 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0122207e54ee34f5d1e7b8d42f893cc98c4305b41c3d6ce26ad9e7b17d3f4a6e
|
4
|
+
data.tar.gz: c643149ccfd275d1ba819c55b2db5928f3a8e9f3af83268193394f2c34013cbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03fd251aac19ee15e22a6e8bee2486a5e0686150ad55784939fba4818e016de2515ca9e94a5c790ff34734654174ce4e9883973a457a5ba18cd1d37c9bfef292
|
7
|
+
data.tar.gz: 94804d743f6269f40fc3d27f8e006a2879aa9181f8af11268445a4e4d9e96d5d9f7b989640a3cfae3b27dd667afcd46f4d3917f91789211662766a615497e867
|
data/CHANGELOG.md
CHANGED
data/lib/govspeak/version.rb
CHANGED
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
|
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-
|
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.
|
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.
|
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.
|
330
|
+
rubygems_version: 3.4.17
|
331
331
|
signing_key:
|
332
332
|
specification_version: 4
|
333
333
|
summary: Markup language for single domain
|