govspeak 5.9.0 → 5.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/govspeak.rb +4 -3
- data/lib/govspeak/version.rb +1 -1
- data/test/govspeak_images_test.rb +23 -0
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a66dce46f2af9208dfc78c813b601fe8a447a0c5a68c085516dcf37d9fd5567d
|
4
|
+
data.tar.gz: 62323ec0ee81856973bea87d1575a5aac0d1c4f957ad2261d3081ec6206a45f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b14f7a1707a14e6342b709425556c5d69f64c12ba6523fc0c30ad5a8a98580e05115842cb7c70aa949c219683901e050c415df7b63249c910c59c73a75e011c
|
7
|
+
data.tar.gz: '02386b5204b077af3a5fa03512e0ed451b77ec3a65e38b17015bab5267431b25382b0103338128c02583e6a3b075eb6ff7f41210a3bdcb8a236d139d182cd6c6'
|
data/CHANGELOG.md
CHANGED
data/lib/govspeak.rb
CHANGED
@@ -29,6 +29,7 @@ module Govspeak
|
|
29
29
|
Parser = Kramdown::Parser::KramdownWithAutomaticExternalLinks
|
30
30
|
PARSER_CLASS_NAME = Parser.name.split("::").last
|
31
31
|
UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.freeze
|
32
|
+
NEW_PARAGRAPH_LOOKBEHIND = %q{(?<=\A|\n\n|\r\n\r\n)}.freeze
|
32
33
|
|
33
34
|
@extensions = []
|
34
35
|
|
@@ -287,7 +288,7 @@ module Govspeak
|
|
287
288
|
%{\n<div class="address"><div class="adr org fn"><p>\n#{body.sub("\n", '').gsub("\n", '<br />')}\n</p></div></div>\n}
|
288
289
|
}
|
289
290
|
|
290
|
-
extension("legislative list",
|
291
|
+
extension("legislative list", /#{NEW_PARAGRAPH_LOOKBEHIND}\$LegislativeList\s*$(.*?)\$EndLegislativeList/m) do |body|
|
291
292
|
Govspeak::KramdownOverrides.with_kramdown_ordered_lists_disabled do
|
292
293
|
Kramdown::Document.new(body.strip).to_html.tap do |doc|
|
293
294
|
doc.gsub!('<ul>', '<ol>')
|
@@ -324,7 +325,7 @@ module Govspeak
|
|
324
325
|
end
|
325
326
|
end
|
326
327
|
|
327
|
-
extension("Priority list",
|
328
|
+
extension("Priority list", /#{NEW_PARAGRAPH_LOOKBEHIND}\$PriorityList:(\d+)\s*$(.*?)(?:^\s*$|\Z)/m) do |number_to_show, body|
|
328
329
|
number_to_show = number_to_show.to_i
|
329
330
|
tagged = 0
|
330
331
|
Govspeak::Document.new(body.strip).to_html.gsub(/<li>/) do |match|
|
@@ -357,7 +358,7 @@ module Govspeak
|
|
357
358
|
@renderer.result(binding)
|
358
359
|
end
|
359
360
|
|
360
|
-
extension('Image',
|
361
|
+
extension('Image', /#{NEW_PARAGRAPH_LOOKBEHIND}\[Image:\s*(.*?)\s*\]/) do |image_id|
|
361
362
|
image = images.detect { |c| c.is_a?(Hash) && c[:id] == image_id }
|
362
363
|
next "" unless image
|
363
364
|
|
data/lib/govspeak/version.rb
CHANGED
@@ -93,4 +93,27 @@ class GovspeakImagesTest < Minitest::Test
|
|
93
93
|
)
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
97
|
+
test "Image is not inserted when it does not start on a new line" do
|
98
|
+
given_govspeak "some text [Image:image-id]", images: [build_image] do
|
99
|
+
assert_html_output("<p>some text [Image:image-id]</p>")
|
100
|
+
end
|
101
|
+
|
102
|
+
given_govspeak "[Image:image-id]", images: [build_image] do
|
103
|
+
assert_html_output(
|
104
|
+
%{<figure class="image embedded">} +
|
105
|
+
%{<div class="img"><img src="http://example.com/image.jpg" alt="my alt"></div>} +
|
106
|
+
%{</figure>}
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
given_govspeak "[Image:image-id] some text", images: [build_image] do
|
111
|
+
assert_html_output(
|
112
|
+
%{<figure class="image embedded">} +
|
113
|
+
%{<div class="img"><img src="http://example.com/image.jpg" alt="my alt"></div>} +
|
114
|
+
%{</figure>\n} +
|
115
|
+
%{<p>some text</p>}
|
116
|
+
)
|
117
|
+
end
|
118
|
+
end
|
96
119
|
end
|
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: 5.9.
|
4
|
+
version: 5.9.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:
|
11
|
+
date: 2019-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -359,27 +359,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
359
|
- !ruby/object:Gem::Version
|
360
360
|
version: '0'
|
361
361
|
requirements: []
|
362
|
-
|
363
|
-
rubygems_version: 2.7.6
|
362
|
+
rubygems_version: 3.0.1
|
364
363
|
signing_key:
|
365
364
|
specification_version: 4
|
366
365
|
summary: Markup language for single domain
|
367
366
|
test_files:
|
368
|
-
- test/
|
369
|
-
- test/govspeak_test_helper.rb
|
367
|
+
- test/govspeak_link_extractor_test.rb
|
370
368
|
- test/govspeak_structured_headers_test.rb
|
371
|
-
- test/govspeak_attachments_image_test.rb
|
372
|
-
- test/govspeak_attachments_test.rb
|
373
|
-
- test/test_helper.rb
|
374
|
-
- test/govspeak_attachments_inline_test.rb
|
375
|
-
- test/html_sanitizer_test.rb
|
376
|
-
- test/govspeak_button_test.rb
|
377
369
|
- test/govspeak_images_bang_test.rb
|
378
|
-
- test/
|
379
|
-
- test/html_validator_test.rb
|
370
|
+
- test/govspeak_button_test.rb
|
380
371
|
- test/govspeak_extract_contact_content_ids_test.rb
|
381
|
-
- test/
|
382
|
-
- test/
|
372
|
+
- test/blockquote_extra_quote_remover_test.rb
|
373
|
+
- test/govspeak_test_helper.rb
|
383
374
|
- test/govspeak_link_test.rb
|
375
|
+
- test/govspeak_images_test.rb
|
384
376
|
- test/govspeak_contacts_test.rb
|
377
|
+
- test/test_helper.rb
|
378
|
+
- test/html_validator_test.rb
|
379
|
+
- test/html_sanitizer_test.rb
|
380
|
+
- test/govspeak_attachments_inline_test.rb
|
381
|
+
- test/govspeak_test.rb
|
382
|
+
- test/govspeak_attachments_test.rb
|
383
|
+
- test/govspeak_attachments_image_test.rb
|
385
384
|
- test/presenters/h_card_presenter_test.rb
|