jekyll-activity-pub 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9694a2d1df46c23e5c6ca51bfa88fb80a7df0709014be6fc0d48cae3e3e4cc6f
|
4
|
+
data.tar.gz: 3f844b85c3e200db65e7d1de6cfd25ee59b8450b18bad191bd4036731443e1ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95cfe56875a41b933d99cecc6788cb44823bad551e88ac152ad6c5bb3d33742945be3b14d75ac4f4e23bc85d961c8b97bb27663ebf10da4c36b0dfd3c1d279c1
|
7
|
+
data.tar.gz: f44349daeaed27d6e7d8ac8ff53a55a5b5925b635ca40785a156a1a58d83de4e7b65844d202e7d4138ff9046680863b1bb314855d70f7452247f2a5707f86336
|
@@ -16,6 +16,15 @@ module Jekyll
|
|
16
16
|
# Some filters needs a Liquid-like context
|
17
17
|
StubContext = Struct.new(:registers, keyword_init: true)
|
18
18
|
|
19
|
+
# Removes empty values from data
|
20
|
+
#
|
21
|
+
# @return [Hash]
|
22
|
+
def pruned_data
|
23
|
+
data.reject do |_, v|
|
24
|
+
v.nil? || (v.respond_to?(:empty?) && v.empty?)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
19
28
|
# Renders the data hash as a stringified JSON
|
20
29
|
#
|
21
30
|
# @return [String]
|
@@ -188,12 +197,6 @@ module Jekyll
|
|
188
197
|
|
189
198
|
absolute_url url
|
190
199
|
end
|
191
|
-
|
192
|
-
def pruned_data
|
193
|
-
data.reject do |_, v|
|
194
|
-
v.nil? || (v.respond_to?(:empty?) && v.empty?)
|
195
|
-
end
|
196
|
-
end
|
197
200
|
end
|
198
201
|
end
|
199
202
|
end
|
@@ -6,8 +6,9 @@
|
|
6
6
|
# Priority is low so it's the last thing we do. If you need to modify
|
7
7
|
# the original activities after this plugins runs, use priority 0.
|
8
8
|
#
|
9
|
-
# The hook runs on
|
10
|
-
|
9
|
+
# The hook runs on post render so we can add the extra pages after
|
10
|
+
# activity generation but before write.
|
11
|
+
Jekyll::Hooks.register :site, :post_render, priority: 1 do |site|
|
11
12
|
require 'jekyll/activity_pub/link'
|
12
13
|
|
13
14
|
# Changes the URLs from a base URL to have a different scheme
|
@@ -49,7 +50,6 @@ Jekyll::Hooks.register :site, :pre_render, priority: 1 do |site|
|
|
49
50
|
site.pages.each do |page|
|
50
51
|
case page
|
51
52
|
when Jekyll::ActivityPub::Activity, Jekyll::ActivityPub::Actor
|
52
|
-
site = page.site
|
53
53
|
uri = Addressable::URI.parse page.data['id']
|
54
54
|
url = [ Jekyll::ActivityPub::Link.new(site, page.data['url'], 'canonical', 'text/html') ]
|
55
55
|
|
@@ -62,9 +62,8 @@ Jekyll::Hooks.register :site, :pre_render, priority: 1 do |site|
|
|
62
62
|
end
|
63
63
|
|
64
64
|
%w[ipns hyper bittorrent].each do |protocol|
|
65
|
-
json = convert_uris(page.
|
66
|
-
|
67
|
-
end
|
65
|
+
json = convert_uris(page.pruned_data, site.config['url'], protocol)
|
66
|
+
json['url'] = url
|
68
67
|
|
69
68
|
uri = Addressable::URI.parse(json['id'])
|
70
69
|
uri.path = uri.path.sub('.jsonld', ".#{protocol}.jsonld")
|
@@ -74,9 +73,14 @@ Jekyll::Hooks.register :site, :pre_render, priority: 1 do |site|
|
|
74
73
|
Jekyll::PageWithoutAFile.new(site, site.source, File.dirname(path), File.basename(path)).tap do |alternate|
|
75
74
|
site.pages << alternate
|
76
75
|
|
77
|
-
alternate.content = json.to_json
|
76
|
+
alternate.output = alternate.content = json.to_json
|
78
77
|
end
|
79
78
|
end
|
79
|
+
|
80
|
+
page.data['url'] = url
|
81
|
+
page.output = page.content
|
82
|
+
|
83
|
+
Jekyll.logger.info 'FEP fffd:', 'Generated'
|
80
84
|
end
|
81
85
|
end
|
82
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-activity-pub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sutty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: distributed-press-api-client
|