govspeak 6.1.1 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b48fa791c90052e6ee6f2c235d3baba095c5de501f32b7e2748f05396a799899
4
- data.tar.gz: c5e325373b8c6d20e2d59db3b38b5345ccce22a83edba93a9ec41ba03156e1cb
3
+ metadata.gz: 8f4b2e89725aba68cf9965f46da83bc82a1db1db0c7a12196d0d39feffbdeeb9
4
+ data.tar.gz: 7270344803d8cc4185a4b1068744e957fef700f00c38be5a1c07df01d550682c
5
5
  SHA512:
6
- metadata.gz: 3ddd06fa6841ce2efcbfbf660ae09eeff3114b6f4e5de067ed7b09457f6be14e29caa5803b281e24dad159e7c2a49594ef9e98a7d68f54e01930a4a31932ce32
7
- data.tar.gz: e4811322275d4f221e198bf8112040340e922d3713ab82bac32395ad386243259e4f4fca1973cb050af9df12e4c1b10b8c17a62febb7f06c2ddbbbacc857d16d
6
+ metadata.gz: e8f3c856283a4e752c4d16b9b346c07532b1932e6874054695243dd63bd8650fa77dcd4c962de99c6ae49fb54c21e71b7291663a8795a863cd63f022a8afb790
7
+ data.tar.gz: dfee1a3832ab8c2fdaeeba352f5a070c35453eb10b9514a8c1869b415e21a3c753446bec38785a46a921ff6a527cc970c6e82c66fbeea03687d62900bd7d43e9
@@ -1,3 +1,8 @@
1
+ # 6.2.0
2
+
3
+ * Remove experimental status on `AttachementLink:attachment-id` and `Attachement:attachment-id`
4
+ * Deprecate `embed:attachments:inline:content-id`
5
+
1
6
  ## 6.1.1
2
7
 
3
8
  * Fix wrapping `AttachmentLink:attachment-id` in a paragraph when used inline
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
- ### Inline Attachment
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
 
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Govspeak
2
- VERSION = "6.1.1".freeze
2
+ VERSION = "6.2.0".freeze
3
3
  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: 6.1.1
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-05-23 00:00:00.000000000 Z
11
+ date: 2019-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview