onebox 2.2.13 → 2.2.14
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/lib/onebox/engine/github_commit_onebox.rb +10 -12
- data/lib/onebox/version.rb +1 -1
- data/templates/github/github_body.mustache +3 -1
- data/templates/githubcommit.mustache +2 -8
- data/templates/githubissue.mustache +2 -2
- data/templates/githubpullrequest.mustache +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b9626bc9bec1d423e617a946df2e4be0334cf6f7693056dc79865b50f127e26
|
|
4
|
+
data.tar.gz: 9fc7c684bc99a33d356cfbf0c1a085e5dc1531aa6a6a3028670afb05406c4448
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a3f999936fbfe289e07b58b424e735d13c2e3132beffb16c41a6094fa42aa0dd1018d544175eba1f1ad7552b26cade7096d72ff286268a097230835d8f9c99d
|
|
7
|
+
data.tar.gz: 1effdda4c94dc9dbded959fc3acf0a51d6efd09629cccd2e9c2c1df74d637c9b8cb577be7fb79dc90b3ba42125af6dfde0c56e33cb8b31f6d4a72d0090a0fded
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../mixins/github_body'
|
|
4
|
+
|
|
3
5
|
module Onebox
|
|
4
6
|
module Engine
|
|
5
7
|
class GithubCommitOnebox
|
|
6
8
|
include Engine
|
|
7
9
|
include LayoutSupport
|
|
8
10
|
include JSON
|
|
11
|
+
include Onebox::Mixins::GithubBody
|
|
9
12
|
|
|
10
13
|
matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commit/")
|
|
11
14
|
always_https
|
|
@@ -27,25 +30,20 @@ module Onebox
|
|
|
27
30
|
|
|
28
31
|
def data
|
|
29
32
|
result = raw.clone
|
|
30
|
-
result['link'] = link
|
|
31
|
-
result['title'] = result['commit']['message'].split("\n").first
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
lines = result['commit']['message'].split("\n")
|
|
35
|
+
result['title'] = lines.first
|
|
36
|
+
result['body'], result['excerpt'] = compute_body(lines[1..lines.length].join("\n"))
|
|
35
37
|
|
|
36
|
-
message_words = message.gsub("\n\n", "\n").gsub("\n", "<br>").split(" ")
|
|
37
|
-
max_words = 20
|
|
38
|
-
result['message'] = message_words[0..max_words].join(" ")
|
|
39
|
-
result['message'] += "..." if message_words.length > max_words
|
|
40
|
-
result['message'] = result['message'].gsub("<br>", "\n")
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
ulink = URI(link)
|
|
44
38
|
committed_at = Time.parse(result['commit']['author']['date'])
|
|
45
39
|
result['committed_at'] = committed_at.strftime("%I:%M%p - %d %b %y %Z")
|
|
46
40
|
result['committed_at_date'] = committed_at.strftime("%F")
|
|
47
41
|
result['committed_at_time'] = committed_at.strftime("%T")
|
|
42
|
+
|
|
43
|
+
result['link'] = link
|
|
44
|
+
ulink = URI(link)
|
|
48
45
|
result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
|
|
46
|
+
|
|
49
47
|
result
|
|
50
48
|
end
|
|
51
49
|
end
|
data/lib/onebox/version.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
{{#body}}
|
|
2
|
-
<
|
|
2
|
+
<div class="github-row">
|
|
3
|
+
<p class="github-body-container">{{body}}{{#excerpt}}<span class="show-more-container"><a href="{{html_url}}" target="_blank" rel="noopener" class="show-more">…</a>{{/excerpt}}</span>{{#excerpt}}<span class="excerpt hidden">{{excerpt}}</span>{{/excerpt}}</p>
|
|
4
|
+
</div>
|
|
3
5
|
{{/body}}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<img alt="{{author.login}}" src="{{author.avatar_url}}" class="onebox-avatar-inline" width="20" height="20">
|
|
19
19
|
{{author.login}}
|
|
20
20
|
</a>
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
24
|
<div class="lines" title="changed {{files.length}} files with {{stats.additions}} additions and {{stats.deletions}} deletions">
|
|
@@ -32,10 +32,4 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
{{#message}}
|
|
37
|
-
<div class="github-row">
|
|
38
|
-
<pre class="github-content" style="white-space: normal;">{{message}}</pre>
|
|
39
|
-
</div>
|
|
40
|
-
{{/message}}
|
|
41
|
-
|
|
35
|
+
{{> github/github_body}}
|
|
@@ -27,8 +27,6 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
{{> github/github_body}}
|
|
31
|
-
|
|
32
30
|
<div class='labels'>
|
|
33
31
|
{{#labels}}
|
|
34
32
|
<span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">{{name}}</span>
|
|
@@ -36,3 +34,5 @@
|
|
|
36
34
|
</div>
|
|
37
35
|
</div>
|
|
38
36
|
</div>
|
|
37
|
+
|
|
38
|
+
{{> github/github_body}}
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onebox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.14
|
|
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
13
|
date: 2021-04-15 00:00:00.000000000 Z
|
|
@@ -407,7 +407,7 @@ homepage: https://github.com/discourse/onebox
|
|
|
407
407
|
licenses:
|
|
408
408
|
- MIT
|
|
409
409
|
metadata: {}
|
|
410
|
-
post_install_message:
|
|
410
|
+
post_install_message:
|
|
411
411
|
rdoc_options: []
|
|
412
412
|
require_paths:
|
|
413
413
|
- lib
|
|
@@ -423,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
423
423
|
version: '0'
|
|
424
424
|
requirements: []
|
|
425
425
|
rubygems_version: 3.0.3
|
|
426
|
-
signing_key:
|
|
426
|
+
signing_key:
|
|
427
427
|
specification_version: 4
|
|
428
428
|
summary: A gem for generating embeddable HTML previews from URLs.
|
|
429
429
|
test_files: []
|