govspeak 8.3.2 → 8.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a58c52e5a9797911c326259920750977c19b81068825b6b947728fe6af410de
4
- data.tar.gz: de9ac98e971c04c0ac4cc6d7e8f1cc987b2a5310ce2efb5bae4aa2b6ec5ccdc0
3
+ metadata.gz: 474078f8179d567c75b47f781c5d567072a6889a79554fefb81172316828f5fc
4
+ data.tar.gz: aa5a44c15285543a1749b3cf129c66eeea2cb6b58d0b98c9970bc5130320c8fb
5
5
  SHA512:
6
- metadata.gz: 21b984b959a200d44869aad30b0d4db910feba0985d701b918152df0fb507cc46710ce0ee9c661f32e93686955f6c2aa722abeb2e95a96527cf3122d53742497
7
- data.tar.gz: b33b3accc379b22a62a3354d041b943fdde26a5a3bc040308008d1eb1ebcd2d63b27d18d12a40a774b30b1052ef6b9741f733c6b9f5e3ab495831c305df233f5
6
+ metadata.gz: 210b4b75330ff66604483b61e0c2f5c78292ab7e3a957839af6f4fb7e5123b8649366945b01a4a03841f0924166475e28751e4e2531cfe10a125ba506b3f9ec6
7
+ data.tar.gz: 5c164df64fa4ba9c0bdba31d55644550267543e2549e764cab614db0bf2a2e07cd602d571c51ecad4ec9f402e0d76be5052cb21195616be98aba8c99a843d3c7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 8.3.4
2
+
3
+ * Fix tables within call to action component ([#306](https://github.com/alphagov/govspeak/pull/306))
4
+
5
+ ## 8.3.3
6
+
7
+ * Fix single line formatting of call to action component ([#302](https://github.com/alphagov/govspeak/pull/302))
8
+
1
9
  ## 8.3.2
2
10
 
3
11
  * Various bug fixes related to legislative list components ([#298](https://github.com/alphagov/govspeak/pull/298))
@@ -167,7 +167,7 @@ module Govspeak
167
167
 
168
168
  def output
169
169
  document = nokogiri_document
170
- self.class.extensions.each do |_, block|
170
+ self.class.extensions.each do |(_, block)|
171
171
  instance_exec(document, &block)
172
172
  end
173
173
  document.to_html
@@ -59,7 +59,7 @@ module Govspeak
59
59
  # Not showing United Kingdom country is a "feature" lifted and shifted
60
60
  # from Whitehall:
61
61
  # https://github.com/alphagov/whitehall/blob/c67d53d80f9856549c2da1941a10dbb9170be494/lib/address_formatter/formatter.rb#L17
62
- (key == "world_location" && value.strip == "United Kingdom" || value == "")
62
+ key == "world_location" && value.strip == "United Kingdom" || value == ""
63
63
  end
64
64
  end
65
65
 
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.3.2".freeze
2
+ VERSION = "8.3.4".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -277,7 +277,9 @@ module Govspeak
277
277
 
278
278
  extension("call-to-action", surrounded_by("$CTA")) do |body|
279
279
  <<~BODY
280
- <div class="call-to-action" markdown="1">#{body}</div>
280
+ <div class="call-to-action" markdown="1">
281
+ #{body.strip.gsub(/\A^\|/, "\n|").gsub(/\|$\Z/, "|\n")}
282
+ </div>
281
283
  BODY
282
284
  end
283
285
 
@@ -425,6 +425,107 @@ Teston
425
425
  assert_text_output "Click here to start the tool"
426
426
  end
427
427
 
428
+ test_given_govspeak "
429
+ $CTA Click here to start the program $CTA
430
+
431
+ Here is some text" do
432
+ assert_html_output %(
433
+ <div class="call-to-action">
434
+ <p>Click here to start the program</p>
435
+ </div>
436
+
437
+ <p>Here is some text</p>)
438
+ end
439
+
440
+ test_given_govspeak "
441
+ Some text
442
+
443
+ $CTA Click there to start the program $CTA
444
+
445
+ Here is some text" do
446
+ assert_html_output %(
447
+ <p>Some text</p>
448
+ <div class="call-to-action">
449
+ <p>Click there to start the program</p>
450
+ </div>
451
+
452
+ <p>Here is some text</p>)
453
+ end
454
+
455
+ test_given_govspeak "
456
+ Some text
457
+
458
+ $CTAClick anywhere to start the program$CTA
459
+
460
+ Here is some text" do
461
+ assert_html_output %(
462
+ <p>Some text</p>
463
+ <div class="call-to-action">
464
+ <p>Click anywhere to start the program</p>
465
+ </div>
466
+
467
+ <p>Here is some text</p>)
468
+ end
469
+
470
+ test_given_govspeak "
471
+ $CTA
472
+ |Heading 1|Heading 2|
473
+ |-|-|
474
+ |information|more information|
475
+ $CTA" do
476
+ assert_html_output %(
477
+ <div class="call-to-action">
478
+
479
+ <table>
480
+ <thead>
481
+ <tr>
482
+ <th scope="col">Heading 1</th>
483
+ <th scope="col">Heading 2</th>
484
+ </tr>
485
+ </thead>
486
+ <tbody>
487
+ <tr>
488
+ <td>information</td>
489
+ <td>more information</td>
490
+ </tr>
491
+ </tbody>
492
+ </table>
493
+
494
+ </div>)
495
+ end
496
+
497
+ test_given_govspeak "
498
+ $CTA
499
+
500
+ ### A heading within the CTA
501
+
502
+ |Heading 1|Heading 2|
503
+ |-|-|
504
+ |information|more information|
505
+
506
+ $CTA" do
507
+ assert_html_output %(
508
+ <div class="call-to-action">
509
+ <h3 id="a-heading-within-the-cta">A heading within the CTA</h3>
510
+
511
+ <table>
512
+ <thead>
513
+ <tr>
514
+ <th scope="col">Heading 1</th>
515
+ <th scope="col">Heading 2</th>
516
+ </tr>
517
+ </thead>
518
+ <tbody>
519
+ <tr>
520
+ <td>information</td>
521
+ <td>more information</td>
522
+ </tr>
523
+ </tbody>
524
+ </table>
525
+
526
+ </div>)
527
+ end
528
+
428
529
  test_given_govspeak "
429
530
  Here is some text\n
430
531
 
@@ -453,7 +554,6 @@ Teston
453
554
  $CTA" do
454
555
  assert_html_output %(
455
556
  <div class="call-to-action">
456
-
457
557
  <p>This is a test:</p>
458
558
 
459
559
  <ol class="steps">
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.2
4
+ version: 8.3.4
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-12-13 00:00:00.000000000 Z
11
+ date: 2024-01-31 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.12.0
193
+ version: 4.14.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.12.0
200
+ version: 4.14.0
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: simplecov
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  - !ruby/object:Gem::Version
327
327
  version: '0'
328
328
  requirements: []
329
- rubygems_version: 3.4.22
329
+ rubygems_version: 3.5.5
330
330
  signing_key:
331
331
  specification_version: 4
332
332
  summary: Markup language for single domain