govspeak 6.5.5 → 6.5.10
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/lib/govspeak.rb +3 -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/blockquote_extra_quote_remover_test.rb +1 -1
- data/test/govspeak_footnote_test.rb +46 -0
- metadata +37 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e54143d6d1df165694cae9c5ffeef35267bf25fb91d999e9e8b46dd0b76877f
|
4
|
+
data.tar.gz: a01f9c44fec457bc296fd217c51b4e4b332728895c0ade749b26190ff74528c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42dbc03399dde648c4a89f2237ba0e7320d066d20cd8ce8d0b05caee2ef5bb69af7cbfc1aebe60a1577a04fc8fc63769fe5f4b284232fea317f45775599694bd
|
7
|
+
data.tar.gz: b96148ecb4e143bab160517d4c997782a946f3ba75a8ce045ad2ce0893a578aa8d83df275e7239d0bb0a335bf3486e386d0c901a29328eddd26fd39b7c6b9e7c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## 6.5.10
|
2
|
+
|
3
|
+
* Be optimistic in versions of govuk_publishing_components and i18n allowed (PR#200)
|
4
|
+
|
5
|
+
## 6.5.9
|
6
|
+
|
7
|
+
* Adjust footnote markup to accommodate multiple references (PR#198)
|
8
|
+
|
9
|
+
## 6.5.8
|
10
|
+
|
11
|
+
* Customise footnote markup for accessibility (PR#192)
|
12
|
+
|
13
|
+
## 6.5.7
|
14
|
+
|
15
|
+
* Update GOV.UK Publishing components to version to 23.0.0 or greater
|
16
|
+
|
17
|
+
## 6.5.6
|
18
|
+
|
19
|
+
* Update Kramdown version to 2.3.0 or greater
|
20
|
+
|
1
21
|
## 6.5.5
|
2
22
|
|
3
23
|
* Prevent links in table headers being stripped (PR#187)
|
data/lib/govspeak.rb
CHANGED
@@ -57,7 +57,9 @@ module Govspeak
|
|
57
57
|
@links = Array.wrap(options.delete(:links))
|
58
58
|
@contacts = Array.wrap(options.delete(:contacts))
|
59
59
|
@locale = options.fetch(:locale, "en")
|
60
|
-
@options = { input: PARSER_CLASS_NAME,
|
60
|
+
@options = { input: PARSER_CLASS_NAME,
|
61
|
+
sanitize: true,
|
62
|
+
syntax_highlighter: nil }.merge(options)
|
61
63
|
@options[:entity_output] = :symbolic
|
62
64
|
end
|
63
65
|
|
@@ -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
|
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.10
|
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-11-10 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,30 +82,30 @@ 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
|
96
96
|
name: kramdown
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- - "
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: 2.3.0
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- - "
|
106
|
+
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: 2.3.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: nokogiri
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|
@@ -200,30 +200,30 @@ dependencies:
|
|
200
200
|
name: rake
|
201
201
|
requirement: !ruby/object:Gem::Requirement
|
202
202
|
requirements:
|
203
|
-
- - "
|
203
|
+
- - ">="
|
204
204
|
- !ruby/object:Gem::Version
|
205
|
-
version: 0
|
205
|
+
version: '0'
|
206
206
|
type: :development
|
207
207
|
prerelease: false
|
208
208
|
version_requirements: !ruby/object:Gem::Requirement
|
209
209
|
requirements:
|
210
|
-
- - "
|
210
|
+
- - ">="
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version: 0
|
212
|
+
version: '0'
|
213
213
|
- !ruby/object:Gem::Dependency
|
214
214
|
name: rubocop-govuk
|
215
215
|
requirement: !ruby/object:Gem::Requirement
|
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/blockquote_extra_quote_remover_test.rb
|
375
|
-
- test/govspeak_test_helper.rb
|
376
|
-
- test/govspeak_structured_headers_test.rb
|
377
|
-
- test/govspeak_attachment_link_test.rb
|
378
|
-
- test/govspeak_attachments_image_test.rb
|
379
|
-
- test/test_helper.rb
|
380
|
-
- test/govspeak_attachments_inline_test.rb
|
381
|
-
- test/html_sanitizer_test.rb
|
382
|
-
- test/govspeak_button_test.rb
|
383
375
|
- test/govspeak_images_bang_test.rb
|
384
|
-
- test/govspeak_images_test.rb
|
385
|
-
- test/html_validator_test.rb
|
386
376
|
- test/govspeak_attachment_test.rb
|
377
|
+
- test/govspeak_link_extractor_test.rb
|
378
|
+
- test/govspeak_attachments_inline_test.rb
|
379
|
+
- test/govspeak_button_test.rb
|
380
|
+
- test/govspeak_structured_headers_test.rb
|
381
|
+
- test/govspeak_attachments_image_test.rb
|
382
|
+
- test/govspeak_attachment_link_test.rb
|
387
383
|
- test/govspeak_extract_contact_content_ids_test.rb
|
384
|
+
- test/presenters/h_card_presenter_test.rb
|
388
385
|
- test/govspeak_test.rb
|
389
|
-
- test/
|
386
|
+
- test/html_sanitizer_test.rb
|
387
|
+
- test/govspeak_footnote_test.rb
|
388
|
+
- test/blockquote_extra_quote_remover_test.rb
|
389
|
+
- test/test_helper.rb
|
390
|
+
- test/govspeak_table_with_headers_test.rb
|
391
|
+
- test/govspeak_images_test.rb
|
390
392
|
- test/govspeak_link_test.rb
|
393
|
+
- test/html_validator_test.rb
|
391
394
|
- test/govspeak_contacts_test.rb
|
392
|
-
- test/
|
393
|
-
- test/govspeak_table_with_headers_test.rb
|
395
|
+
- test/govspeak_test_helper.rb
|