govspeak 6.5.6 → 6.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +2 -2
- data/lib/govspeak.rb +4 -1
- data/lib/govspeak/post_processor.rb +11 -0
- data/lib/govspeak/version.rb +1 -1
- data/lib/kramdown/parser/govuk.rb +1 -1
- data/test/govspeak_footnote_test.rb +46 -0
- data/test/govspeak_test.rb +19 -0
- metadata +29 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a45a14e5a726d918753171dc957cc1ed29e50d4505685ff19271da6cad41945d
|
4
|
+
data.tar.gz: 27d874bc05f80a2c37edae5010a326b426cbcf1663d5bfcc1bedc9d6852e1e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a01955112fab442c130f71c93e4c2a743c1c9d7a16797d5a2ef406bc7ad591f8380b90f03574d373cf8a519d40e4828b880a9a45d1e36b8c5128f423ac1e20f
|
7
|
+
data.tar.gz: 7ae23223d912b5753eefc4568190fd74e36968a6697e6ef5eeefeff65d88d63f0ec763122b716a4a6179b1c188121c349bb8f9fb6c74ccd346906084cdf7e184
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## 6.5.11
|
2
|
+
|
3
|
+
* Fix issue rendering $CTA blocks before $C (PR#202)
|
4
|
+
|
5
|
+
## 6.5.10
|
6
|
+
|
7
|
+
* Be optimistic in versions of govuk_publishing_components and i18n allowed (PR#200)
|
8
|
+
|
9
|
+
## 6.5.9
|
10
|
+
|
11
|
+
* Adjust footnote markup to accommodate multiple references (PR#198)
|
12
|
+
|
13
|
+
## 6.5.8
|
14
|
+
|
15
|
+
* Customise footnote markup for accessibility (PR#192)
|
16
|
+
|
17
|
+
## 6.5.7
|
18
|
+
|
19
|
+
* Update GOV.UK Publishing components to version to 23.0.0 or greater
|
20
|
+
|
1
21
|
## 6.5.6
|
2
22
|
|
3
23
|
* Update Kramdown version to 2.3.0 or greater
|
data/README.md
CHANGED
@@ -65,7 +65,7 @@ creates an example box
|
|
65
65
|
|
66
66
|
## Highlights
|
67
67
|
|
68
|
-
### Advisory
|
68
|
+
### Advisory (DEPRECATED: marked for removal. Use 'Information callouts' instead.)
|
69
69
|
|
70
70
|
@This is a very important message or warning@
|
71
71
|
|
@@ -77,7 +77,7 @@ highlights the enclosed text in yellow
|
|
77
77
|
</h3>
|
78
78
|
```
|
79
79
|
|
80
|
-
### Answer
|
80
|
+
### Answer (DEPRECATED: marked for removal)
|
81
81
|
|
82
82
|
{::highlight-answer}
|
83
83
|
The VAT rate is *20%*
|
data/lib/govspeak.rb
CHANGED
@@ -272,6 +272,10 @@ module Govspeak
|
|
272
272
|
lines.join
|
273
273
|
end
|
274
274
|
|
275
|
+
# More specific tags must be defined first. Those defined earlier have a
|
276
|
+
# higher precedence for being matched. For example $CTA must be defined
|
277
|
+
# before $C otherwise the first ($C)TA fill be matched to a contact tag.
|
278
|
+
wrap_with_div("call-to-action", "$CTA", Govspeak::Document)
|
275
279
|
wrap_with_div("summary", "$!")
|
276
280
|
wrap_with_div("form-download", "$D")
|
277
281
|
wrap_with_div("contact", "$C")
|
@@ -279,7 +283,6 @@ module Govspeak
|
|
279
283
|
wrap_with_div("information", "$I", Govspeak::Document)
|
280
284
|
wrap_with_div("additional-information", "$AI")
|
281
285
|
wrap_with_div("example", "$E", Govspeak::Document)
|
282
|
-
wrap_with_div("call-to-action", "$CTA", Govspeak::Document)
|
283
286
|
|
284
287
|
extension("address", surrounded_by("$A")) do |body|
|
285
288
|
%(\n<div class="address"><div class="adr org fn"><p>\n#{body.sub("\n", '').gsub("\n", '<br />')}\n</p></div></div>\n)
|
@@ -120,6 +120,17 @@ module Govspeak
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
extension("use custom footnotes") do |document|
|
124
|
+
document.css("a.footnote").map do |el|
|
125
|
+
footnote_number = el[:href].gsub(/\D/, "")
|
126
|
+
el.content = "[footnote #{footnote_number}]"
|
127
|
+
end
|
128
|
+
document.css("[role='doc-backlink']").map do |el|
|
129
|
+
backlink_number = " " + el.css("sup")[0].content if el.css("sup")[0].present?
|
130
|
+
el["aria-label"] = "go to where this is referenced#{backlink_number}"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
123
134
|
attr_reader :input, :govspeak_document
|
124
135
|
|
125
136
|
def initialize(html, govspeak_document)
|
data/lib/govspeak/version.rb
CHANGED
@@ -35,7 +35,7 @@ module Kramdown
|
|
35
35
|
unless host.nil? || @document_domains.compact.include?(host)
|
36
36
|
element.attr["rel"] = "external"
|
37
37
|
end
|
38
|
-
rescue Addressable::URI::InvalidURIError
|
38
|
+
rescue Addressable::URI::InvalidURIError
|
39
39
|
# it's safe to ignore these very *specific* exceptions
|
40
40
|
end
|
41
41
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "govspeak_test_helper"
|
3
|
+
|
4
|
+
class GovspeakFootnoteTest < Minitest::Test
|
5
|
+
include GovspeakTestHelper
|
6
|
+
|
7
|
+
test_given_govspeak "
|
8
|
+
Footnotes can be added[^1].
|
9
|
+
|
10
|
+
[^1]: And then later defined.
|
11
|
+
|
12
|
+
Footnotes can be added too[^2].
|
13
|
+
|
14
|
+
[^2]: And then later defined too.
|
15
|
+
|
16
|
+
This footnote has a reference number[^3].
|
17
|
+
|
18
|
+
And this footnote has the same reference number[^3].
|
19
|
+
|
20
|
+
[^3]: And then they both point here." do
|
21
|
+
assert_html_output(
|
22
|
+
%(
|
23
|
+
<p>Footnotes can be added<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote">[footnote 1]</a></sup>.</p>
|
24
|
+
|
25
|
+
<p>Footnotes can be added too<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote">[footnote 2]</a></sup>.</p>
|
26
|
+
|
27
|
+
<p>This footnote has a reference number<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote">[footnote 3]</a></sup>.</p>
|
28
|
+
|
29
|
+
<p>And this footnote has the same reference number<sup id="fnref:3:1" role="doc-noteref"><a href="#fn:3" class="footnote">[footnote 3]</a></sup>.</p>
|
30
|
+
|
31
|
+
<div class="footnotes" role="doc-endnotes">
|
32
|
+
<ol>
|
33
|
+
<li id="fn:1" role="doc-endnote">
|
34
|
+
<p>And then later defined. <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
|
35
|
+
</li>
|
36
|
+
<li id="fn:2" role="doc-endnote">
|
37
|
+
<p>And then later defined too. <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
|
38
|
+
</li>
|
39
|
+
<li id="fn:3" role="doc-endnote">
|
40
|
+
<p>And then they both point here. <a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a> <a href="#fnref:3:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced 2">↩<sup>2</sup></a></p>
|
41
|
+
</li>
|
42
|
+
</ol>
|
43
|
+
</div>),
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
data/test/govspeak_test.rb
CHANGED
@@ -440,6 +440,25 @@ Teston
|
|
440
440
|
</div>)
|
441
441
|
end
|
442
442
|
|
443
|
+
test_given_govspeak "
|
444
|
+
$CTA
|
445
|
+
Click here to start the tool
|
446
|
+
$CTA
|
447
|
+
|
448
|
+
$C
|
449
|
+
Here is some text
|
450
|
+
$C
|
451
|
+
" do
|
452
|
+
assert_html_output %(
|
453
|
+
<div class="call-to-action">
|
454
|
+
<p>Click here to start the tool</p>
|
455
|
+
</div>
|
456
|
+
|
457
|
+
<div class="contact">
|
458
|
+
<p>Here is some text</p>
|
459
|
+
</div>)
|
460
|
+
end
|
461
|
+
|
443
462
|
test_given_govspeak "
|
444
463
|
[internal link](http://www.not-external.com)
|
445
464
|
|
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.
|
4
|
+
version: 6.5.11
|
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: 2020-
|
11
|
+
date: 2020-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -54,16 +54,16 @@ dependencies:
|
|
54
54
|
name: govuk_publishing_components
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '23'
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '23'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: htmlentities
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,14 +82,14 @@ dependencies:
|
|
82
82
|
name: i18n
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0.7'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0.7'
|
95
95
|
- !ruby/object:Gem::Dependency
|
@@ -174,14 +174,14 @@ dependencies:
|
|
174
174
|
requirements:
|
175
175
|
- - "~>"
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
version: 5.14
|
177
|
+
version: '5.14'
|
178
178
|
type: :development
|
179
179
|
prerelease: false
|
180
180
|
version_requirements: !ruby/object:Gem::Requirement
|
181
181
|
requirements:
|
182
182
|
- - "~>"
|
183
183
|
- !ruby/object:Gem::Version
|
184
|
-
version: 5.14
|
184
|
+
version: '5.14'
|
185
185
|
- !ruby/object:Gem::Dependency
|
186
186
|
name: pry-byebug
|
187
187
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,14 +216,14 @@ dependencies:
|
|
216
216
|
requirements:
|
217
217
|
- - "~>"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: 3.
|
219
|
+
version: 3.17.1
|
220
220
|
type: :development
|
221
221
|
prerelease: false
|
222
222
|
version_requirements: !ruby/object:Gem::Requirement
|
223
223
|
requirements:
|
224
224
|
- - "~>"
|
225
225
|
- !ruby/object:Gem::Version
|
226
|
-
version: 3.
|
226
|
+
version: 3.17.1
|
227
227
|
- !ruby/object:Gem::Dependency
|
228
228
|
name: simplecov
|
229
229
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,6 +336,7 @@ files:
|
|
336
336
|
- test/govspeak_button_test.rb
|
337
337
|
- test/govspeak_contacts_test.rb
|
338
338
|
- test/govspeak_extract_contact_content_ids_test.rb
|
339
|
+
- test/govspeak_footnote_test.rb
|
339
340
|
- test/govspeak_images_bang_test.rb
|
340
341
|
- test/govspeak_images_test.rb
|
341
342
|
- test/govspeak_link_extractor_test.rb
|
@@ -366,28 +367,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
366
367
|
- !ruby/object:Gem::Version
|
367
368
|
version: '0'
|
368
369
|
requirements: []
|
369
|
-
rubygems_version: 3.
|
370
|
+
rubygems_version: 3.1.4
|
370
371
|
signing_key:
|
371
372
|
specification_version: 4
|
372
373
|
summary: Markup language for single domain
|
373
374
|
test_files:
|
374
|
-
- test/govspeak_link_extractor_test.rb
|
375
|
-
- test/govspeak_structured_headers_test.rb
|
376
375
|
- test/govspeak_images_bang_test.rb
|
376
|
+
- test/govspeak_attachment_test.rb
|
377
|
+
- test/govspeak_link_extractor_test.rb
|
378
|
+
- test/govspeak_attachments_inline_test.rb
|
377
379
|
- test/govspeak_button_test.rb
|
378
|
-
- test/
|
380
|
+
- test/govspeak_structured_headers_test.rb
|
381
|
+
- test/govspeak_attachments_image_test.rb
|
382
|
+
- test/govspeak_attachment_link_test.rb
|
379
383
|
- test/govspeak_extract_contact_content_ids_test.rb
|
384
|
+
- test/presenters/h_card_presenter_test.rb
|
385
|
+
- test/govspeak_test.rb
|
386
|
+
- test/html_sanitizer_test.rb
|
387
|
+
- test/govspeak_footnote_test.rb
|
380
388
|
- test/blockquote_extra_quote_remover_test.rb
|
381
|
-
- test/govspeak_test_helper.rb
|
382
|
-
- test/govspeak_link_test.rb
|
383
|
-
- test/govspeak_images_test.rb
|
384
|
-
- test/govspeak_attachment_link_test.rb
|
385
|
-
- test/govspeak_contacts_test.rb
|
386
389
|
- test/test_helper.rb
|
390
|
+
- test/govspeak_table_with_headers_test.rb
|
391
|
+
- test/govspeak_images_test.rb
|
392
|
+
- test/govspeak_link_test.rb
|
387
393
|
- test/html_validator_test.rb
|
388
|
-
- test/
|
389
|
-
- test/
|
390
|
-
- test/govspeak_test.rb
|
391
|
-
- test/govspeak_attachment_test.rb
|
392
|
-
- test/govspeak_attachments_image_test.rb
|
393
|
-
- test/presenters/h_card_presenter_test.rb
|
394
|
+
- test/govspeak_contacts_test.rb
|
395
|
+
- test/govspeak_test_helper.rb
|