onebox 2.2.11 → 2.2.12

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: 00cdd8f25e8df4b1c992886e522e6dc6671973de81194796974f527c4f18aa7c
4
- data.tar.gz: 96f9e2de815bef82f86170e0abf97234072c824d97a3322daef992e1dbc41a91
3
+ metadata.gz: cdbe1e67e709c8a2c8179a7118f4b51447a15a1bf1b56619fc601d3a9486123e
4
+ data.tar.gz: 8a72a7fc2152789c4103de330b7dcd69ec9a9c487fdc499a6068bdd0840e2e26
5
5
  SHA512:
6
- metadata.gz: 57ff4ab92abbd8f2a5cbbedb7a88f3d7a517e4c1c779810f1259b58cc60c3591c43e9d4782984ab56a1389b00ee3acbaebc6298208813b694a5f73255bc3c0a7
7
- data.tar.gz: 8baea1e77f32c09724a03452ba6018721681e9832d03b23bbcf1bc61609a56cabd8098d114dd49c66c468919b1d1c4cee4cc97212a6ac97fac229bc8f4eb886b
6
+ metadata.gz: 3fe9a20e93b0aea3a3a7362bb5e9f026ddb63ab0c7edb64f5b7a1d9831fa76d001314ea0fdf07c92daefe95fc096e8068d28e3e6f5c7860689e5545646031084
7
+ data.tar.gz: 4e2e19424dab311c7a56feec82486333520f72575f95acccd1a11b8419616d2ea895e02472542d6bcdce7c5d6fbf72f887eab3941f67dd546762349bec3b66a9
@@ -20,6 +20,7 @@ module Onebox
20
20
  @match ||= @url.match(%r{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<number>[^/]+)})
21
21
  end
22
22
 
23
+ GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
23
24
  def data
24
25
  result = raw.clone
25
26
  result['link'] = link
@@ -31,6 +32,10 @@ module Onebox
31
32
 
32
33
  ulink = URI(link)
33
34
  result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
35
+
36
+ body = (result['body'] || '').gsub(GITHUB_COMMENT_REGEX, '')
37
+ result['body'] = body.present? ? body : nil
38
+
34
39
  result
35
40
  end
36
41
  end
@@ -6,7 +6,7 @@ class Sanitize
6
6
  HTTP_PROTOCOLS ||= ['http', 'https', :relative].freeze
7
7
 
8
8
  ONEBOX ||= freeze_config merge(RELAXED,
9
- elements: RELAXED[:elements] + %w[audio embed iframe source video svg path],
9
+ elements: RELAXED[:elements] + %w[audio details embed iframe source video svg path],
10
10
 
11
11
  attributes: {
12
12
  'a' => RELAXED[:attributes]['a'] + %w(target),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "2.2.11"
4
+ VERSION = "2.2.12"
5
5
  end
@@ -4,9 +4,22 @@
4
4
  </div>
5
5
 
6
6
  <div class="github-info-container">
7
- <h4>
8
- <a href="{{html_url}}" target="_blank" rel="noopener">{{title}}</a>
9
- </h4>
7
+ {{^body}}
8
+ <h4>
9
+ <a href="{{html_url}}" target="_blank" rel="noopener">{{title}}</a>
10
+ </h4>
11
+ {{/body}}
12
+
13
+ {{#body}}
14
+ <details class="onebox-details">
15
+ <summary class="onebox-details-summary">
16
+ <h4>
17
+ <a href="{{html_url}}" target="_blank" rel="noopener">{{title}}</a>
18
+ </h4>
19
+ </summary>
20
+ <p class="onebox-details-body">{{body}}</p>
21
+ </details>
22
+ {{/body}}
10
23
 
11
24
  <div class="branches">
12
25
  <code>{{base.label}}</code> ← <code>{{head.label}}</code>
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.11
4
+ version: 2.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
8
8
  - Vyki Englert
9
9
  - Robin Ward
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-07 00:00:00.000000000 Z
13
+ date: 2021-04-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -405,7 +405,7 @@ homepage: https://github.com/discourse/onebox
405
405
  licenses:
406
406
  - MIT
407
407
  metadata: {}
408
- post_install_message:
408
+ post_install_message:
409
409
  rdoc_options: []
410
410
  require_paths:
411
411
  - lib
@@ -421,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
421
421
  version: '0'
422
422
  requirements: []
423
423
  rubygems_version: 3.0.3
424
- signing_key:
424
+ signing_key:
425
425
  specification_version: 4
426
426
  summary: A gem for generating embeddable HTML previews from URLs.
427
427
  test_files: []