govspeak 6.1.1 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +77 -1
- data/lib/govspeak.rb +1 -7
- data/lib/govspeak/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f4b2e89725aba68cf9965f46da83bc82a1db1db0c7a12196d0d39feffbdeeb9
|
4
|
+
data.tar.gz: 7270344803d8cc4185a4b1068744e957fef700f00c38be5a1c07df01d550682c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f3c856283a4e752c4d16b9b346c07532b1932e6874054695243dd63bd8650fa77dcd4c962de99c6ae49fb54c21e71b7291663a8795a863cd63f022a8afb790
|
7
|
+
data.tar.gz: dfee1a3832ab8c2fdaeeba352f5a070c35453eb10b9514a8c1869b415e21a3c753446bec38785a46a921ff6a527cc970c6e82c66fbeea03687d62900bd7d43e9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -352,7 +352,83 @@ Embedded content allows authors to reference a supporting item of a document by
|
|
352
352
|
referencing an id. The details of this content is passed to the publishing
|
353
353
|
application to govspeak at the time of rendering.
|
354
354
|
|
355
|
-
###
|
355
|
+
### Attachments
|
356
|
+
|
357
|
+
Attachments can be be rendered as blocks
|
358
|
+
|
359
|
+
[Attachment:file.txt]
|
360
|
+
|
361
|
+
with options provided
|
362
|
+
|
363
|
+
{
|
364
|
+
attachments: [
|
365
|
+
{
|
366
|
+
id: "file.txt",
|
367
|
+
title: "My attached file",
|
368
|
+
url: "http://example.com/file.txt",
|
369
|
+
filename: "file.txt",
|
370
|
+
content_type: "text/plain",
|
371
|
+
file_size: 1024,
|
372
|
+
}
|
373
|
+
]
|
374
|
+
}
|
375
|
+
|
376
|
+
will output an attachment block
|
377
|
+
|
378
|
+
```html
|
379
|
+
<section class="gem-c-attachment">
|
380
|
+
<div class="gem-c-attachment__thumbnail">
|
381
|
+
<a class="govuk-link" target="_self" tabindex="-1" aria-hidden="true" href="http://example.com/file.txt">
|
382
|
+
<svg class="gem-c-attachment__thumbnail-image" version="1.1" viewbox="0 0 84 120" width="84" height="120" aria-hidden="true">
|
383
|
+
<path d="M74.85 5v106H5" fill="none" stroke-miterlimit="10" stroke-width="2"></path>
|
384
|
+
<path d="M79.85 10v106H10" fill="none" stroke-miterlimit="10" stroke-width="2"></path>
|
385
|
+
</svg>
|
386
|
+
|
387
|
+
</a>
|
388
|
+
</div>
|
389
|
+
<div class="gem-c-attachment__details">
|
390
|
+
<h2 class="gem-c-attachment__title">
|
391
|
+
<a class="govuk-link" target="_self" href="http://example.com/file.txt">My attached file</a>
|
392
|
+
</h2>
|
393
|
+
<p class="gem-c-attachment__metadata"><span class="gem-c-attachment__attribute">Plain Text</span>, <span class="gem-c-attachment__attribute">1 KB</span></p>
|
394
|
+
|
395
|
+
|
396
|
+
</div></section>
|
397
|
+
```
|
398
|
+
|
399
|
+
### Attachment Links
|
400
|
+
|
401
|
+
Attachments can be be rendered inline as links
|
402
|
+
|
403
|
+
Some information about [AttachmentLink:file.pdf]
|
404
|
+
|
405
|
+
with options provided
|
406
|
+
|
407
|
+
{
|
408
|
+
attachments: [
|
409
|
+
{
|
410
|
+
id: "file.pdf",
|
411
|
+
title: "My PDF",
|
412
|
+
url: "http://example.com/file.pdf",
|
413
|
+
filename: "file.pdf",
|
414
|
+
content_type: "application/pdf",
|
415
|
+
file_size: 32768,
|
416
|
+
number_of_pages: 2,
|
417
|
+
}
|
418
|
+
]
|
419
|
+
}
|
420
|
+
|
421
|
+
will output an attachment link within a paragraph of text
|
422
|
+
|
423
|
+
```html
|
424
|
+
<p>Some information about <span class="gem-c-attachment-link">
|
425
|
+
<a class="govuk-link" href="http://example.com/file.pdf">My PDF</a>
|
426
|
+
|
427
|
+
(<span class="gem-c-attachment-link__attribute"><abbr title="Portable Document Format" class="gem-c-attachment-link__abbr">PDF</abbr></span>, <span class="gem-c-attachment-link__attribute">32 KB</span>, <span class="gem-c-attachment-link__attribute">2 pages</span>)
|
428
|
+
</span></p>
|
429
|
+
```
|
430
|
+
|
431
|
+
### Inline Attachments (DEPRECATED: use `AttachmentLink:attachment-id` instead)
|
356
432
|
|
357
433
|
Attachments can be linked to inline
|
358
434
|
|
data/lib/govspeak.rb
CHANGED
@@ -217,6 +217,7 @@ module Govspeak
|
|
217
217
|
render_image(ImagePresenter.new(image))
|
218
218
|
end
|
219
219
|
|
220
|
+
# DEPRECATED: use 'AttachmentLink:attachment-id' instead
|
220
221
|
extension('embed attachment inline', /\[embed:attachments:inline:\s*(.*?)\s*\]/) do |content_id|
|
221
222
|
attachment = attachments.detect { |a| a[:content_id] == content_id }
|
222
223
|
next "" unless attachment
|
@@ -348,19 +349,12 @@ module Govspeak
|
|
348
349
|
render_image(ImagePresenter.new(image))
|
349
350
|
end
|
350
351
|
|
351
|
-
# This is an alternative syntax for embedding attachments using a readable id (expected
|
352
|
-
# to be a unique variation of a filename). This syntax is being used by
|
353
|
-
# Content Publisher and should be considered experimental as it is likely
|
354
|
-
# to be iterated in the short term.
|
355
352
|
extension('Attachment', /#{NEW_PARAGRAPH_LOOKBEHIND}\[Attachment:\s*(.*?)\s*\]/) do |attachment_id|
|
356
353
|
next "" if attachments.none? { |a| a[:id] == attachment_id }
|
357
354
|
|
358
355
|
%{<govspeak-embed-attachment id="#{attachment_id}"></govspeak-embed-attachment>}
|
359
356
|
end
|
360
357
|
|
361
|
-
# This is an alternative syntax for embedding attachments as links. This
|
362
|
-
# syntax is being used by Content Publisher and should be considered
|
363
|
-
# experimental
|
364
358
|
extension('AttachmentLink', /\[AttachmentLink:\s*(.*?)\s*\]/) do |attachment_id|
|
365
359
|
next "" if attachments.none? { |a| a[:id] == attachment_id }
|
366
360
|
|
data/lib/govspeak/version.rb
CHANGED
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: 6.
|
4
|
+
version: 6.2.0
|
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: 2019-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|