govspeak 10.10.0 → 10.11.0

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: 3d2fa22c7671ca33aa517fac4cb898eba4823aaa9175d4ec14afb4a74598967b
4
- data.tar.gz: a5e301aef894df2901032f38d260f886b488c7c4064e9e006c29505c3b22cd85
3
+ metadata.gz: bbe7be2db2caf929c90abd590208e19ed0765f96769425fd5a8275ef788026bc
4
+ data.tar.gz: 344f21ce74192fbecd10344849e81ab557d8f12d399aa5cc6d386f3c2823cc17
5
5
  SHA512:
6
- metadata.gz: 957046ca3c77b2c58857148a8b48c6e380c2d81ef5563053a934970ff9f883fd002b4868187338cf2f8b9e28b7e4563c197dddcec1e7d87ab32045946152a514
7
- data.tar.gz: 6e0dd1d24b5b3cfad0656f0ff649bf0656da5a83c14cdcce61a3c384d76f2c5f64c7c813e8d741fca4a4bb486928c067485b2b9284ea5687b6e7c8de0615f02e
6
+ metadata.gz: cb2c38e1279c73cdf9748652c0bc509c72505ee68e81f1117f22b91cb4b04f07ef97c9be8d6234ef712d5c672f99c149f6723adfc874ed86a9455569005954e4
7
+ data.tar.gz: 040b0c4c9a4bb9920cad211c04f41de53285131fd0dc17f2634e0f075e0fefe3cefc69ab89decfdb8d9d8aee3cf892ff133f5d8b5178186f1eae8b25b0e221a1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 10.11.0
4
+
5
+ * feature: Remove cards from govspeak [PR #494](https://github.com/alphagov/govspeak/pull/494)
6
+
3
7
  ## 10.10.0
4
8
 
5
9
  * feature: Add cards to govspeak [PR #489](https://github.com/alphagov/govspeak/pull/489)
data/README.md CHANGED
@@ -697,67 +697,6 @@ which outputs
697
697
  </a>
698
698
  ```
699
699
 
700
- ### Cards
701
-
702
- Adds cards using the cards component from the components gem, using the [auto layout](https://components.publishing.service.gov.uk/component-guide/cards/auto_layout).
703
-
704
- #### Examples
705
-
706
- The most basic card.
707
-
708
- ```
709
- {cards}[Benefits](https://www.gov.uk/browse/benefits){/cards}
710
- ```
711
-
712
- which outputs
713
-
714
- ```html
715
- <div class="gem-c-cards gem-c-cards--auto-layout">
716
- <ul class="gem-c-cards__list">
717
- <li class="gem-c-cards__list-item">
718
- <div class="gem-c-cards__list-item-wrapper">
719
- <h3 class="gem-c-cards__sub-heading govuk-heading-s">
720
- <a class="govuk-link gem-c-cards__link gem-print-force-link-styles" href="http://www.gov.uk/browse/benefits">Benefits</a>
721
- </h3>
722
- </div>
723
- </li>
724
- </ul>
725
- </div>
726
- ```
727
-
728
- To include a description on the card, include after the link.
729
-
730
- ```
731
- {cards}[Benefits](https://www.gov.uk/browse/benefits) Includes eligibility, appeals, tax credits and Universal Credit{/cards}
732
- ```
733
-
734
- which outputs
735
-
736
- ```html
737
- <div class="gem-c-cards gem-c-cards--auto-layout">
738
- <ul class="gem-c-cards__list">
739
- <li class="gem-c-cards__list-item">
740
- <div class="gem-c-cards__list-item-wrapper">
741
- <h3 class="gem-c-cards__sub-heading govuk-heading-s">
742
- <a class="govuk-link gem-c-cards__link gem-print-force-link-styles" href="http://www.gov.uk/browse/benefits">Benefits</a>
743
- </h3>
744
- <p class="govuk-body gem-c-cards__description">Includes eligibility, appeals, tax credits and Universal Credit</p>
745
- </div>
746
- </li>
747
- </ul>
748
- </div>
749
- ```
750
-
751
- To output more than one card, repeat the link pattern.
752
-
753
- ```
754
- {cards}
755
- [Benefits](https://www.gov.uk/browse/benefits) Includes eligibility, appeals, tax credits and Universal Credit
756
- [Births, deaths, marriages and care](https://www.gov.uk/browse/births-deaths-marriages) Parenting, civil partnerships, divorce and Lasting Power of Attorney
757
- {/cards}
758
- ```
759
-
760
-
761
700
  ## Licence
762
701
 
763
702
  [MIT License](LICENCE)
@@ -14,7 +14,6 @@ class Govspeak::HtmlValidator
14
14
  def valid?
15
15
  dirty_html = govspeak_to_html(sanitize: false)
16
16
  clean_html = govspeak_to_html(sanitize: true)
17
-
18
17
  normalise_html(dirty_html) == normalise_html(clean_html)
19
18
  end
20
19
 
@@ -147,30 +147,6 @@ module Govspeak
147
147
  end
148
148
  end
149
149
 
150
- extension("use gem component for cards") do |document|
151
- document.css(".cards").map do |cards|
152
- links = cards.css(".card").map do |card|
153
- {
154
- link: {
155
- path: card["href"],
156
- text: card.css(".text").inner_html.html_safe,
157
- },
158
- description: card.css(".description").inner_html.html_safe,
159
- }
160
- end
161
-
162
- cards_html = GovukPublishingComponents.render(
163
- "govuk_publishing_components/components/cards", {
164
- items: links,
165
- columns: "auto",
166
- margin_bottom: 6,
167
- }
168
- ).squish.gsub("> <", "><").gsub!(/\s+/, " ")
169
-
170
- cards.swap(cards_html)
171
- end
172
- end
173
-
174
150
  extension("use custom footnotes") do |document|
175
151
  document.css("a.footnote").map do |el|
176
152
  footnote_number = el[:href].gsub(/\D/, "")
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "10.10.0".freeze
2
+ VERSION = "10.11.0".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -202,22 +202,6 @@ module Govspeak
202
202
  %(\n<a role="button" draggable="false" class="#{button_classes}" href="#{href}" #{data_attribute}>#{text}</a>\n)
203
203
  end
204
204
 
205
- extension("cards", %r$^{cards}(.*?){/cards}$m) do |body|
206
- links = body.scan(/\s*\[([^\]]+)\]\(([^)]+)\)([^{\[$*\#]*)\s*/)
207
- cards = ""
208
-
209
- links.each do |text, href, description|
210
- cards << "
211
- <a class='card' href='#{href.strip}'>
212
- <span class='text'>#{text.strip}</span>
213
- <span class='description'>#{description.strip}</span>
214
- </a>
215
- "
216
- end
217
-
218
- "<div class='cards'>#{cards}</div>"
219
- end
220
-
221
205
  extension("highlight-answer") do |body|
222
206
  %(\n\n<div class="highlight-answer">
223
207
  #{Govspeak::Document.new(body.strip, locale: @locale).to_html}</div>\n)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govspeak
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.10.0
4
+ version: 10.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -333,7 +333,6 @@ files:
333
333
  - test/govspeak_attachments_image_test.rb
334
334
  - test/govspeak_attachments_inline_test.rb
335
335
  - test/govspeak_button_test.rb
336
- - test/govspeak_cards_test.rb
337
336
  - test/govspeak_contacts_test.rb
338
337
  - test/govspeak_devolved_content_test.rb
339
338
  - test/govspeak_extract_contact_content_ids_test.rb
@@ -380,7 +379,6 @@ test_files:
380
379
  - test/govspeak_attachments_image_test.rb
381
380
  - test/govspeak_attachments_inline_test.rb
382
381
  - test/govspeak_button_test.rb
383
- - test/govspeak_cards_test.rb
384
382
  - test/govspeak_contacts_test.rb
385
383
  - test/govspeak_devolved_content_test.rb
386
384
  - test/govspeak_extract_contact_content_ids_test.rb
@@ -1,54 +0,0 @@
1
- require "test_helper"
2
- require "govspeak_test_helper"
3
-
4
- require "ostruct"
5
-
6
- class GovspeakTest < Minitest::Test
7
- include GovspeakTestHelper
8
-
9
- test_given_govspeak "{cards}[Benefits](https://www.gov.uk/browse/benefits){/cards}" do
10
- assert_html_selector ".gem-c-cards.gem-c-cards--auto-layout"
11
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
12
- assert_text_output "Benefits"
13
- end
14
-
15
- # The same as above but with line breaks
16
- test_given_govspeak "{cards}\n\n\n[Benefits](https://www.gov.uk/browse/benefits)\n\n\n{/cards}" do
17
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
18
- assert_text_output "Benefits"
19
- end
20
-
21
- test_given_govspeak "{cards}\n[Benefits](https://www.gov.uk/browse/benefits)\n[Births, deaths, marriages and care](https://www.gov.uk/browse/births-deaths-marriages)\n{/cards}" do
22
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
23
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/births-deaths-marriages"]'
24
- assert_text_output "Benefits Births, deaths, marriages and care"
25
- end
26
-
27
- test_given_govspeak "{cards}[Benefits](https://www.gov.uk/browse/benefits) This is a description{/cards}" do
28
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
29
- assert_html_selector ".gem-c-cards__description"
30
- assert_text_output "Benefits This is a description"
31
- end
32
-
33
- # The same as above but with line breaks
34
- test_given_govspeak "{cards}\n\n[Benefits](https://www.gov.uk/browse/benefits)\n\nThis is a description\n\n{/cards}" do
35
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
36
- assert_text_output "Benefits This is a description"
37
- end
38
-
39
- test_given_govspeak "{cards}\n\n[Benefits](https://www.gov.uk/browse/benefits)\n\nThis is a description? With punctuation! - of course, this isn't a real example, real ones wouldn't \"quote\" like this\n\n{/cards}" do
40
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
41
- assert_text_output "Benefits This is a description? With punctuation! - of course, this isn't a real example, real ones wouldn't \"quote\" like this"
42
- end
43
-
44
- test_given_govspeak "{cards}\n
45
- [Benefits](https://www.gov.uk/browse/benefits)\n
46
- This is a description\n
47
- containing line breaks\n
48
- [Births, deaths, marriages and care](https://www.gov.uk/browse/births-deaths-marriages)\n
49
- {/cards}" do
50
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/benefits"]'
51
- assert_html_selector 'a.gem-c-cards__link[href="https://www.gov.uk/browse/births-deaths-marriages"]'
52
- assert_text_output "Benefits This is a description containing line breaks Births, deaths, marriages and care"
53
- end
54
- end