govspeak 10.1.0 → 10.2.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 +4 -4
 - data/CHANGELOG.md +4 -0
 - data/lib/govspeak/post_processor.rb +0 -11
 - data/lib/govspeak/version.rb +1 -1
 - data/test/govspeak_attachment_test.rb +0 -28
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 244ad3768386af3b3e111493610fd0dd3b3ae892a1661da85be36d1c2d135f94
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 915d3141f07e1578263645cdba00d39c02f9987ea15133a50bd6bf09b37d0f32
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b493113cc87018ba77ec5238a160758492056b86b5d10e26fa5e9cd95374197769dcdddcf7fb2965bb0b0ca80fde42af7f0daa3435f66483c4a03f7c94123b57
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c2880fc10ca8248e274054dde5a741a375e32a58e0ae20b96a8e98f94109d438d1e0d8dd37eaf9c0937fe4139b758999bd1960ff5ea041a5f6ee4de25a36d899
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Changelog
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 10.2.0
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Revert 'Add GA4 indexes to attachments that render a details component' ([#389](https://github.com/alphagov/govspeak/pull/389))
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       3 
7 
     | 
    
         
             
            ## 10.1.0
         
     | 
| 
       4 
8 
     | 
    
         | 
| 
       5 
9 
     | 
    
         
             
            * Allow acronyms/abbreviations in steps ([#387](https://github.com/alphagov/govspeak/pull/387)).
         
     | 
| 
         @@ -57,11 +57,6 @@ module Govspeak 
     | 
|
| 
       57 
57 
     | 
    
         
             
                end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                extension("embed attachment HTML") do |document|
         
     | 
| 
       60 
     | 
    
         
            -
                  # Attachments with details components need indexes set for GA4 tracking purposes
         
     | 
| 
       61 
     | 
    
         
            -
                  details_attachments = govspeak_document.attachments.select { |attachment| attachment[:alternative_format_contact_email] }
         
     | 
| 
       62 
     | 
    
         
            -
                  details_attachments_size = details_attachments.size
         
     | 
| 
       63 
     | 
    
         
            -
                  details_attachment_index = 0
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
60 
     | 
    
         
             
                  document.css("govspeak-embed-attachment").map do |el|
         
     | 
| 
       66 
61 
     | 
    
         
             
                    attachment = govspeak_document.attachments.detect { |a| a[:id] == el["id"] }
         
     | 
| 
       67 
62 
     | 
    
         | 
| 
         @@ -70,17 +65,11 @@ module Govspeak 
     | 
|
| 
       70 
65 
     | 
    
         
             
                      next
         
     | 
| 
       71 
66 
     | 
    
         
             
                    end
         
     | 
| 
       72 
67 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                    if attachment[:alternative_format_contact_email]
         
     | 
| 
       74 
     | 
    
         
            -
                      details_attachment_index += 1
         
     | 
| 
       75 
     | 
    
         
            -
                      details_ga4_attributes = { index_section: details_attachment_index, index_section_count: details_attachments_size }
         
     | 
| 
       76 
     | 
    
         
            -
                    end
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
68 
     | 
    
         
             
                    attachment_html = GovukPublishingComponents.render(
         
     | 
| 
       79 
69 
     | 
    
         
             
                      "govuk_publishing_components/components/attachment",
         
     | 
| 
       80 
70 
     | 
    
         
             
                      attachment:,
         
     | 
| 
       81 
71 
     | 
    
         
             
                      margin_bottom: 6,
         
     | 
| 
       82 
72 
     | 
    
         
             
                      locale: govspeak_document.locale,
         
     | 
| 
       83 
     | 
    
         
            -
                      details_ga4_attributes:,
         
     | 
| 
       84 
73 
     | 
    
         
             
                    )
         
     | 
| 
       85 
74 
     | 
    
         
             
                    el.swap(attachment_html)
         
     | 
| 
       86 
75 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/govspeak/version.rb
    CHANGED
    
    
| 
         @@ -52,32 +52,4 @@ class GovspeakAttachmentTest < Minitest::Test 
     | 
|
| 
       52 
52 
     | 
    
         
             
                assert html_has_selector?(rendered, "section.gem-c-attachment")
         
     | 
| 
       53 
53 
     | 
    
         
             
                assert_match(/<p>some more text<\/p>/, rendered)
         
     | 
| 
       54 
54 
     | 
    
         
             
              end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
              test "renders attachments with details elements with the correct GA4 index" do
         
     | 
| 
       57 
     | 
    
         
            -
                attachments = []
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                (1..3).each do |index|
         
     | 
| 
       60 
     | 
    
         
            -
                  attachments << {
         
     | 
| 
       61 
     | 
    
         
            -
                    id: "attachment#{index}.ods",
         
     | 
| 
       62 
     | 
    
         
            -
                    url: "http://example.com/attachment#{index}",
         
     | 
| 
       63 
     | 
    
         
            -
                    title: "Attachment Title #{index}",
         
     | 
| 
       64 
     | 
    
         
            -
                    alternative_format_contact_email: "example@gov.uk",
         
     | 
| 
       65 
     | 
    
         
            -
                  }
         
     | 
| 
       66 
     | 
    
         
            -
                end
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                # Insert an attachment without a details element, to ensure our code to increment the index ignores these
         
     | 
| 
       69 
     | 
    
         
            -
                attachments.insert(1, {
         
     | 
| 
       70 
     | 
    
         
            -
                  id: "attachment.pdf",
         
     | 
| 
       71 
     | 
    
         
            -
                  url: "http://example.com/attachment.pdf",
         
     | 
| 
       72 
     | 
    
         
            -
                  title: "Attachment Title",
         
     | 
| 
       73 
     | 
    
         
            -
                })
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                rendered = render_govspeak("[Attachment:attachment1.ods]\n[Attachment:attachment.pdf]\n[Attachment:attachment2.ods]\n[Attachment:attachment3.ods]", attachments)
         
     | 
| 
       76 
     | 
    
         
            -
                node = Nokogiri::HTML(rendered)
         
     | 
| 
       77 
     | 
    
         
            -
                node.css(".gem-c-details").each_with_index.map do |details, index|
         
     | 
| 
       78 
     | 
    
         
            -
                  ga4_event = JSON.parse(details.attribute("data-ga4-event"))
         
     | 
| 
       79 
     | 
    
         
            -
                  assert_equal ga4_event["index_section"], index + 1
         
     | 
| 
       80 
     | 
    
         
            -
                  assert_equal ga4_event["index_section_count"], 3
         
     | 
| 
       81 
     | 
    
         
            -
                end
         
     | 
| 
       82 
     | 
    
         
            -
              end
         
     | 
| 
       83 
55 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: govspeak
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 10. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 10.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - GOV.UK Dev
         
     | 
| 
       8 
8 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       9 
9 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       10 
     | 
    
         
            -
            date: 2025-03- 
     | 
| 
      
 10 
     | 
    
         
            +
            date: 2025-03-06 00:00:00.000000000 Z
         
     | 
| 
       11 
11 
     | 
    
         
             
            dependencies:
         
     | 
| 
       12 
12 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       13 
13 
     | 
    
         
             
              name: actionview
         
     |