govspeak 6.7.6 → 6.7.7

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: 80c02b999651b2cd76424eabedc7619aaf9e494f2049fe16cf4a3ab34869de0f
4
- data.tar.gz: adfc46a4aec8dd5c46f54990e392928da7d7610256750a7726b053a679689d90
3
+ metadata.gz: eeb616e6f8489b589e1ddda16e92727ec5c30a9ad76b88e89184aad8590276e3
4
+ data.tar.gz: cc776bc6208ca7baafce665f4c92a549f2ee6c70fa96652e81e2ed8a32a45f5a
5
5
  SHA512:
6
- metadata.gz: 1d04823f5e51d7612529ef89b27a11366c0d8bae6bb3ab0c3d121fbc929e3a3df18dcb3390fbc75f1e706c7e8c3fd742663ffafe74330c5d87e0087370599eb3
7
- data.tar.gz: 96f99f887fa623976d28b9cb3e22377650113669635e2f7f77b2bf6eca1f68b3fb43b078ed762c2a4ce0cf44ee7d6f68ad6ea997211b0f39aabfbc1bc43dff93
6
+ metadata.gz: cb08b6e651a21f26ae42efff15d74b80401b1dc26fd516b69b02394b9eeaa20825aa4e176ef789a35ae035bb5d8be13012fb42e35c88e1e487870c81c8c4d0af
7
+ data.tar.gz: 1dc3a85af8fb5ecacb8c9a530739e8f3742fa9ea79bd3830c73c2c5d36b907d737aec74e028a4df197f11e1c0bd7d55eb25e3f5d0009a22a930cfb4e0b449f50
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.7.7
2
+
3
+ * Fix broken HTML in CTA extension. [#226](https://github.com/alphagov/govspeak/pull/226)
4
+
1
5
  ## 6.7.6
2
6
 
3
7
  * Add draggable false to button markup and validation [#224](https://github.com/alphagov/govspeak/pull/224)
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "6.7.6".freeze
2
+ VERSION = "6.7.7".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -322,7 +322,7 @@ module Govspeak
322
322
  end
323
323
 
324
324
  extension("call-to-action", surrounded_by("$CTA")) do |body|
325
- doc = Kramdown::Document.new(body.strip).to_html
325
+ doc = Kramdown::Document.new(preprocess(body.strip), @options).to_html
326
326
  doc = %(\n<div class="call-to-action">\n#{doc}</div>\n)
327
327
  footnotes = body.scan(/\[\^(\d+)\]/).flatten
328
328
 
@@ -440,6 +440,60 @@ Teston
440
440
  </div>)
441
441
  end
442
442
 
443
+ test_given_govspeak "
444
+ $CTA
445
+
446
+ This is a test:
447
+
448
+ s1. This is number 1.
449
+ s2. This is number 2.
450
+ s3. This is number 3.
451
+ s4. This is number 4.
452
+
453
+ $CTA" do
454
+ assert_html_output %(
455
+ <div class="call-to-action">
456
+ <p>This is a test:</p>
457
+
458
+ <ol class="steps">
459
+ <li>
460
+ <p>This is number 1.</p>
461
+ </li>
462
+ <li>
463
+ <p>This is number 2.</p>
464
+ </li>
465
+ <li>
466
+ <p>This is number 3.</p>
467
+ </li>
468
+ <li>
469
+ <p>This is number 4.</p>
470
+ </li>
471
+ </ol>
472
+ </div>
473
+ )
474
+ end
475
+
476
+ test_given_govspeak "
477
+ $CTA
478
+ [external link](http://www.external.com) some text
479
+ $CTA
480
+ " do
481
+ assert_html_output %(
482
+ <div class="call-to-action">
483
+ <p><a rel="external" href="http://www.external.com">external link</a> some text</p>
484
+ </div>)
485
+ end
486
+
487
+ test_given_govspeak "
488
+ $CTA
489
+ [internal link](http://www.not-external.com) some text
490
+ $CTA", document_domains: %w[www.not-external.com] do
491
+ assert_html_output %(
492
+ <div class="call-to-action">
493
+ <p><a href="http://www.not-external.com">internal link</a> some text</p>
494
+ </div>)
495
+ end
496
+
443
497
  test_given_govspeak "
444
498
  $CTA
445
499
  Click here to start the tool
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.7.6
4
+ version: 6.7.7
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: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2021-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview