govspeak 6.8.1 → 6.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5613d3c42e9347e578dd2ed9d2164c08cc81cfc70f8ade79deb56fc77069056f
4
- data.tar.gz: 1157c2a33c97ae726af931714252eaa460216f1254a47449c4db187fff197c1d
3
+ metadata.gz: a8509b4c394ef305fd80454c6c6bdb13561332bcdedc5d0292c271387a34043c
4
+ data.tar.gz: a73d8175cbea307d6b8028931bd15e9b99b97f7ae7708247cc833873622a8574
5
5
  SHA512:
6
- metadata.gz: aa8cca4a71fd2f9b029c545714ccf032ead1fe07389ce49571aa5f14093b95bd7ae05ddc2188bea959ea60ac59c042bc0b56729b8a197782291869e7e0cf947e
7
- data.tar.gz: 12dcd4d62d0b6b16a651d001145f2aaa942991c972a00720d598464633f2eb8ead57d50dc0609ed1eb6a25a328399380dac55d97aa7101cdd52483b46b6c700c
6
+ metadata.gz: ae280e29132e39a4d85f6f095bfd45cfc0da7505b7148e0b48756c4c9fccd29af2a550257a6f972837b8f1c1495f817ee61653ee069db868e66fc5a149386553
7
+ data.tar.gz: d3e0c5858ebe636a50d44bb360c68bc2bee4cad547529872c51be3f42a5630d5444ccc29e4ef5437d096ecdc43386f18c27363f9bcfbeff801a86fb3f6bbc486
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.8.2
2
+
3
+ * Fix footnote numbering [#239](https://github.com/alphagov/govspeak/pull/239)
4
+
1
5
  ## 6.8.1
2
6
 
3
7
  * Fix a bug which resulted in validation errors on 'Start Button' elements [#237](https://github.com/alphagov/govspeak/pull/237)
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "6.8.1".freeze
2
+ VERSION = "6.8.2".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -138,7 +138,7 @@ module Govspeak
138
138
  def footnote_definitions(source)
139
139
  is_legislative_list = source.scan(/\$LegislativeList.*?\[\^\d\]*.*?\$EndLegislativeList/m).size.positive?
140
140
  is_cta = source.scan(/\$CTA.*?\[\^\d\]*.*?\$CTA/m).size.positive?
141
- footnotes = source.scan(/\[\^(\d+)\]:(.*)/)
141
+ footnotes = source.scan(/^\s*\[\^(\d+)\]:(.*)/)
142
142
  @acronyms = source.scan(/(?<=\*)\[(.*)\]:(.*)/)
143
143
  if (is_legislative_list || is_cta) && footnotes.size.positive?
144
144
  list_items = footnotes.map do |footnote|
@@ -1048,6 +1048,48 @@ Teston
1048
1048
  )
1049
1049
  end
1050
1050
 
1051
+ test_given_govspeak "
1052
+ $LegislativeList
1053
+ 1. some text[^1]:
1054
+ $EndLegislativeList
1055
+ [^1]: footnote text
1056
+ " do
1057
+ assert_html_output %(
1058
+ <p>1. some text<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>:</p>
1059
+
1060
+ <div class="footnotes" role="doc-endnotes">
1061
+ <ol>
1062
+ <li id="fn:1" role="doc-endnote">
1063
+ <p>
1064
+ footnote text<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1065
+ </p>
1066
+ </li>
1067
+ </ol>
1068
+ </div>
1069
+ )
1070
+ end
1071
+
1072
+ test_given_govspeak "
1073
+ $LegislativeList
1074
+ 1. some text[^1]: extra
1075
+ $EndLegislativeList
1076
+ [^1]: footnote text
1077
+ " do
1078
+ assert_html_output %(
1079
+ <p>1. some text<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>: extra</p>
1080
+
1081
+ <div class="footnotes" role="doc-endnotes">
1082
+ <ol>
1083
+ <li id="fn:1" role="doc-endnote">
1084
+ <p>
1085
+ footnote text<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1086
+ </p>
1087
+ </li>
1088
+ </ol>
1089
+ </div>
1090
+ )
1091
+ end
1092
+
1051
1093
  # FIXME: this code is buggy and replaces abbreviations in HTML tags - removing the functionality for now
1052
1094
  # test_given_govspeak "
1053
1095
  # $LegislativeList
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.8.1
4
+ version: 6.8.2
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: 2022-03-16 00:00:00.000000000 Z
11
+ date: 2022-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -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.3.9
330
+ rubygems_version: 3.3.10
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Markup language for single domain