govspeak 8.2.1 → 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: 0d49c335c68cd5f05db18037a354c1da3b1a9ad72807b41bd16dd889ed2df4f5
4
- data.tar.gz: 12a859b126e18e44aa69e5a693508e86bb43056ea1623569cb84db51976e1985
3
+ metadata.gz: 330ac68b36870075d83d6cae5223e28d12186d7b9435be02df50829f11d8c27e
4
+ data.tar.gz: 3d0b8d3e7b1f98d9e3c814f141319a56a8388ac114b308aba7c3945e5661bbe4
5
5
  SHA512:
6
- metadata.gz: da16a5a2881e26fedadb229251d7d0ad6a3992828a30d142e3643026a238fd3e079b69e0a79b6a4d5b5f8645d06ef25844285a248a13fccea62afeaa53c92af7
7
- data.tar.gz: d3fec351bc7836c657268e7fe265dc2cd331a84f858ad10620ebb7063ee9c967169563b19400075f2a3b60fd49a03df95e08f6e5c9211a686eaa29715407ded5
6
+ metadata.gz: c23c1e930d96b6c67fcc9a46c3fc2b1e048d3c5cf9f741e55de28b94bb334e56a07108326cf5bc96c140764f860a0532ff38df87dbb9e04355576f93ebe7efad
7
+ data.tar.gz: ed762ebf793ee83971ddcf4a5102379b2ad0dea4adea3134c8bd818c9c15d1d03e957b2b433549bc0846525bea1fb3a19c3574eafb1ac46dc1b98f27c59009cb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
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
+
5
+ ## 8.3.0
6
+
7
+ * Various bug fixes related to abbreviations in call to action and legislative list components ([#291](https://github.com/alphagov/govspeak/pull/291))
8
+
1
9
  ## 8.2.1
2
10
 
3
11
  * Prevent user error when incorrectly formatted footnotes are added to HTML attachments ([#287](https://github.com/alphagov/govspeak/pull/287))
@@ -20,6 +20,15 @@ module Govspeak
20
20
  end
21
21
  end
22
22
 
23
+ extension("covert legislative list ul to ol") do |document|
24
+ document.css(".legislative-list-wrapper").map do |el|
25
+ el.inner_html = el.inner_html
26
+ .sub("<ul>", "<ol class=\"legislative-list\">")
27
+ .gsub("</ul>", "</ol>")
28
+ .gsub("<ul>", "<ol>")
29
+ end
30
+ end
31
+
23
32
  # This "fix" here is tied into the rendering of images as one of the
24
33
  # pre-processor tasks. As images can be created inside block level elements
25
34
  # it's possible that their block level elements can be HTML entity escaped
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "8.2.1".freeze
2
+ VERSION = "8.3.1".freeze
3
3
  end
data/lib/govspeak.rb CHANGED
@@ -63,8 +63,6 @@ module Govspeak
63
63
  sanitize: true,
64
64
  syntax_highlighter: nil }.merge(options)
65
65
  @options[:entity_output] = :symbolic
66
- @footnote_definition_html = nil
67
- @acronyms = []
68
66
  end
69
67
 
70
68
  def to_html
@@ -76,16 +74,6 @@ module Govspeak
76
74
  kramdown_doc.to_html
77
75
  end
78
76
 
79
- unless @footnote_definition_html.nil?
80
- regex = /<div class="footnotes".*[<\/div>]/m
81
-
82
- if html.scan(regex).empty?
83
- html << @footnote_definition_html
84
- else
85
- html.gsub!(regex, @footnote_definition_html)
86
- end
87
- end
88
-
89
77
  Govspeak::PostProcessor.process(html, self)
90
78
  end
91
79
  end
@@ -125,8 +113,6 @@ module Govspeak
125
113
  source = Govspeak::BlockquoteExtraQuoteRemover.remove(source)
126
114
  source = remove_forbidden_characters(source)
127
115
 
128
- footnote_definitions(source)
129
-
130
116
  self.class.extensions.each do |_, regexp, block|
131
117
  source.gsub!(regexp) do
132
118
  instance_exec(*Regexp.last_match.captures, &block)
@@ -135,37 +121,6 @@ module Govspeak
135
121
  source
136
122
  end
137
123
 
138
- def footnote_definitions(source)
139
- is_legislative_list = source.scan(/\$LegislativeList.*?\[\^\d\]*.*?\$EndLegislativeList/m).size.positive?
140
- is_cta = source.scan(/\$CTA.*?\[\^\d\]*.*?\$CTA/m).size.positive?
141
- footnotes = source.scan(/^\s*\[\^(\d+)\]:(.*)/)
142
- @acronyms.concat(source.scan(/(?<=\*)\[(.*)\]:(.*)/))
143
- if (is_legislative_list || is_cta) && footnotes.size.positive?
144
- list_items = footnotes.map do |footnote|
145
- number = footnote[0]
146
- text = footnote[1].strip
147
- footnote_definition = Govspeak::Document.new(text).to_html[/(?<=<p>).*(?=<\/p>)/]
148
- footnote_definition = add_acronym_alt_text(footnote_definition)
149
-
150
- <<~HTML_SNIPPET
151
- <li id="fn:#{number}" role="doc-endnote">
152
- <p>
153
- #{footnote_definition}<a href="#fnref:#{number}" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
154
- </p>
155
- </li>
156
- HTML_SNIPPET
157
- end
158
-
159
- @footnote_definition_html = <<~HTML_CONTAINER
160
- <div class="footnotes" role="doc-endnotes">
161
- <ol>
162
- #{list_items.join.strip}
163
- </ol>
164
- </div>
165
- HTML_CONTAINER
166
- end
167
- end
168
-
169
124
  def remove_forbidden_characters(source)
170
125
  # These are characters that are not deemed not suitable for
171
126
  # markup: https://www.w3.org/TR/unicode-xml/#Charlist
@@ -322,20 +277,9 @@ module Govspeak
322
277
  end
323
278
 
324
279
  extension("call-to-action", surrounded_by("$CTA")) do |body|
325
- doc = Kramdown::Document.new(preprocess(body.strip), @options).to_html
326
- doc = add_acronym_alt_text(doc)
327
- doc = %(\n<div class="call-to-action">\n#{doc}</div>\n)
328
- footnotes = body.scan(/\[\^(\d+)\]/).flatten
329
-
330
- footnotes.each do |footnote|
331
- html = "<sup id=\"fnref:#{footnote}\" role=\"doc-noteref\">" \
332
- "<a href=\"#fn:#{footnote}\" class=\"footnote\" rel=\"footnote\">" \
333
- "[footnote #{footnote}]</a></sup>"
334
-
335
- doc.sub!(/(\[\^#{footnote}\])/, html)
336
- end
337
-
338
- doc
280
+ <<~BODY
281
+ <div class="call-to-action" markdown="1">#{body}</div>
282
+ BODY
339
283
  end
340
284
 
341
285
  # More specific tags must be defined first. Those defined earlier have a
@@ -354,25 +298,13 @@ module Govspeak
354
298
  end
355
299
 
356
300
  extension("legislative list", /#{NEW_PARAGRAPH_LOOKBEHIND}\$LegislativeList\s*$(.*?)\$EndLegislativeList/m) do |body|
357
- Govspeak::KramdownOverrides.with_kramdown_ordered_lists_disabled do
358
- body = add_acronym_alt_text(body.strip)
359
-
360
- Kramdown::Document.new(body.strip).to_html.tap do |doc|
361
- doc.gsub!("<ul>", "<ol>")
362
- doc.gsub!("</ul>", "</ol>")
363
- doc.sub!("<ol>", '<ol class="legislative-list">')
364
-
365
- footnotes = body.scan(/\[\^(\d+)\]/).flatten
366
-
367
- footnotes.each do |footnote|
368
- html = "<sup id=\"fnref:#{footnote}\" role=\"doc-noteref\">" \
369
- "<a href=\"#fn:#{footnote}\" class=\"footnote\" rel=\"footnote\">" \
370
- "[footnote #{footnote}]</a></sup>"
371
-
372
- doc.sub!(/(\[\^#{footnote}\])/, html)
373
- end
374
- end
375
- end
301
+ # The surrounding div is neccessary to control flow in `parse_block_html` and
302
+ # maintain the same functionality as a previous version of this extension.
303
+ <<~BODY
304
+ {::options ordered_lists_disabled=\"true\" /}
305
+ <div class="legislative-list-wrapper" markdown="1">#{body}</div>
306
+ {::options ordered_lists_disabled=\"false\" /}
307
+ BODY
376
308
  end
377
309
 
378
310
  extension("numbered list", /^[ \t]*((s\d+\.\s.*(?:\n|$))+)/) do |body|
@@ -449,16 +381,6 @@ module Govspeak
449
381
  def encode(text)
450
382
  HTMLEntities.new.encode(text)
451
383
  end
452
-
453
- def add_acronym_alt_text(html)
454
- return unless html
455
-
456
- @acronyms.each do |acronym|
457
- html.gsub!(acronym[0], "<abbr title=\"#{acronym[1].strip}\">#{acronym[0]}</abbr>")
458
- end
459
-
460
- html
461
- end
462
384
  end
463
385
  end
464
386
 
@@ -17,6 +17,13 @@ module Kramdown
17
17
  DESCRIPTION
18
18
  simple_array_validator(val, :document_domains, AlwaysEqual.new)
19
19
  end
20
+
21
+ define(:ordered_lists_disabled, Boolean, false, <<~DESCRIPTION)
22
+ Disables ordered lists
23
+
24
+ Default: false
25
+ Used by: KramdownWithAutomaticExternalLinks
26
+ DESCRIPTION
20
27
  end
21
28
 
22
29
  module Parser
@@ -46,7 +53,17 @@ module Kramdown
46
53
  def parse_block_html
47
54
  return false if CUSTOM_INLINE_ELEMENTS.include?(@src[1].downcase)
48
55
 
49
- super
56
+ return super unless @options[:ordered_lists_disabled]
57
+
58
+ # Kramdown loads parsers into the instance from `options` which are scoped to
59
+ # the class. Because we are changing these options inside an instance, we must
60
+ # reconfigure the parser before and after disbaling ordered lists.
61
+ Govspeak::KramdownOverrides.with_kramdown_ordered_lists_disabled do
62
+ configure_parser
63
+ super
64
+ end
65
+
66
+ configure_parser
50
67
  end
51
68
  end
52
69
  end
@@ -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(
@@ -420,13 +420,13 @@ Teston
420
420
  $CTA" do
421
421
  assert_html_output %(
422
422
  <div class="call-to-action">
423
- <p>Click here to start the tool</p>
423
+ <p>Click here to start the tool</p>
424
424
  </div>)
425
425
  assert_text_output "Click here to start the tool"
426
426
  end
427
427
 
428
428
  test_given_govspeak "
429
- Here is some text
429
+ Here is some text\n
430
430
 
431
431
  $CTA
432
432
  Click here to start the tool
@@ -436,7 +436,7 @@ Teston
436
436
  <p>Here is some text</p>
437
437
 
438
438
  <div class="call-to-action">
439
- <p>Click here to start the tool</p>
439
+ <p>Click here to start the tool</p>
440
440
  </div>)
441
441
  end
442
442
 
@@ -453,9 +453,10 @@ Teston
453
453
  $CTA" do
454
454
  assert_html_output %(
455
455
  <div class="call-to-action">
456
- <p>This is a test:</p>
457
456
 
458
- <ol class="steps">
457
+ <p>This is a test:</p>
458
+
459
+ <ol class="steps">
459
460
  <li>
460
461
  <p>This is number 1.</p>
461
462
  </li>
@@ -480,7 +481,7 @@ Teston
480
481
  " do
481
482
  assert_html_output %(
482
483
  <div class="call-to-action">
483
- <p><a rel="external" href="http://www.external.com">external link</a> some text</p>
484
+ <p><a rel="external" href="http://www.external.com">external link</a> some text</p>
484
485
  </div>)
485
486
  end
486
487
 
@@ -490,7 +491,7 @@ Teston
490
491
  $CTA", document_domains: %w[www.not-external.com] do
491
492
  assert_html_output %(
492
493
  <div class="call-to-action">
493
- <p><a href="http://www.not-external.com">internal link</a> some text</p>
494
+ <p><a href="http://www.not-external.com">internal link</a> some text</p>
494
495
  </div>)
495
496
  end
496
497
 
@@ -505,7 +506,7 @@ Teston
505
506
  " do
506
507
  assert_html_output %(
507
508
  <div class="call-to-action">
508
- <p>Click here to start the tool</p>
509
+ <p>Click here to start the tool</p>
509
510
  </div>
510
511
 
511
512
  <div class="contact">
@@ -514,7 +515,7 @@ Teston
514
515
  end
515
516
 
516
517
  test_given_govspeak "
517
- [internal link](http://www.not-external.com)
518
+ [internal link](http://www.not-external.com)\n
518
519
 
519
520
  $CTA
520
521
  Click here to start the tool
@@ -523,7 +524,7 @@ Teston
523
524
  <p><a href="http://www.not-external.com">internal link</a></p>
524
525
 
525
526
  <div class="call-to-action">
526
- <p>Click here to start the tool</p>
527
+ <p>Click here to start the tool</p>
527
528
  </div>)
528
529
  end
529
530
 
@@ -535,15 +536,13 @@ Teston
535
536
  " do
536
537
  assert_html_output %(
537
538
  <div class="call-to-action">
538
- <p>Click here to start the tool<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup></p>
539
+ <p>Click here to start the tool<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup></p>
539
540
  </div>
540
541
  <div class="footnotes" role="doc-endnotes">
541
542
  <ol>
542
543
  <li id="fn:1" role="doc-endnote">
543
- <p>
544
- Footnote definition one<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
545
- </p>
546
- </li>
544
+ <p>Footnote definition one <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
545
+ </li>
547
546
  </ol>
548
547
  </div>
549
548
  )
@@ -563,26 +562,21 @@ Teston
563
562
  " do
564
563
  assert_html_output %(
565
564
  <div class="call-to-action">
566
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
565
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
567
566
  Fusce felis ante<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>, lobortis non quam sit amet, tempus interdum justo.</p>
568
567
  </div>
569
-
570
568
  <div class="call-to-action">
571
- <p>Pellentesque quam enim, egestas sit amet congue sit amet<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>, ultrices vitae arcu.
569
+ <p>Pellentesque quam enim, egestas sit amet congue sit amet<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>, ultrices vitae arcu.
572
570
  Fringilla, metus dui scelerisque est.</p>
573
571
  </div>
574
572
  <div class="footnotes" role="doc-endnotes">
575
573
  <ol>
576
574
  <li id="fn:1" role="doc-endnote">
577
- <p>
578
- Footnote definition one<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
579
- </p>
580
- </li>
581
- <li id="fn:2" role="doc-endnote">
582
- <p>
583
- Footnote definition two<a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
584
- </p>
585
- </li>
575
+ <p>Footnote definition one <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
576
+ </li>
577
+ <li id="fn:2" role="doc-endnote">
578
+ <p>Footnote definition two <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
579
+ </li>
586
580
  </ol>
587
581
  </div>
588
582
  )
@@ -600,7 +594,7 @@ Teston
600
594
  " do
601
595
  assert_html_output %(
602
596
  <div class="call-to-action">
603
- <p>Click here to start the tool<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup></p>
597
+ <p>Click here to start the tool<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup></p>
604
598
  </div>
605
599
 
606
600
  <p>Lorem ipsum dolor sit amet<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup></p>
@@ -608,15 +602,11 @@ Teston
608
602
  <div class="footnotes" role="doc-endnotes">
609
603
  <ol>
610
604
  <li id="fn:1" role="doc-endnote">
611
- <p>
612
- Footnote definition 1<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
613
- </p>
614
- </li>
615
- <li id="fn:2" role="doc-endnote">
616
- <p>
617
- Footnote definition 2<a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
618
- </p>
619
- </li>
605
+ <p>Footnote definition 1 <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
606
+ </li>
607
+ <li id="fn:2" role="doc-endnote">
608
+ <p>Footnote definition 2 <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
609
+ </li>
620
610
  </ol>
621
611
  </div>
622
612
  )
@@ -632,11 +622,85 @@ Teston
632
622
  " do
633
623
  assert_html_output %(
634
624
  <div class="call-to-action">
635
- <p>Contact the <abbr title="Some Government Department">SGD</abbr> on 0800 000 0000 or contact the <abbr title="Other Government Department">class</abbr> on 0800 001 0001</p>
625
+ <p>Contact the <abbr title="Some Government Department">SGD</abbr> on 0800 000 0000 or contact the <abbr title="Other Government Department">class</abbr> on 0800 001 0001</p>
636
626
  </div>
637
627
  )
638
628
  end
639
629
 
630
+ test_given_govspeak "
631
+ $CTA
632
+ Welcome to the GOV.UK website
633
+ $CTA
634
+
635
+ *[GOV.UK]: The official UK government website
636
+ *[website]: A collection of web pages, such as GOV.UK
637
+ " do
638
+ assert_html_output %(
639
+ <div class="call-to-action">
640
+ <p>Welcome to the <abbr title="The official UK government website">GOV.UK</abbr> <abbr title="A collection of web pages, such as GOV.UK">website</abbr></p>
641
+ </div>
642
+ )
643
+ end
644
+
645
+ test_given_govspeak "
646
+ $CTA
647
+ Please email <developer@digital.cabinet-office.GOV.UK>
648
+ $CTA
649
+
650
+ *[GOV.UK]: The official UK government website
651
+ " do
652
+ assert_html_output %(
653
+ <div class="call-to-action">
654
+ <p>Please email <a href="mailto:developer@digital.cabinet-office.GOV.UK">developer@digital.cabinet-office.<abbr title="The official UK government website">GOV.UK</abbr></a></p>
655
+ </div>
656
+ )
657
+ end
658
+
659
+ test_given_govspeak "
660
+ $CTA
661
+ Welcome to the GOV.UK[^1]
662
+ $CTA
663
+
664
+ [^1]: GOV.UK is the official UK government website
665
+
666
+ *[GOV.UK]: The official UK government website
667
+ *[website]: A collection of web pages, such as GOV.UK
668
+
669
+ *[GOV.UK]: The official UK government website
670
+ " do
671
+ assert_html_output %(
672
+ <div class="call-to-action">
673
+ <p>Welcome to the <abbr title="The official UK government website">GOV.UK</abbr><sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup></p>
674
+ </div>
675
+
676
+ <div class="footnotes" role="doc-endnotes">
677
+ <ol>
678
+ <li id="fn:1" role="doc-endnote">
679
+ <p><abbr title="The official UK government website">GOV.UK</abbr> is the official UK government <abbr title="A collection of web pages, such as GOV.UK">website</abbr> <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
680
+ </li>
681
+ </ol>
682
+ </div>
683
+ )
684
+ end
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
+
640
704
  test_given_govspeak "
641
705
  1. rod
642
706
  2. jane
@@ -707,13 +771,14 @@ Teston
707
771
  $EndLegislativeList
708
772
  " do
709
773
  assert_html_output %{
774
+ <div class="legislative-list-wrapper">
710
775
  <ol class="legislative-list">
711
776
  <li>
712
777
  <p>1.0 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
713
- Fusce felis ante, lobortis non quam sit amet, tempus interdum justo.</p>
778
+ Fusce felis ante, lobortis non quam sit amet, tempus interdum justo.</p>
714
779
 
715
780
  <p>Pellentesque quam enim, egestas sit amet congue sit amet, ultrices vitae arcu.
716
- fringilla, metus dui scelerisque est.</p>
781
+ fringilla, metus dui scelerisque est.</p>
717
782
 
718
783
  <ol>
719
784
  <li>
@@ -726,10 +791,11 @@ Teston
726
791
  </li>
727
792
  <li>
728
793
  <p>1.1 Second entry
729
- Curabitur pretium pharetra sapien, a feugiat arcu euismod eget.
730
- Nunc luctus ornare varius. Nulla scelerisque, justo dictum dapibus</p>
794
+ Curabitur pretium pharetra sapien, a feugiat arcu euismod eget.
795
+ Nunc luctus ornare varius. Nulla scelerisque, justo dictum dapibus</p>
731
796
  </li>
732
- </ol>}
797
+ </ol>
798
+ </div>}
733
799
  end
734
800
 
735
801
  test_given_govspeak "
@@ -742,6 +808,7 @@ Teston
742
808
  $EndLegislativeList
743
809
  " do
744
810
  assert_html_output %{
811
+ <div class="legislative-list-wrapper">
745
812
  <ol class="legislative-list">
746
813
  <li>1. The quick</li>
747
814
  <li>2. Brown fox
@@ -752,6 +819,7 @@ Teston
752
819
  </li>
753
820
  <li>3. Dog</li>
754
821
  </ol>
822
+ </div>
755
823
  }
756
824
  end
757
825
 
@@ -766,28 +834,26 @@ Teston
766
834
  [^2]: Footnote definition two
767
835
  " do
768
836
  assert_html_output %(
837
+ <div class="legislative-list-wrapper">
769
838
  <ol class="legislative-list">
770
839
  <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>
771
- </li>
840
+ </li>
772
841
  <li>2. Item 2<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
773
- </li>
842
+ </li>
774
843
  <li>3. Item 3</li>
775
844
  </ol>
845
+ </div>
776
846
 
777
- <div class="footnotes" role="doc-endnotes">
778
- <ol>
779
- <li id="fn:1" role="doc-endnote">
780
- <p>
781
- Footnote definition one<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
782
- </p>
783
- </li>
784
- <li id="fn:2" role="doc-endnote">
785
- <p>
786
- Footnote definition two<a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
787
- </p>
788
- </li>
789
- </ol>
790
- </div>
847
+ <div class="footnotes" role="doc-endnotes">
848
+ <ol>
849
+ <li id="fn:1" role="doc-endnote">
850
+ <p>Footnote definition one <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
851
+ </li>
852
+ <li id="fn:2" role="doc-endnote">
853
+ <p>Footnote definition two <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
854
+ </li>
855
+ </ol>
856
+ </div>
791
857
  )
792
858
  end
793
859
 
@@ -811,41 +877,39 @@ Teston
811
877
  [^3]: Footnote definition two
812
878
  " do
813
879
  assert_html_output %(
880
+ <div class="legislative-list-wrapper">
814
881
  <ol class="legislative-list">
815
882
  <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>
816
- </li>
883
+ </li>
817
884
  <li>2. Item 2</li>
818
885
  <li>3. Item 3</li>
819
886
  </ol>
887
+ </div>
820
888
 
821
- <p>This is a paragraph with a footnote<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>.</p>
889
+ <p>This is a paragraph with a footnote<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>.</p>
822
890
 
891
+ <div class="legislative-list-wrapper">
823
892
  <ol class="legislative-list">
824
893
  <li>1. Item 1</li>
825
894
  <li>2. Item 2<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">[footnote 3]</a></sup>
826
- </li>
895
+ </li>
827
896
  <li>3. Item 3</li>
828
897
  </ol>
898
+ </div>
829
899
 
830
- <div class="footnotes" role="doc-endnotes">
831
- <ol>
832
- <li id="fn:1" role="doc-endnote">
833
- <p>
834
- Footnote definition one<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
835
- </p>
836
- </li>
837
- <li id="fn:2" role="doc-endnote">
838
- <p>
839
- Footnote definition two<a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
840
- </p>
841
- </li>
842
- <li id="fn:3" role="doc-endnote">
843
- <p>
844
- Footnote definition two<a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
845
- </p>
846
- </li>
847
- </ol>
848
- </div>
900
+ <div class="footnotes" role="doc-endnotes">
901
+ <ol>
902
+ <li id="fn:1" role="doc-endnote">
903
+ <p>Footnote definition one <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
904
+ </li>
905
+ <li id="fn:2" role="doc-endnote">
906
+ <p>Footnote definition two <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
907
+ </li>
908
+ <li id="fn:3" role="doc-endnote">
909
+ <p>Footnote definition two <a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
910
+ </li>
911
+ </ol>
912
+ </div>
849
913
  )
850
914
  end
851
915
 
@@ -888,101 +952,83 @@ Teston
888
952
  [^12]: Footnote definition 12
889
953
  " do
890
954
  assert_html_output %(
891
- <ol class="legislative-list">
892
- <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>
955
+ <div class="legislative-list-wrapper">
956
+ <ol class="legislative-list">
957
+ <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>
893
958
  </li>
894
- <li>2. Item 2<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
959
+ <li>2. Item 2<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
895
960
  </li>
896
- <li>3. Item 3<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">[footnote 3]</a></sup>
961
+ <li>3. Item 3<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">[footnote 3]</a></sup>
897
962
  </li>
898
- </ol>
963
+ </ol>
964
+ </div>
899
965
 
900
966
  <p>This is a paragraph with a footnote<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">[footnote 4]</a></sup>.</p>
901
967
 
902
- <ol class="legislative-list">
903
- <li>1. Item 1<sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">[footnote 5]</a></sup>
968
+ <div class="legislative-list-wrapper">
969
+ <ol class="legislative-list">
970
+ <li>1. Item 1<sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">[footnote 5]</a></sup>
904
971
  </li>
905
- <li>2. Item 2<sup id="fnref:6" role="doc-noteref"><a href="#fn:6" class="footnote" rel="footnote">[footnote 6]</a></sup>
972
+ <li>2. Item 2<sup id="fnref:6" role="doc-noteref"><a href="#fn:6" class="footnote" rel="footnote">[footnote 6]</a></sup>
906
973
  </li>
907
- <li>3. Item 3<sup id="fnref:7" role="doc-noteref"><a href="#fn:7" class="footnote" rel="footnote">[footnote 7]</a></sup>
974
+ <li>3. Item 3<sup id="fnref:7" role="doc-noteref"><a href="#fn:7" class="footnote" rel="footnote">[footnote 7]</a></sup>
908
975
  </li>
909
- </ol>
976
+ </ol>
977
+ </div>
910
978
 
911
979
  <p>This is a paragraph with a footnote<sup id="fnref:8" role="doc-noteref"><a href="#fn:8" class="footnote" rel="footnote">[footnote 8]</a></sup>.</p>
912
980
 
913
- <ol class="legislative-list">
914
- <li>1. Item 1<sup id="fnref:9" role="doc-noteref"><a href="#fn:9" class="footnote" rel="footnote">[footnote 9]</a></sup>
981
+ <div class="legislative-list-wrapper">
982
+ <ol class="legislative-list">
983
+ <li>1. Item 1<sup id="fnref:9" role="doc-noteref"><a href="#fn:9" class="footnote" rel="footnote">[footnote 9]</a></sup>
915
984
  </li>
916
- <li>2. Item 2<sup id="fnref:10" role="doc-noteref"><a href="#fn:10" class="footnote" rel="footnote">[footnote 10]</a></sup>
985
+ <li>2. Item 2<sup id="fnref:10" role="doc-noteref"><a href="#fn:10" class="footnote" rel="footnote">[footnote 10]</a></sup>
917
986
  </li>
918
- <li>3. Item 3<sup id="fnref:11" role="doc-noteref"><a href="#fn:11" class="footnote" rel="footnote">[footnote 11]</a></sup>
987
+ <li>3. Item 3<sup id="fnref:11" role="doc-noteref"><a href="#fn:11" class="footnote" rel="footnote">[footnote 11]</a></sup>
919
988
  </li>
920
- </ol>
989
+ </ol>
990
+ </div>
921
991
 
922
992
  <p>This is a paragraph with a footnote<sup id="fnref:12" role="doc-noteref"><a href="#fn:12" class="footnote" rel="footnote">[footnote 12]</a></sup>.</p>
923
993
 
924
994
  <div class="footnotes" role="doc-endnotes">
925
995
  <ol>
926
996
  <li id="fn:1" role="doc-endnote">
927
- <p>
928
- Footnote definition 1<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
929
- </p>
930
- </li>
931
- <li id="fn:2" role="doc-endnote">
932
- <p>
933
- Footnote definition 2<a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
934
- </p>
935
- </li>
936
- <li id="fn:3" role="doc-endnote">
937
- <p>
938
- Footnote definition 3<a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
939
- </p>
940
- </li>
941
- <li id="fn:4" role="doc-endnote">
942
- <p>
943
- Footnote definition 4<a href="#fnref:4" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
944
- </p>
945
- </li>
946
- <li id="fn:5" role="doc-endnote">
947
- <p>
948
- Footnote definition 5<a href="#fnref:5" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
949
- </p>
950
- </li>
951
- <li id="fn:6" role="doc-endnote">
952
- <p>
953
- Footnote definition 6<a href="#fnref:6" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
954
- </p>
955
- </li>
956
- <li id="fn:7" role="doc-endnote">
957
- <p>
958
- Footnote definition 7<a href="#fnref:7" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
959
- </p>
960
- </li>
961
- <li id="fn:8" role="doc-endnote">
962
- <p>
963
- Footnote definition 8<a href="#fnref:8" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
964
- </p>
965
- </li>
966
- <li id="fn:9" role="doc-endnote">
967
- <p>
968
- Footnote definition 9<a href="#fnref:9" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
969
- </p>
970
- </li>
971
- <li id="fn:10" role="doc-endnote">
972
- <p>
973
- Footnote definition 10<a href="#fnref:10" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
974
- </p>
975
- </li>
976
- <li id="fn:11" role="doc-endnote">
977
- <p>
978
- Footnote definition 11<a href="#fnref:11" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
979
- </p>
980
- </li>
981
- <li id="fn:12" role="doc-endnote">
982
- <p>
983
- Footnote definition 12<a href="#fnref:12" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
984
- </p>
985
- </li>
997
+ <p>Footnote definition 1 <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
998
+ </li>
999
+ <li id="fn:2" role="doc-endnote">
1000
+ <p>Footnote definition 2 <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1001
+ </li>
1002
+ <li id="fn:3" role="doc-endnote">
1003
+ <p>Footnote definition <a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1004
+ </li>
1005
+ <li id="fn:4" role="doc-endnote">
1006
+ <p>Footnote definition 4 <a href="#fnref:4" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1007
+ </li>
1008
+ <li id="fn:5" role="doc-endnote">
1009
+ <p>Footnote definition 5 <a href="#fnref:5" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1010
+ </li>
1011
+ <li id="fn:6" role="doc-endnote">
1012
+ <p>Footnote definition 6 <a href="#fnref:6" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1013
+ </li>
1014
+ <li id="fn:7" role="doc-endnote">
1015
+ <p>Footnote definition 7 <a href="#fnref:7" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1016
+ </li>
1017
+ <li id="fn:8" role="doc-endnote">
1018
+ <p>Footnote definition <a href="#fnref:8" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1019
+ </li>
1020
+ <li id="fn:9" role="doc-endnote">
1021
+ <p>Footnote definition 9 <a href="#fnref:9" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1022
+ </li>
1023
+ <li id="fn:10" role="doc-endnote">
1024
+ <p>Footnote definition 10 <a href="#fnref:10" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1025
+ </li>
1026
+ <li id="fn:11" role="doc-endnote">
1027
+ <p>Footnote definition 11 <a href="#fnref:11" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1028
+ </li>
1029
+ <li id="fn:12" role="doc-endnote">
1030
+ <p>Footnote definition 12 <a href="#fnref:12" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1031
+ </li>
986
1032
  </ol>
987
1033
  </div>
988
1034
  )
@@ -1001,29 +1047,27 @@ Teston
1001
1047
  [^2]: Footnote definition two
1002
1048
  " do
1003
1049
  assert_html_output %(
1050
+ <div class="legislative-list-wrapper">
1004
1051
  <ol class="legislative-list">
1005
1052
  <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup> with a <a href="http://www.gov.uk">link</a>
1006
- </li>
1053
+ </li>
1007
1054
  <li>2. Item 2</li>
1008
1055
  <li>3. Item 3</li>
1009
1056
  </ol>
1057
+ </div>
1010
1058
 
1011
- <p>This is a paragraph with a footnote<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup></p>
1059
+ <p>This is a paragraph with a footnote<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup></p>
1012
1060
 
1013
- <div class="footnotes" role="doc-endnotes">
1014
- <ol>
1015
- <li id="fn:1" role="doc-endnote">
1016
- <p>
1017
- Footnote definition one<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1018
- </p>
1019
- </li>
1020
- <li id="fn:2" role="doc-endnote">
1021
- <p>
1022
- Footnote definition two<a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1023
- </p>
1024
- </li>
1025
- </ol>
1026
- </div>
1061
+ <div class="footnotes" role="doc-endnotes">
1062
+ <ol>
1063
+ <li id="fn:1" role="doc-endnote">
1064
+ <p>Footnote definition one <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1065
+ </li>
1066
+ <li id="fn:2" role="doc-endnote">
1067
+ <p>Footnote definition two <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1068
+ </li>
1069
+ </ol>
1070
+ </div>
1027
1071
  )
1028
1072
  end
1029
1073
 
@@ -1038,28 +1082,26 @@ Teston
1038
1082
  [^2]: Footnote definition two with an external [link](http://www.google.com)
1039
1083
  " do
1040
1084
  assert_html_output %(
1085
+ <div class="legislative-list-wrapper">
1041
1086
  <ol class="legislative-list">
1042
1087
  <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup> with a <a href="http://www.gov.uk">link</a>
1043
- </li>
1088
+ </li>
1044
1089
  <li>2. Item 2</li>
1045
1090
  <li>3. Item 3<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
1046
- </li>
1091
+ </li>
1047
1092
  </ol>
1093
+ </div>
1048
1094
 
1049
- <div class="footnotes" role="doc-endnotes">
1050
- <ol>
1051
- <li id="fn:1" role="doc-endnote">
1052
- <p>
1053
- Footnote definition one with a <a href="http://www.gov.uk">link</a> included<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1054
- </p>
1055
- </li>
1056
- <li id="fn:2" role="doc-endnote">
1057
- <p>
1058
- Footnote definition two with an external <a rel="external" href="http://www.google.com">link</a><a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1059
- </p>
1060
- </li>
1061
- </ol>
1062
- </div>
1095
+ <div class="footnotes" role="doc-endnotes">
1096
+ <ol>
1097
+ <li id="fn:1" role="doc-endnote">
1098
+ <p>Footnote definition one with a <a href="http://www.gov.uk">link</a> included <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1099
+ </li>
1100
+ <li id="fn:2" role="doc-endnote">
1101
+ <p>Footnote definition two with an external <a rel="external" href="http://www.google.com">link</a> <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1102
+ </li>
1103
+ </ol>
1104
+ </div>
1063
1105
  )
1064
1106
  end
1065
1107
 
@@ -1070,17 +1112,17 @@ Teston
1070
1112
  [^1]: footnote text
1071
1113
  " do
1072
1114
  assert_html_output %(
1073
- <p>1. some text<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>:</p>
1074
-
1075
- <div class="footnotes" role="doc-endnotes">
1076
- <ol>
1077
- <li id="fn:1" role="doc-endnote">
1078
- <p>
1079
- footnote text<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1080
- </p>
1081
- </li>
1082
- </ol>
1083
- </div>
1115
+ <div class="legislative-list-wrapper">
1116
+ <p>1. some text<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>:</p>
1117
+ </div>
1118
+
1119
+ <div class="footnotes" role="doc-endnotes">
1120
+ <ol>
1121
+ <li id="fn:1" role="doc-endnote">
1122
+ <p>footnote text <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1123
+ </li>
1124
+ </ol>
1125
+ </div>
1084
1126
  )
1085
1127
  end
1086
1128
 
@@ -1091,15 +1133,15 @@ Teston
1091
1133
  [^1]: footnote text
1092
1134
  " do
1093
1135
  assert_html_output %(
1094
- <p>1. some text<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>: extra</p>
1136
+ <div class="legislative-list-wrapper">
1137
+ <p>1. some text<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup>: extra</p>
1138
+ </div>
1095
1139
 
1096
1140
  <div class="footnotes" role="doc-endnotes">
1097
1141
  <ol>
1098
1142
  <li id="fn:1" role="doc-endnote">
1099
- <p>
1100
- footnote text<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1101
- </p>
1102
- </li>
1143
+ <p>footnote text <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1144
+ </li>
1103
1145
  </ol>
1104
1146
  </div>
1105
1147
  )
@@ -1120,32 +1162,28 @@ Teston
1120
1162
  *[class]: Testing HTML matching
1121
1163
  " do
1122
1164
  assert_html_output %(
1123
- <ol class="legislative-list">
1124
- <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup> with an <abbr title="This is the acronym explanation">ACRONYM</abbr>
1165
+ <div class="legislative-list-wrapper">
1166
+ <ol class="legislative-list">
1167
+ <li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup> with an <abbr title="This is the acronym explanation">ACRONYM</abbr>
1125
1168
  </li>
1126
- <li>2. Item 2<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
1169
+ <li>2. Item 2<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
1127
1170
  </li>
1128
- <li>3. Item 3<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">[footnote 3]</a></sup>
1171
+ <li>3. Item 3<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">[footnote 3]</a></sup>
1129
1172
  </li>
1130
- </ol>
1173
+ </ol>
1174
+ </div>
1131
1175
 
1132
1176
  <div class="footnotes" role="doc-endnotes">
1133
1177
  <ol>
1134
1178
  <li id="fn:1" role="doc-endnote">
1135
- <p>
1136
- Footnote definition one<a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1137
- </p>
1138
- </li>
1139
- <li id="fn:2" role="doc-endnote">
1140
- <p>
1141
- Footnote definition two with an <abbr title="This is the acronym explanation">ACRONYM</abbr><a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1142
- </p>
1143
- </li>
1144
- <li id="fn:3" role="doc-endnote">
1145
- <p>
1146
- Footnote definition three with an acronym that matches an HTML tag <abbr title="Testing HTML matching">class</abbr><a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
1147
- </p>
1148
- </li>
1179
+ <p>Footnote definition one <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1180
+ </li>
1181
+ <li id="fn:2" role="doc-endnote">
1182
+ <p>Footnote definition two with an <abbr title="This is the acronym explanation">ACRONYM</abbr> <a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1183
+ </li>
1184
+ <li id="fn:3" role="doc-endnote">
1185
+ <p>Footnote definition three with an acronym that matches an HTML tag <abbr title="Testing HTML matching">class</abbr> <a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1186
+ </li>
1149
1187
  </ol>
1150
1188
  </div>
1151
1189
  )
@@ -1172,9 +1210,11 @@ Teston
1172
1210
  assert_html_output %(
1173
1211
  <p>The quick brown fox</p>
1174
1212
 
1175
- <ol class="legislative-list">
1176
- <li>1. jumps over the lazy dog</li>
1177
- </ol>
1213
+ <div class="legislative-list-wrapper">
1214
+ <ol class="legislative-list">
1215
+ <li>1. jumps over the lazy dog</li>
1216
+ </ol>
1217
+ </div>
1178
1218
  )
1179
1219
  end
1180
1220
 
@@ -1182,12 +1222,88 @@ Teston
1182
1222
  assert_html_output %(
1183
1223
  <p>This bit of text</p>
1184
1224
 
1185
- <ol class="legislative-list">
1186
- <li>1. should be turned into a list</li>
1187
- </ol>
1225
+ <div class="legislative-list-wrapper">
1226
+ <ol class="legislative-list">
1227
+ <li>1. should be turned into a list</li>
1228
+ </ol>
1229
+ </div>
1230
+ )
1231
+ end
1232
+
1233
+ test_given_govspeak "
1234
+ $LegislativeList
1235
+ Welcome to the GOV.UK website
1236
+ $EndLegislativeList
1237
+
1238
+ *[GOV.UK]: The official UK government website
1239
+ *[website]: A collection of web pages, such as GOV.UK
1240
+ " do
1241
+ assert_html_output %(
1242
+ <div class="legislative-list-wrapper">
1243
+ <p>Welcome to the <abbr title="The official UK government website">GOV.UK</abbr> <abbr title="A collection of web pages, such as GOV.UK">website</abbr></p>
1244
+ </div>
1245
+ )
1246
+ end
1247
+
1248
+ test_given_govspeak "
1249
+ $LegislativeList
1250
+ Please email <developer@digital.cabinet-office.GOV.UK>
1251
+ $EndLegislativeList
1252
+
1253
+ *[GOV.UK]: The official UK government website
1254
+ " do
1255
+ assert_html_output %(
1256
+ <div class="legislative-list-wrapper">
1257
+ <p>Please email <a href="mailto:developer@digital.cabinet-office.GOV.UK">developer@digital.cabinet-office.<abbr title="The official UK government website">GOV.UK</abbr></a></p>
1258
+ </div>
1259
+ )
1260
+ end
1261
+
1262
+ test_given_govspeak "
1263
+ $LegislativeList
1264
+ Welcome to the GOV.UK[^1]
1265
+ $EndLegislativeList
1266
+
1267
+ [^1]: GOV.UK is the official UK government website
1268
+
1269
+ *[GOV.UK]: The official UK government website
1270
+ *[website]: A collection of web pages, such as GOV.UK
1271
+
1272
+ *[GOV.UK]: The official UK government website
1273
+ " do
1274
+ assert_html_output %(
1275
+ <div class="legislative-list-wrapper">
1276
+ <p>Welcome to the <abbr title="The official UK government website">GOV.UK</abbr><sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup></p>
1277
+ </div>
1278
+
1279
+ <div class="footnotes" role="doc-endnotes">
1280
+ <ol>
1281
+ <li id="fn:1" role="doc-endnote">
1282
+ <p><abbr title="The official UK government website">GOV.UK</abbr> is the official UK government <abbr title="A collection of web pages, such as GOV.UK">website</abbr> <a href="#fnref:1" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a></p>
1283
+ </li>
1284
+ </ol>
1285
+ </div>
1188
1286
  )
1189
1287
  end
1190
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
+
1191
1307
  test_given_govspeak "
1192
1308
  Zippy, Bungle and George did not qualify for the tax exemption in s428. They filled in their tax return accordingly.
1193
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.2.1
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-09-01 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.19
330
+ rubygems_version: 3.4.21
331
331
  signing_key:
332
332
  specification_version: 4
333
333
  summary: Markup language for single domain