govspeak 8.3.0 → 8.3.1

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: 92a47d834646bd30072105c15ed418c6fbd09ad18c5469928be7d76a6cdf8d97
4
- data.tar.gz: 94a44d03aa697a24937596786e8dff07da213ad085ca39ce52394cb040c3c7d1
3
+ metadata.gz: 330ac68b36870075d83d6cae5223e28d12186d7b9435be02df50829f11d8c27e
4
+ data.tar.gz: 3d0b8d3e7b1f98d9e3c814f141319a56a8388ac114b308aba7c3945e5661bbe4
5
5
  SHA512:
6
- metadata.gz: b0e59b5d11641d737428bc419c77c749300115625442fb44b0eba026e1b3755e648a1a14ff5199c004ef18cdc72a66953f3c90feb883592dfd8e86719536068c
7
- data.tar.gz: 3ab9bb92193243b5c0b0920260c7ae23773495d3683df54197775aef23337d743edc091a6068291d744fee7010142650e3896a6735310e7456227ab7e587465d
6
+ metadata.gz: c23c1e930d96b6c67fcc9a46c3fc2b1e048d3c5cf9f741e55de28b94bb334e56a07108326cf5bc96c140764f860a0532ff38df87dbb9e04355576f93ebe7efad
7
+ data.tar.gz: ed762ebf793ee83971ddcf4a5102379b2ad0dea4adea3134c8bd818c9c15d1d03e957b2b433549bc0846525bea1fb3a19c3574eafb1ac46dc1b98f27c59009cb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 8.3.1
2
+
3
+ * Bug fixes related to block elements in call to action and legislative list components ([#293](https://github.com/alphagov/govspeak/pull/293))
4
+
1
5
  ## 8.3.0
2
6
 
3
7
  * Various bug fixes related to abbreviations in call to action and legislative list components ([#291](https://github.com/alphagov/govspeak/pull/291))
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.3.0".freeze
2
+ VERSION = "8.3.1".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -278,9 +278,7 @@ module Govspeak
278
278
 
279
279
  extension("call-to-action", surrounded_by("$CTA")) do |body|
280
280
  <<~BODY
281
- {::options parse_block_html=\"true\" /}
282
- <div class="call-to-action">#{body}</div>
283
- {::options parse_block_html=\"false\" /}
281
+ <div class="call-to-action" markdown="1">#{body}</div>
284
282
  BODY
285
283
  end
286
284
 
@@ -303,9 +301,9 @@ module Govspeak
303
301
  # The surrounding div is neccessary to control flow in `parse_block_html` and
304
302
  # maintain the same functionality as a previous version of this extension.
305
303
  <<~BODY
306
- {::options parse_block_html=\"true\" ordered_lists_disabled=\"true\" /}
307
- <div class="legislative-list-wrapper">#{body}</div>
308
- {::options parse_block_html=\"false\" ordered_lists_disabled=\"false\" /}
304
+ {::options ordered_lists_disabled=\"true\" /}
305
+ <div class="legislative-list-wrapper" markdown="1">#{body}</div>
306
+ {::options ordered_lists_disabled=\"false\" /}
309
307
  BODY
310
308
  end
311
309
 
@@ -4,13 +4,6 @@ require "govspeak_test_helper"
4
4
  class GovspeakImagesTest < Minitest::Test
5
5
  include GovspeakTestHelper
6
6
 
7
- def build_image(attrs = {})
8
- attrs[:alt_text] ||= "my alt"
9
- attrs[:url] ||= "http://example.com/image.jpg"
10
- attrs[:id] ||= "image-id"
11
- attrs
12
- end
13
-
14
7
  test "Image:image-id syntax renders an image in options[:images]" do
15
8
  given_govspeak "[Image:image-id]", images: [build_image] do
16
9
  assert_html_output(
@@ -683,6 +683,24 @@ Teston
683
683
  )
684
684
  end
685
685
 
686
+ test "CTA with image" do
687
+ given_govspeak "
688
+ $CTA
689
+ [Image:image-id]
690
+ $CTA
691
+
692
+ Some text
693
+ ", images: [build_image] do
694
+ assert_html_output %(
695
+ <div class="call-to-action">
696
+ <figure class="image embedded"><div class="img"><img src="http://example.com/image.jpg" alt="my alt"></div></figure>
697
+ </div>
698
+
699
+ <p>Some text</p>
700
+ )
701
+ end
702
+ end
703
+
686
704
  test_given_govspeak "
687
705
  1. rod
688
706
  2. jane
@@ -1268,6 +1286,24 @@ Teston
1268
1286
  )
1269
1287
  end
1270
1288
 
1289
+ test "LegislativeList with image" do
1290
+ given_govspeak "
1291
+ $LegislativeList
1292
+ [Image:image-id]
1293
+ $EndLegislativeList
1294
+
1295
+ Some text
1296
+ ", images: [build_image] do
1297
+ assert_html_output %(
1298
+ <div class="legislative-list-wrapper">
1299
+ <figure class="image embedded"><div class="img"><img src="http://example.com/image.jpg" alt="my alt"></div></figure>
1300
+ </div>
1301
+
1302
+ <p>Some text</p>
1303
+ )
1304
+ end
1305
+ end
1306
+
1271
1307
  test_given_govspeak "
1272
1308
  Zippy, Bungle and George did not qualify for the tax exemption in s428. They filled in their tax return accordingly.
1273
1309
  " do
@@ -73,6 +73,13 @@ module GovspeakTestHelper
73
73
  coder.decode(html)
74
74
  end
75
75
 
76
+ def build_image(attrs = {})
77
+ attrs[:alt_text] ||= "my alt"
78
+ attrs[:url] ||= "http://example.com/image.jpg"
79
+ attrs[:id] ||= "image-id"
80
+ attrs
81
+ end
82
+
76
83
  module ClassMethods
77
84
  def test_given_govspeak(govspeak, options = {}, &block)
78
85
  test "Given #{govspeak}" do
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.3.0
4
+ version: 8.3.1
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-10-12 00:00:00.000000000 Z
11
+ date: 2023-10-18 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.4.20
330
+ rubygems_version: 3.4.21
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Markup language for single domain