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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/govspeak/post_processor.rb +9 -0
- data/lib/govspeak/version.rb +1 -1
- data/lib/govspeak.rb +10 -88
- data/lib/kramdown/parser/govuk.rb +18 -1
- data/test/govspeak_images_test.rb +0 -7
- data/test/govspeak_test.rb +344 -228
- data/test/govspeak_test_helper.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330ac68b36870075d83d6cae5223e28d12186d7b9435be02df50829f11d8c27e
|
4
|
+
data.tar.gz: 3d0b8d3e7b1f98d9e3c814f141319a56a8388ac114b308aba7c3945e5661bbe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/govspeak/version.rb
CHANGED
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
|
-
|
326
|
-
|
327
|
-
|
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
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
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(
|
data/test/govspeak_test.rb
CHANGED
@@ -420,13 +420,13 @@ Teston
|
|
420
420
|
$CTA" do
|
421
421
|
assert_html_output %(
|
422
422
|
<div class="call-to-action">
|
423
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
544
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
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
|
-
|
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
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
730
|
-
|
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
|
-
|
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
|
-
|
842
|
+
</li>
|
774
843
|
<li>3. Item 3</li>
|
775
844
|
</ol>
|
845
|
+
</div>
|
776
846
|
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
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
|
-
|
883
|
+
</li>
|
817
884
|
<li>2. Item 2</li>
|
818
885
|
<li>3. Item 3</li>
|
819
886
|
</ol>
|
887
|
+
</div>
|
820
888
|
|
821
|
-
|
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
|
-
|
895
|
+
</li>
|
827
896
|
<li>3. Item 3</li>
|
828
897
|
</ol>
|
898
|
+
</div>
|
829
899
|
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
<
|
839
|
-
Footnote definition two<a href="#fnref:
|
840
|
-
</
|
841
|
-
</
|
842
|
-
|
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
|
-
<
|
892
|
-
<
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
<
|
903
|
-
<
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
<
|
914
|
-
<
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
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 3 <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 8 <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
|
-
|
1053
|
+
</li>
|
1007
1054
|
<li>2. Item 2</li>
|
1008
1055
|
<li>3. Item 3</li>
|
1009
1056
|
</ol>
|
1057
|
+
</div>
|
1010
1058
|
|
1011
|
-
|
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
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
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
|
-
|
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
|
-
|
1091
|
+
</li>
|
1047
1092
|
</ol>
|
1093
|
+
</div>
|
1048
1094
|
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
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
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
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
|
-
<
|
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
|
-
|
1100
|
-
|
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
|
-
<
|
1124
|
-
<
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
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
|
-
<
|
1176
|
-
<
|
1177
|
-
|
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
|
-
<
|
1186
|
-
<
|
1187
|
-
|
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.
|
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-
|
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.
|
330
|
+
rubygems_version: 3.4.21
|
331
331
|
signing_key:
|
332
332
|
specification_version: 4
|
333
333
|
summary: Markup language for single domain
|